freetype-devel
[Top][All Lists]

## RE: [Devel] pixel size, hinting and scaling

 From: Graham Asher Subject: RE: [Devel] pixel size, hinting and scaling Date: Fri, 17 Jan 2003 10:17:34 -0000

```David,

thanks for your interesting explanation of the transformations used by
FreeType, which mostly confirms what I thought. I was right, I think, in
saying that there was a defect, or perhaps what I could more kindly describe
as a small design flaw.

You say that the correct thing to do is use FT_Set_Pixel_Sizes to do all the
scaling, and FT_Set_Transform to do shearing and rotation, but no scaling.
This is what I'd already figured out. The design flaw is that
FT_Set_Transform doesn't enforce the condition that its transformation does
no scaling. It should either do this, or extract the scale factors, combine
them with the current scale, and reset the size by calling
FT_Set_Pixel_Sizes before applying the rotation and shear only. But this is
a minor problem if the facts are all understood: that is, if we know that
the transform should not do any scaling.

What I would really like - in an alternative FreeType in an alternative
universe, or possible in my much-deferred C++ interface to FT, which I
started writing a little while ago - is a *single* function to set the
transformation. This would set both pixel size and other transformations at
once. The identity matrix would give a size of 1 x 1 pixels, so { 12, 0, 0,
12, 0, 0 } would give a 12-pixel font instance. It would be the
responsibility of the driver to determine what components of the
trsnaformation were applicable to hinting.

<<<<<<
decompose your transform into a two distinct ones: a scaling one, and
a shearing / rotating one. Equivalent to finding the matrix's eigenvalues
>>>>>>

I have a way of doing this that is probably inefficient and doesn't use
eigenvalues. I'll look into eigenvalues, which I have heard of but I don't
know what they are. Thanks for the tip.

Best regards,

Graham

```