freetype
[Top][All Lists]
Advanced

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

Re: [ft] Suggestion to improve auto hinter


From: Collyer, Oliver, SI
Subject: Re: [ft] Suggestion to improve auto hinter
Date: Wed, 23 Feb 2011 09:46:09 +0000

In case anyone is interested, I've been getting some good results with the following simple/brute-force algorithm.

It's inefficient, but perhaps the results are of use and suggest room for improvement in the auto hinter.

For a given typeface and requested pixel size P:

- pick some sample letters (for example ABCDEFabcdef)
- for each one create an unhinted outline, and measure yMax - yMin for the bbox.
- create hinted outlines at sizes of between minus half a pixel and plus half a pixel of P (we have 1/64th pixel resolution so the most extreme version of this would create 64 outlines per letter) and measure yMax - yMin for each bbox
- pick the outline variant whose cumulative/average height (of all the sample characters) is closest to that of the unhinted outline
- cache the height adjustment used for the best case and use this subsequently when drawing with this font in this size

Since the effect is most useful at lower font sizes, I skip all this for pixel sizes > 30 so its only very inefficient rather than horrendously inefficient  :P

I find with the above in place, my font sizes in general Chrome browsing on Windows more closely resemble those when browsing on Mac in certain cases, but more to the point are closer to the unhinted/accurate size and thus more like what the web page designer intended.

I've attached an example; observe how by default the main body of text appears squashed in FreeType.

FreeType default


FreeType with height adjustment


Core Text default


On 22 Feb 2011, at 13:04, JustFillBug wrote:

On 2011-02-19, Werner LEMBERG <address@hidden> wrote:

So my suggestion is could FreeType's auto hinter do something like
this itself - e.g. if when working out all that clever latin blue
zone stuff, could it realise that actually it's making the font
smaller and a better result could be obtained by increasing the
requested pixel height and hinting at that height instead?  Or make
the hinter round up to the next line rather than round down, on the
basis that rounding up is likely to result in more readable text?

This is probably dependent on the font.  For example, I've just run
ftdiff on pala.ttf, and the autohint's vertical size of glyphs is
basically always the same as with the unhinted glyphs.  Do you have
this `problem' all the time, regardless of the selected font?


aflatin2.c take account the 'drift' accumulated over edge alignment.
I guess the bluezone scaling could use the 'drift' too in order to
minimize the problem, in af_latin2_metrics_scale_dim().


_______________________________________________
Freetype mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype


reply via email to

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