Forum Bugs

No glyph for Sparkling Heart

daneren2005
"Mon Apr 25 19:53:12 2016: warning: no glyphs for character U+1F496, fallback to '?'"

http://www.fileformat.info/info/unicode/char/1f496/index.htm

I was not really sure whether to file this under bugs or feature requests. When looking up this error I see other places where it was just a matter of not including the correct font packs, but I am not really sure that applies here. Is this part of a font? If so, which? Can Prince be updated to include some special characters such as this which aren't really a part of any font? Or can you point me to what font I need to include to have things like this work as a fallback renderer for these?
mikeday
This character will be supported by an emoji font presumably, but I'm not sure which one. Prince doesn't support color fonts yet, so if you need colorful emoji it will be necessary to replace this character with an image.
daneren2005
I was able to get it working by downloading a black/white emoji font https://www.google.com/get/noto/#emoji-qaae. I then defined in css:

@font-face {
	font-family: 'Emoji';
	src: local('Emoji'), url('font/NotoEmoji-Regular.ttf') format('truetype');
}

body {
	font-family: open sans, emoji;
}


I wish Google would add fonts like that to their Google Font sets so I didn't have to self-host, but oh well. It might also be worth your time to embed something like this as a fallback for Prince since I imagine as emoji gets more common I won't be the only one requesting this. Thanks for pointing me in the right direction.

PS: It's not a big deal to me, but if you ever get colored font support let me know so I can update to a colored set!
jerkob
In case other folks are looking for solutions to emoji, I was able to get monochrome emoji working by installing the EmojiOne "SVG in OT" font (https://www.emojione.com/developers/download; direct link https://github.com/emojione/emojione/blob/master/extras/fonts/emojione-svg.otf) and then updating Prince's fonts.css with:

/* emoji font */
@font-face {
    font-family: sans-serif;
    src: prince-lookup("EmojiOne")
}



This is on CentOS 6.8 with Prince 10.
daneren2005
Was color emoji support ever added or planned to be added?
mikeday
It is planned to be added; might take a little while though as there are four different formats for representing them. In the meantime you can perhaps replace them with SVG or PNG images.
beaugunderson
Emoji One is no longer open source so I'm attempting to use Noto Emoji. It works, and I get black and white emoji, but variation selectors still appear as question marks. Many emoji consist of a codepoint followed by a variation selector, so in the output I see an emoji followed by a question mark.

Is there a way I can suppress those question marks from appearing?
beaugunderson
Ah, if I instead use "twemoji-color-font" everything works. :) (despite the name it also contains black and white emoji)
daneren2005
Were you able to get it to display in black and white in the browser as well? I was originally using Noto Emoji because they had a pack that was black and white only for both browsers and Prince rendering, but it is increasingly getting out of date and I keep having users put in stuff I don't support. If I use "twemoji-color-font" it has a much better distribution of emojis, but it gives the user the false impression that they will get a color emoji from the render :(
hallvord
Might it work to apply a

filter: greyscale(100%);

CSS styling to that text to help the user see what the output is going to be?

Announcement: repos for tests/utils

daneren2005
I am having even more fun with this with multi-part emoji such as 🤦‍♂️. That emoji displays completely funky with the black & white version of Noto Emoji. I see that you guys recently started working on color emoji with: https://www.princexml.com/roadmap/

Support color emoji fonts in CBLC/CBDT format, such as Noto Color Emoji and JoyPixels (limited to 256 emoji per font for now). (ref)
Done 2020-06-11


I download the latest Prince snapshot to play around with it, but realized that that latest build at https://www.princexml.com/latest/ is 05/04/2020. Any chance of getting a new build out so I can play with some wonderful color emoji support? Also, is the 256 emoji font limit meaning that a regular Noto Color Emoji.tff won't work, or just that it can only use up to 256 fonts from that file at a time? I am really looking forward to this!

Edited by daneren2005

mikeday
We will release a new build soon, it can use Noto Color Emoji but only up to 256 emoji glyphs from each font. :D
mikeday
The latest build with emoji support is now available! There are some issues we are still working on: using more than 256 emoji glyphs as mentioned earlier, and also support for emoji tag sequences needed for some flags.
daneren2005
It is wonderful! I attached a sample now with color emoji and it looks good. Thank you so much for adding this feature! If you remember about this still whenever you have a build that support more than 256 emoji glyphs can you post it in this thread so I can update again?
  1. SPAC 2020 Page 1 2020-07-08.pdf55.4 kB
daneren2005
It looks like when rendered as a jpg the emoji are black and white. I have attached an example. Ignore the color emoji example at the top. It is an image rendered separately and embedded in the pdf.

I allow customers to choose between layered or flattened pdfs to render since some want to be able to move text boxes and such around and some people have printers that can't handle all pdfs generated by Prince. I didn't notice this until I started working on some regression testing for the new build.
  1. SPAC 2020 Page 1 2020-07-08 (3).pdf198.8 kB
mikeday
Sorry yes the rasterisation is another limit I forgot to mention earlier, we will post an update on the forum as we add more support over time.
daneren2005
Ah alright. I eagerly look forward to rasterization support so I can roll this out to my customers. Death to boring B&W emoji!
rsands
Sorry for hijacking but we tried to use the latest build and the emoji (heart symbol) came out black and white. We are not rasterizing to jpg
mikeday
Are you applying any SVG or CSS filters? Which emoji font are you using?
rsands
We didn't add anything into header for emoji font, do you have an example of how to make it work with emojis? It was the html character in the SVG (no filters)
mikeday
Prince defaults to "Noto Color Emoji", but if this font is not installed it may end up using another font that only has black and white glyphs for those characters. You can also access this font via HTTP but it will be more efficient to have it as a local file.
rsands
Thanks for this, it seems the font file from Google is very large, if not installed on the system do we need to host and reference every font file via http?
mikeday
There are three ways to access fonts:

1. Installing them as system fonts and referring to them by family name "Noto Color Emoji"
2. Saving them as local files and using a @font-face rule to refer to them by filename
3. Accessing them on the web and using a @font-face rule to refer to them by HTTP URL

Since it is a large font and you don't want Prince to download it every time it is probably best to save it as a local file. You can generate a CSS font-face rule for it by running "prince --scanfonts NotoColorEmoji.ttf".
mikeday
Today we have an updated latest build of Prince that supports emoji rasterisation for image output and filters, it also supports using more than 256 emoji from a single font and the emoji tag sequences needed for some flags.
daneren2005
That is exciting news! I look forward to trying it out today.
daneren2005
Everything looks good on this now. I am looking to roll out support for color emoji on Monday. Thank you for all of your help getting this going!
mikeday
One more latest build, now with support for OpenType SVG fonts like the Twitter Emoji font! I think this brings our emoji support to a successful conclusion. :D