Re: Aw: Re: Re: Re: Re: Re: Native TTF name sometimes contains crap
Werner LEMBERG <[email protected]> Mon, 06 Sep 2021 15:02:09 +0000 (UTC)
| Newsgroups | gmane.comp.fonts.freetype.user |
|---|---|
| Message-ID | <[email protected]> |
>> This explains a lot, thanks. Your version of the `ftdump` program
>> is too old
>
> It is the version that comes with Ubuntu 18.04 LTS which is still
> supported...
You should complain to Ubuntu, then :-)
>> it has been fixed a long time ago to no longer mangle the high byte
>> of UTF-16 characters. Below you can see the output I get if I call
>> `ftdump -n -u simhei.ttf`
>
> This version of ftdump correctly returns the name "黑体" of the
> font. Which brings me back to my original question: what do I have
> to do to get this name too when using the API?
You have to convert the UTF-16 output to UTF-8. Please look into the
source code of `ftdump`.
https://gitlab.freedesktop.org/freetype/freetype-demos/-/blob/master/src/ftdump.c
For the API I strongly suggest to use a current version of FreeType,
just to be sure. I no longer can remember whether there were bugs
w.r.t. Unicode handling.
Werner