I’m trying to figure out how to render an emoji with juce::Graphics. Basically if I have a valid UTF8 emoji character can I draw it in Juce? I"m on macOS but want something that works all three platforms.
I read various posts here about text layout and the like, but even an explicit attempt to draw with the apple emoji font doesn’t show me anything. Here’s the code I tried:
std::string bee = u8"\U0001F41D"; auto showThis = bee; auto ace = juce::Font( "Apple Color Emoji", 9, 0); std::cout << bee << " " << ace.toString() << std::endl; #if 0 auto atts = juce::AttributedString(juce::CharPointer_UTF8(bee.c_str())); atts.setFont(ace); auto txtl = juce::TextLayout(); txtl.createLayout(atts, getLocalBounds().getWidth()); txtl.draw(g, getLocalBounds().toFloat()); #endif g.setFont(ace); g.drawText(juce::CharPointer_UTF8(label.c_str()), getLocalBounds(), juce::Justification::centred);
In my terminal I see “ Apple Color Emoji; 9.0 Regular” so the UTF-8 is correct but the glyph resolution doesn’t work and, it seems, even calling the explicit emoji font (so there’s no fallback needed) doesn’t render.
There must be a way to do this. I’m porting off of VSTGUI and our users have patches with emojis and non-english characters in them all over the place so my use case isn’t just ‘draw a bee’. But I’m a bit stumped on how to proceed.
Any thoughts welcome (even if you have ode that does it win or lin i can follow from). Thank you.