If they are regular images, just use loadImage(), then image().
If they are defined in a font, use createFont() with the name of the font (works only if the font is installed in the computer running the sketch, or if the TTF file is in the data folder of the sketch), then use text() after setting up the font.
I had implemented your suggestion before, but without any luck (Emoji is Unicode, so I figured id try two approaches; referencing it from source path / adding to data folder). No luck, just a blank output.
PFont myFont;
void setup() {
size(200, 200);
//background(255);
// Uncomment the following two lines to see the available fonts
//String[] fontList = PFont.list();
//println(fontList);
// fill(0);
myFont = createFont("Apple Color Emoji.ttf", 24);
textFont(myFont);
textAlign(CENTER, CENTER);
text("
Do you have a file named "Apple Color Emoji.ttf" in the data folder of your sketch?
I have. I had also printed out the String of fonts available. the Emoji font is listed as "AppleColorEmoji" which I had adjusted (Also deleted the .ttf file from the data folder since the font appeared in the string list)
I also referenced this chart to convert to unicode characters:
I also ensured that the size font was what was available to the emoji font list.
Here is my revision, but without anything displayed in the window:
PFont myFont;
void setup() {
size(200, 200);
//background(255);
// Uncomment the following two lines to see the available fonts
String[] fontList = PFont.list();
println(fontList);
// fill(0);
myFont = createFont("AppleColorEmoji", 24);
textFont(myFont);
textAlign(CENTER, CENTER);
text("",width/2, height/2); // I pasted the character between string quotes
// text("U+1F30D",width/2, height/2);
}
Answers
If they are regular images, just use loadImage(), then image().
If they are defined in a font, use createFont() with the name of the font (works only if the font is installed in the computer running the sketch, or if the TTF file is in the data folder of the sketch), then use text() after setting up the font.
Hey PhiLho,
I had implemented your suggestion before, but without any luck (Emoji is Unicode, so I figured id try two approaches; referencing it from source path / adding to data folder). No luck, just a blank output.
Ah, I missed the Unicode part from your subject (I search info in the body of messages, in general...).
Do you have a file named "Apple Color Emoji.ttf" in the data folder of your sketch?
If that's the name displayed in the PFont.list(), it probably doesn't have a
.ttf
extension, so you should try and remove this part from your code.oops, the "text" portion i posted but was cut off was an inserted character emoji.
Hey PhiLho,
a few things:
I have. I had also printed out the String of fonts available. the Emoji font is listed as "AppleColorEmoji" which I had adjusted (Also deleted the .ttf file from the data folder since the font appeared in the string list)
I also referenced this chart to convert to unicode characters:
apps.timwhitlock.info/emoji/tables/unicode
I also ensured that the size font was what was available to the emoji font list.
Here is my revision, but without anything displayed in the window:
Also to verify, the web/wingding emoji's work, but Apples Color Emoji still giving me grief.
When you see U+1F601, try something like:
Ah, but actually, only four hexa digits are allowed after \u!
See http://docs.oracle.com/javase/tutorial/i18n/text/unicode.html
Perhaps you can try:
[EDIT] Tested with a char (Chinese) I have on my system, you need to convert to string: