freetype-devel
[Top][All Lists]
Advanced

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

[Devel] autohinter extension for manual hinting


From: David Chester
Subject: [Devel] autohinter extension for manual hinting
Date: Mon, 5 May 2003 15:36:33 +0200
User-agent: KMail/1.5.1

Hello,

I am starting to work on an extension to the autohinter that would allow for 
externally-provieded manual hints to override the automatically derived ones. 
There are a few reasons why I think this is a good idea.  

The autohinter currently produces great looking glyphs in isolation, but next  
to each other, some characters seem out of proportion (e.g. an 'a' sometimes  
seems very wide next to a 'u' whose far stem has been rounded down).  In  
addition kerning is much less than perfect, and this has a huge effect on  
legibility.  Also, the patented truetype hints are optimized for monochrome  
display, so grayscale bitmaps produced by the interpreter are not the best  
possible solution either.

It seems that the if following manually determined data is provided, this is  
sufficient to remedy the problems described above.  In my proposed system,  
each size of each face has this associated information:

FT_Fixed x_factor;   /* size-wide x_scale scale  */
FT_Fixed y_factor;   /* size-wide y_scale scale */
FT_Int   kern_pre;   /* size-wide before-the-glyph kerning adjustment */  
FT_Int   kern_post;  /* size-wide after-the-glyph kerning adjustment */

In addition, each glyph optionally has this associated information:

FT_Fixed x_factor;   /* char-wide x_scale scale */
FT_Int   kern_pre;   /* char-wide before-the-glyph kerning adjustment */  
FT_Int   kern_post;  /* char-wide after-the-glyph kerning adjustment */

The autohinter applies the size-wide, then the character-specific scales (if 
present) and adds the kerning adjustments into the formula, when determining 
kerning.

It appears that just by tweaking these values here and there for different  
faces, sizes, characters, very good results can be achieved.  I have some  
alpha code working, and I hinted a few sizes of a few faces by hand (it took  
only about 5 minutes per size).  Here's a page with examples:

http://www.cs.mcgill.ca/~dchest/fta.html

I have a few questions.  First, would something like this be welcome in  
Freetype?  If so, how should it be implemented?

Should scale values actually be the x_scales and y_scales to be used by the  
hinter, or should they be either deltas, or scale factors?  I have them  
working has factors now (e.g. 0.92 for an x_factor would make a glyph  
narrower).  This seems not to be the best idea because the autohinter is a  
fluid piece of code, and with an algorithm change here or there, these values  
may become meaningless.

For a file structure, the way I have it working now is that a CSV (comma  
separated values) file (padded, and so implicitly indexed--access is O(1)),  
holds the values described above for a range of sizes and characters.  At 
what point should data be retrieved from the file, and how many 
sizes/characters at a time?  Into which structures should this data go? By 
what means could files be associated with faces?  Or could this be one huge 
optionally compiled table in Freetype itself?  Etc, etc.

Any input would be welcome and appreciated.

Thanks, 
David Chester




reply via email to

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