[fpc-pascal] freetype unit + unicode

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Oct 4 10:23:42 CEST 2011

On Tue, 4 Oct 2011, David Emerson wrote:

>>> What freetype API function are you calling? Not sure if it applies to
>>> freetype, but with Xft (as implemented and used in fpGUI), there are
>>> various versions of the same API. You need to call the correct one based
>>> on the encoding type of you text.
>> freetype.GetStringGray
>> I've tried tweaking all kinds of things but the sad truth is that I am really
>> pathetic at figuring out libraries when no documentation is given, and I sure
>> can't find any documentation.
>> I see that the fpgui helloworld program handles unicode nicely. I guess I'll
>> try and imitate whatever's happening there.
> Easier said than done... the reason I've been using freetype.GetStringGray
> (oops, excuse me -- freetype.TFontManager.GetStringGray) is that it returns
> TStringBitmaps, which I can use within my framework. It looks like the behavior
> of XftDrawStringUtf8 is to draw something on the screen, whereas I need to
> access the individual character glyphs and do the drawing later. hum.
> Is there some secret, hidden documentation for fpc's freetype unit? (and so many
> other units?) :P


But you are in luck: this is open source, and the Lazarus IDE lets you jump
and look around in the FPC code very easily :-)

If you need some UTF8 extensions to the freetype unit, feel free to make
some suggestions, and we'll see what we can do.

When the unit was made, unicode support was a thing of the distant future.
(a future which of course crept up on us faster than we imagined)


More information about the fpc-pascal mailing list