Forum Feature requests

Emoji/Emoticon Support

joelmeador
It would be good to have built-in support for the HTML entities listed on: http://emojisymbols.com/emojilist.php

Since every OS seems to interpret what emoji should look like, it would possibly be prince-specific emoji. The only available fonts I've found are the one I linked to and the one used by android, which is apache2 licensed (https://android.googlesource.com/platform/frameworks/base/+/HEAD/data/fonts/DroidSansFallback.ttf, I think).
joelmeador
Found another one: https://github.com/MorbZ/OpenSansEmoji

----

Should mention we are considering adding this to DocRaptor by detecting HTML entities in source and then doing a replacement with font fallback, which is prone to error, but better than not having it.
mikeday
These are just character entities, right? They should just work if you have a suitable font available.
joelmeador
You are technically correct. The main issue is that browsers/OSes are cheating right now. If I throw the HTLM below in a file and open it in a browser (on OSX, and I suspect iOS), it will render an emoji cat. Prince will just throw out a: "prince: warning: no glyphs for character U+1F638, fallback to '?'".

Input:
<p style="font-family: Arial">&#x1F638;<p>


Not sure what the right answer is, but certainly it is confusing for users that something that just works in browsers doesn't work in Prince (or wkhtmltopdf for that matter).
mikeday
Presumably because in our default fonts.css we don't mention any emoji fonts. We would need to find a suitable font for each of the major platforms we support (MacOS X, Windows, Linux), or customers can use their own if they have one.
joelmeador
That is also my take on the subject.

OSX (since ~2009) includes "Apple Color Emoji". Windows seems to be "Segoe UI Emoji". Linux (at least Ubuntu 14) doesn't seem to have a built-in one, but the "ttf-ancient-fonts" package includes a font called "Symbola" that inludes emoji.

Hope that is helpful.
bcordo
This thread looks very helpful. I'm currently getting the errors:

prince: warning: no glyphs for character U+1F618, fallback to '?'
prince: warning: no glyphs for character U+1F609, fallback to '?'
prince: warning: no glyphs for character U+1F61A, fallback to '?'
prince: warning: no glyphs for character U+1F48B, fallback to '?'
prince: warning: no glyphs for character U+1F605, fallback to '?'

I'm on mac, and those are emoji icons. Not sure I'm following how to get this to work. Thanks so much for your help.

Best Regards.
mikeday
If you specify "font-family: Apple Color Emoji" does the situation improve?

(That may not be sufficient, as Prince doesn't have special support for color fonts yet).
bcordo
@mikeday Thanks so much for the response! Really appreciate it.

That worked removing the errors, but the emoticons just show up blank now. Hmmm.

I added these to font.css

```
/* add in emoji */
@font-face {
font-family: serif;
src: prince-lookup("Apple Color Emoji")
}

@font-face {
font-family: sans-serif;
src: prince-lookup("Apple Color Emoji")
}

@font-face {
font-family: monospace;
src: prince-lookup("Apple Color Emoji")
}
```

Any ideas why?

Edited by bcordo

mikeday
That means the font does have entries in the charmap for the emoji characters, but it may not have regular monochrome glyphs for them, and Prince doesn't support color fonts yet. To get full color emojis may require using some JavaScript to replace them with little images or something like that, until we can support emoji fonts.
bcordo
Okay makes sense. Thanks for the super quick responses. I'll try that out now.
bcordo
For future people reading this thread. I used:

http://hassankhan.me/emojify.js/

To convert the emojis to images. It works flawlessly. Thanks for all the help.
mikeday
Great, glad to hear it worked out! :D
jerkob
In case others are looking for emoji solutions, I was able to use EmojiOne's "SVG in OT" font to get monochrome emoji working. I wrote up the details in a response on this thread: https://www.princexml.com/forum/topic/3372/no-glyph-for-sparkling-heart
leandroac
I saw that several years passed. Any news on that? Does PrinceXML already support emojis?
mikeday
Not color emoji fonts, no. Although we are moving closer now that we support SVG reuse, which is a prerequisite to supporting emoji efficiently. :D
apritchardEB
For anyone who needs a new place to get emoji images: https://unicode.org/emoji/charts/full-emoji-list.html

Full emoji list from all major platforms. Seems up-to-date.

Best regards,
Alex
DocRaptor Support