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

**URL:** <https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969>\
**Category:** Libraries\
**Created:** [April 20, 2020, 5:50pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969 "2020-04-20T17:50:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 20, 2020, 5:50pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/1 "2020-04-20T17:50:35Z")

</div>

Hello,

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?

Thanks,  
Amit

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [April 21, 2020, 1:42am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/2 "2020-04-21T01:42:18Z")

</div>

> [@amit.ilan](#):
>
> 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).

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

---

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 21, 2020, 6:48am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/3 "2020-04-21T06:48:06Z")

</div>

```auto
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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/368570eca9f91446c3b3189b94acb1017746bc0d.png)

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

---

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 21, 2020, 6:49am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/4 "2020-04-21T06:49:10Z")

</div>

![2020-04-21 08_49_39-sketch_200420a](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c743a84afbe1adccd417c8217632246f5068fc36.png)

( lines uncommented )

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 21, 2020, 7:37am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/5 "2020-04-21T07:37:12Z")

</div>

> [@amit.ilan](#):
>
> If I use text() without styling it first- emojis looks good.

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

---

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 21, 2020, 8:08am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/6 "2020-04-21T08:08:23Z")

</div>

As in my comment to Tony.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 21, 2020, 8:21am UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/7 "2020-04-21T08:21:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 21, 2020, 4:36pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/8 "2020-04-21T16:36:59Z")

</div>

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 כי ככה את יכולים להעזר ברעיונות של אחרים.  
אז יאללה תנו בראש 🎃

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 21, 2020, 5:10pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/9 "2020-04-21T17:10:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amit.ilan](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amit.ilan](https://discourse.processing.org/u/amit.ilan)\
**Post date:** [April 27, 2020, 6:42pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/10 "2020-04-27T18:42:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 3, 2020, 7:43pm UTC](https://discourse.processing.org/t/bug-in-emojis-display-when-using-g4p-or-using-createfont-textfont/19969/11 "2020-05-03T19:43:28Z")

</div>

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

> [@Using Emoji's on OSX](https://discourse.processing.org/t/using-emojis-on-osx/10349/4):
>
> So, according to this, there are four different recent standards that allow color emoji in font files – I suspect that none existed when Processing font support was developed. SVG-in-Opentype COLR/CPAL SBIX CBDT/CBLC If you could get the svg from opentype then you could get the color image – assuming the svg could be read by PShape. But you might still need to handle text size and kerning / leading. Possible that emoji4j could help with that? Haven’t looked at it, but it seems like an…

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.

> **[GitHub - vdurmont/emoji-java: The missing emoji library for Java :heart:](https://github.com/vdurmont/emoji-java)**
>
> The missing emoji library for Java :heart:. Contribute to vdurmont/emoji-java development by creating an account on GitHub.

[https://developers.redhat.com/blog/2019/08/16/manipulating-emojis-in-java-or-what-is-🐻-1/](https://developers.redhat.com/blog/2019/08/16/manipulating-emojis-in-java-or-what-is-%F0%9F%90%BB-1/)

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.
