I am having problems with DrawText when using UTF8 encoded text. The problem mostly happens with emojis such as which corresponds to "\xF0\x9F\x98\x81"
void CFrm::OnPaint(wxPaintEvent& evt)
{
wxAutoBufferedPaintDC pdc(this);
pdc.Clear();
if (m_Antialiasing)
{
wxGCDC gcdc(pdc); //works only with some fonts
Draw(&gcdc);
}
else
{
Draw(&pdc); //works all the time
}
}
Elsewhere to draw the text I use dc->DrawText(wxString::FromUTF8(Label), TextLoc); where the variable Label is a std::string. If wxGCDC is not used the emojis are shown correctly. I also experimented with a few non-English words (Turkish, Chinese ...) and they seemed to work correctly; however emojis are shown as squares. On the other hand things work when the following fonts are selected:
- Segoe UI Emoji
- Segoe UI Symbol
- DejaVu Sans
- EmojiOne Color
Any ideas appreciated (Platform Windows 11, wxWidgets 3.2, Visual Studio 2022)