Hi Andreas,
I think the problem with the size discrepency results from the scaling factor used in TTCFont computeForm:
 
FreeType divides the pixel size by the units per em , but TTCFont divides by (ttcDescription ascender - ttcDescription descender).
 
Try making TTCFont>>computeForm: use the unitsPerEm value instead, it appears to give the correct size glyphs. i.e. ...

computeForm: char
 | ttGlyph scale |
 scale := self pixelSize asFloat /  ttcDescription unitsPerEm.
 Scale ifNotNil: [scale := Scale * scale].
 
etc.
 
This is from the FreeType manual page http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-2.html ...
 
<quote>
In creating the glyph outlines, a type designer uses an imaginary square called the EM square. Typically, the EM square can be thought of as a tablet on which the characters are drawn. The square's size, i.e., the number of grid units on its sides, is very important for two reasons:
</quote>
 
Line spacing is a separate issue; it is there that the ascender, descender, and other vertical metrics become important .
 
Cheers,
Andy

.


 
> Date: Fri, 28 Aug 2009 20:22:19 -0700
> From: andreas.raab@gmx.de
> To: squeak-dev@lists.squeakfoundation.org
> Subject: [squeak-dev] Cuis font sizes
>
> Hi Juan -
>
> This is mostly to Juan but others might be able to help as well. I
> noticed that the Cuis fonts disagree in their pixel sizes significantly
> with that we get from the plain DejaVu true type fonts in Squeak. A bit
> of math reveals that at the (assumed) screen resolution of 96dpi a 12pt
> font should result in 16px high font (12*96/72 see Eqn. 3 in [1]). The
> corresponding Bitmap DejaVu 12pt font, however, is 19px high which would
> mean a screen resolution of 114dpi (19*72/12).
>
> Is this choice intentional? Unfortunately, none of the pixel sizes for
> Bitmap DejaVu correspond exactly to a point size when assuming 96dpi.
>
> The reason this is causing me grief is that I am trying to set up a
> mechanism for allowing people to drop the DejaVu fonts into their images
> and have any glyphs not part of the cuis fonts rendered in DejaVu
> truetype instead. I can probably get the truetype rendering to spit out
> a precise pixel size to match it but I think it'd be good if we had
> clarity on how these pixel sizes came into being.
>
> Any insights appreciated!
>
> Cheers,
> - Andreas
>
> [1] http://www.emdpi.com/emsquare.html
>


View your other email accounts from your Hotmail inbox. Add them now.