[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] losing outline flags while auto-hinting
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] losing outline flags while auto-hinting |
Date: |
Thu, 16 Feb 2012 08:07:24 +0100 (CET) |
Alexei,
thanks for this small demo program!
Your problem exposes various issues.
> $ ./outflags LiberationSerif-Regular.ttf 0x2
> Liberation Serif Regular loaded...
> Loading Flags: 0x2
> Outline Flags: 0x100
> $ ./outflags LiberationSerif-Regular.ttf 0x20
> Liberation Serif Regular loaded...
> Loading Flags: 0x20
> Outline Flags: 0 <<<<<< LOST IT
Here, the flag 0x100 (FT_OUTLINE_HIGH_PRECISION) is set in line 2103
of ttgload.c, but only if FT_LOAD_NO_SCALE is not set. The
autohinter, however, does set FT_LOAD_NO_SCALE since it applies its
own hinting. Maybe the test for FT_LOAD_NO_SCALE should be removed.
If you do so, however, you are still bitten by the other problem:
> $ ./outflags /usr/share/fonts/default/Type1/n019003l.pfb 0x2
> Nimbus Sans L Regular loaded...
> Loading Flags: 0x2
> Outline Flags: 0x104
>
> $ ./outflags /usr/share/fonts/default/Type1/n019003l.pfb 0x20
> Nimbus Sans L Regular loaded...
> Loading Flags: 0x20
> Outline Flags: 0 <<<<<<< LOST IT
This is a bug. Reason is that the autohinter doesn't preserve this
flag while copying around the outlines (in function af_loader_load_g).
There are two possibilities to fix this. One of them is to extend
FT_GlyphLoader_Add and friends (in ftgloadr.c) to carry the `flags'
field also. Another one is to store the `flags' field in
af_loader_load_g after a (sub)glyph has been loaded, and set it again
right before leaving the function.
Given that the outline flags value is (more or less) a property of the
whole glyph and not of its subglyphs, I tend to the second solution.
Werner