Unicode: Mess with characters and fonts.

Can you see this symbol? ๐Ÿ”Š Nice, this means you have a good set of fonts and a good browser. Mostly easy so view a good part of the Unicode Character Set. But when it comes to support these in your own programs it can be a hassle to render these.

The FreeType library supports rending basically every character but still, it can be quite complicated if you’re not into the encoding of strings. First you’ll want to set the charset FreeType should use if it isn’t already specified in the font file by using FT_Select_Charmap(face, FT_ENCODING_UNICODE). You can also get some information about the charset tables in your font or set the one you want to use.

FreeType supports quite a bunch of charsets (I’m not sure why FreeType calls it’s charsets encodings, as encodings are something very different):

Charset
FT_ENCODING_NONE
FT_ENCODING_UNICODE
FT_ENCODING_MS_SYMBOL
FT_ENCODING_ADOBE_LATIN_1
FT_ENCODING_OLD_LATIN_2
FT_ENCODING_SJIS
FT_ENCODING_GB2312
FT_ENCODING_BIG5
FT_ENCODING_WANSUNG
FT_ENCODING_JOHAB
FT_ENCODING_ADOBE_STANDARD
FT_ENCODING_ADOBE_EXPERT
FT_ENCODING_ADOBE_CUSTOM
FT_ENCODING_APPLE_ROMAN

FT_ENCODING_UNICODE is probably the one you want to use. Also, if you want won’t be able to include the ๐Ÿ”Š character like this:

1NEW_STRING("๐Ÿ”Š");

or:

1NEW_WSTRING(L"๐Ÿ”Š");

You’ll have to do something like this to be sure that it works on every system:

1unsigned long speaker = 0x1F50A;
2NEW_LONG_STRING(&speaker);

Now let’s find a font which supports the following characters: ๐Ÿ”Š (0x1F50A), โ˜ (0x2601) and โฐ (0x23F0)

Symbola

The only font which supports all three characters I’ve found.

Google Noto

Awesome font by Google. Supported โ˜ and โฐ. But didn’t support ๐Ÿ”Š. Probably because it’s beyond 0xFFFF.

Arial Unicode

Should have been working, but didn’t.

Do you have questions? Send an email to max@maxammann.org