We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello I try to render coloured emojis using this line here:
String emoji = new String(Character.toChars(unhex("1F32F")));
text(emoji, width/2, height/2);
Code is fine, to show this I have this example using that line:
Only answer I possibly find is this: https://www.mail-archive.com/i18n-dev@openjdk.java.net/msg01334.html Which doesn't help.
This question has been asked before, here: http://forum.processing.org/two/discussion/896 without an useful answer.
Is it Java that is the problem?
Any help greatly appreciated! Hampus
Answers
did you try PhiLhos last answer
https://forum.processing.org/two/discussion/896
use a hex value
@Chrisir: unhex() converts a hex String to an int so he is basically using a hex value (with some unnecessary overhead of course).
@hampus: The TTF file format specification does not define tables/data blocks for multicolored glyphs. The colored emoticons in Apple's Apple Color Emoji font are actually just a bunch of PNG files in a custom data block of the TTF. It's a proprietary file format extension that is not very well supported. If I remember correctly Java's standard Font libraries don't support this extension and I'm pretty sure Processing is relying on those to create the glyph images.
So yeah, this is kind of a "Java problem", although you can't really blame them for not supporting such proprietary extensions.
I'm relatively new to processing (I've downloaded 3.0.1 on my Mac). I have been trying to use emojis in a sketch and I think the issue is a lack of support for unicode characters not on the Basic Multilingual Plane. From what I understand, Java uses UTF-16 for characters in strings. From the Java String documentation I found (http://docs.oracle.com/javase/7/docs/api/index.html?java/lang/String.html):
Everything in the BMP uses 1 position in a String. It seems to me that the problem is that supplementary characters (surrogate pairs) are not correctly identified. The "Cookie" emoji has the code point 1F36A, which is represented in UTF-16 Hex as D83C, DF6A (http://www.fileformat.info/info/unicode/char/1f36a/index.htm)
Here is the sketch that I've written:
Have I missed something?