Bug in emojis display when using g4p (or using 'createFont', 'textFont')


I have a problem in emojis display read from txt/UTF-8 csv.
When styling a text using ‘createFont’, ‘textFont’ before drawing it with ‘text()’, emojis appear like an empty square. (no matter what font I tried to use).
If I use text() without styling it first- emojis looks good. (so the file reading isn’t the problem)
So for first step I gave up about styling, but then I noticed using GTextField object (from g4p library) somewhere else in my code cause the same problem (and additionally change my default font - so I guess the problematic styling methods above are being used in g4p code).
This text field I can’t give up (neither the emojis) so my question is:

  1. How can I make g4p “skip” this styling lines? (where is it used?)
    or, preferrably,

  2. How can I make emojies work with ‘createFont’, ‘textFont’ being used in my code? (is there a font that works with emojis? what is the default configuration of text if I dont use this methods and how can I mannualy achieve it when using them? other way to make both emojies and styling work together?)

  3. If none of the above is possible, what other object can function like GtextField without making this problem?


1 Like

Can you clarify what you mean by this? A code snippet would help

1 Like
void setup() {
  size(760, 1396);

  //font = createFont("Arial", fontSize);
  //textFont(font, fontSize);

void draw() {

  lines = loadStrings("C:\\Users\\User\\Desktop\\University\\YearII\\Michael\\project\\test.txt");
  text(lines[0], 10, 10);

this way the output is: (its a little bit small but this symbol is a pumpkin:) )

2020-04-21 08_47_41-sketch_200420a

uncommenting the two lines in setup results empty square insted of the pumpkin symbol.

1 Like

2020-04-21 08_49_39-sketch_200420a

( lines uncommented )

Can you show some simple code that I can run in Processing that demonstrates this?

1 Like

As in my comment to Tony.

As I said a sketch I can run!!!

I don’t have the file you used, can you not create a simple string containing the emoji without needing the file.

Also what is the name of the font you are using in that demo?

When I define the text directly as a string in processing the symbols aren’t recognized, and I don’t know how to make it work,
so text to create a test file is attached: (as I can’t upload a txt file here)

אשמח אם תעלו לתוך התיקייה מצגות, מסמכים או כל חומר אפשרי שיעזור להעברת המפגשים של מדריכים אחרים, זה גם מצב של WINWIN כי ככה את יכולים להעזר ברעיונות של אחרים.
אז יאללה תנו בראש :jack_o_lantern:

Thanks a lot.

Emoji’s are not font characters of so will never be displayed in a program which shows text by rendering font characters.

Emojis are encoded into text strings using mark down so in your previous post the actual text is

אשמח אם תעלו לתוך התיקייה מצגות, מסמכים או כל חומר אפשרי שיעזור להעברת המפגשים של מדריכים אחרים, זה גם מצב של WINWIN כי ככה את יכולים להעזר ברעיונות של אחרים.
אז יאללה תנו בראש :jack_o_lantern:

This forum tries to interpret anything between : and : as an emoji but that is not the case in when using a programming IDE like Processing.

1 Like

I used the word ‘emojis’ just to decribe the symbols- I dont expect the symbols to look like here in the forum just as in the image I attached. Just not to be a square. If any known solution is available that would be really helpfull.

See this previous discussion. Passing emoji strings from files into text() is almost certainly not going to work.

You can attempt to integrate Java emoji solutions, just be aware that they may not work either on Java 8 – check the minimum Java requirements of a solution.


None of this speaks to g4p integration – just the basics of trying to get an emoji character saved in a string to display in Processing.