freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use "autofitter" with TTF


From: Werner LEMBERG
Subject: Re: How to use "autofitter" with TTF
Date: Wed, 28 Jun 2023 06:16:15 +0000 (UTC)

>> What exactly do you want to achieve?  If FreeType gets linked with
>> HarfBuzz (which you should always do), the `glyph-to-script-map`
>> property should be correctly set automatically – for SFNT-based
>> font formats, that is, which is both used by TTFs and CFFs.
>> However, you won't find any other font formats today that can be
>> universally used on all platforms.
>
> I want pygame->freetype->render_to() interface to render devnagari
> text with autofitting.  That is not happening currently, and I am
> traversing the entire stack to get it done properly.  I am not sure
> where the gap is?  If you can give me any example code in the
> freetype code base which details the usage of "autofitter", that
> would be great.

If you have Devanagari text as input and you want correctly rendered
Devanagari as output, using FreeType directly is a bad idea.  I
strongly suggest that you use a higher-level library, at least
HarfBuzz, or probably even one more level higher, that is, Pango or
ICU.  I'm not sure whether you are aware of the intricate technical
problems related to the rendering of complex scripts like Devanagari
and frieds, but handling them directly by yourself is like reinventing
the wheel.

Irrespective of that, you should give more details on your setup, in
particular, which font you are using.  Normally, if you load a glyph
with the `FT_LOAD_FORCE_AUTOHINT` flag set, the auto-hinter kicks in
while `FT_Load_Glyph` is called the first time.  It uses HarfBuzz to
set up the glyph-to-script mapping, then checking whether the
necessary glyphs for the blue strings are available (see file
`afblue.dat`) so that the blue zones are correctly set up.

Maybe you are just missing `FT_LOAD_FORCE_AUTOHINT`?  You could also
compile FreeType with debugging support and set the `FT2_DEBUG`
environment variable to get more information.  See file `docs/DEBUG`
for more information.


   Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]