Getting TextEditor to display UFT8 characters

I want to be able to insert UFT8 characters into a TextEditor, but I don’t know very much about unicode. I’m trying this:


but it only displays the blank box of an unrecognized character.

Any suggestions?

Are you 100% sure that the font you’re using supports said character?
If it does then obviously something else is at play, but pretty much sounds like the font doesn’t have that character, hence you get a placeholder.

I’m not at all sure whether the font I’m using supports these characters, and I’m also not sure how to check. I’m using Font(Font::getDefaultMonospacedFontName()) to define the Font, but I’m not even sure which font this corresponds to.

Maybe I’ll widen the question a bit. I want to display some simple arrows, up / down / left / right, in a text editor. I don’t really care what the look like, but unfortunately the standard <> ^ characters won’t work, because there is no corresponding down arrow. I don’t see anything in the ASCII or extended ASCII tables, so I was thinking that Unicode would be the way to go. What is the path of least resistance?

Probably, you should find a font on your system that displays the symbols that you want, save its TTF file, distribute that together with your app/plugin and load your font for the TextEditor from that file, so that you’re always sure that the font used has the characters you want.

IIRC it’s also possible to embed the content of the TTF file in code, and load it from there, that saves you the need to distribute it as a separate file

1 Like