[cairo] Text scaling and hinting

Owen Taylor otaylor at redhat.com
Wed May 4 19:41:49 PDT 2005


On Wed, 2005-05-04 at 12:15 -0700, Bill Spitzak wrote:
> I know there is some disagreement, but I still think the font metricies 
> should *only* depend on the font transformation matrix. The CTM has 
> absolutely zero effect. This also means that font metricies are by 
> definition in the current coordinate space.
> 
> This would solve your rotated example as you would only rotate by using 
> the CTM and thus the font metricies would never change.
> 
> The font metricies should be designed to be correct if the CTM is the 
> identity. It is ok if the actual rendering leaks outside the bounding 
> box somewhat if the CTM is rotated, scaled, or translated to a 
> non-integer. Any hinting should be calculated as though 1 unit is a 
> pixel. Any other distortions (ie changing the shape of letters depending 
> on the size) should be calculated as though 1 unit is 1/96 of an inch.
> 
> I have done some work with using FreeType to produce animated lettering 
> and it is absolutely vital to have the no-change-of-metricies effect he 
> is requesting, not just for rotations, but also for scaling. Without 
> this it is impossible to achieve an attractive animation. In our 
> software if you set the font size very small and set the transformation 
> to scale up a lot, you get funky shaped letters, because  you are 
> scaling up the hinting. But this is actually the effect we want.

If you are happy with ugly spacing, then sure, using unhinted
metrics can work. (Especially with a monospace font, what you'll see is
that some sizes have OK spacing, and other sizes have horrible spacing)

It's not the right approach for static text display, however. To
dig out the example I always use, compare Figure 6 in 

 http://people.redhat.com/otaylor/grid-fitting/ 

with Figure 4 or Figure 7.

The relative utility of the 4 elements of the 
 {glyph-hinting, no-glyph-hinting} x {metric-hinting, no-metric-hinting}
matrix is something that can be debated at some length. if you really
want good animation however, then you want no-glyph-hinting, no-metric-
hinting *and* subpixel glyph positioning. Without the last, you'll see
substantial jitter of individual characters as you animate.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050504/6b73c14f/attachment.pgp


More information about the cairo mailing list