[squeak-dev] Cuis font sizes

Juan Vuletich juan at jvuletich.org
Sat Aug 29 15:18:18 UTC 2009


Hi Andreas,

Andreas Raab wrote:
> 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 BitmapDejaVu 12 has the glyphs rendered by FreeType when requested 
for 12 pt. In those glyphs, the H (for example) is 12 pixels high. Max 
ascent for uppercase letters with Latin umlauts is 15 pixels. Max 
descent in those glyphs is 4. Therefore instances of BitmapDejaVu 12 
StrikeFont answer 15 to #ascent, 4 to #descent and 19 (15+4) to #height.

I never found a clear specification of the meaning of  '12 point', and 
I'm totally for making the fonts behave properly. So, the first question 
is: Are the glyphs correct? I mean, are the glyphs for DejaVu 12 
rendered by Squeak TTF and Freetype the same size? If so, how does 
Squeak TTF fit glyphs that might need up to 19 pixels (15+4) in 16? I 
suspect that FreeType and Squeak TTF don't agree on the meaning of point 
size, but I don't have time right now for checking.

I'll have time for this on Monday. I guess the first thing to do is to 
understand what is the correct font for '12 point'. I mean, the correct 
ascent/descent and line grid, and the correct shape of the glyphs. Some 
specification of mean kerning / length of strings would be nice too. 
I'll read the link you sent. I want to understand and get this right!

>
> 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.

BTW, when mixing TTF and StrikeFonts there might be differences in line 
spacing and kerning, besides mating the baseline, ascent and descent. 
These might be visible... and perhaps need fixing to to make it look nice.

Finally, any reason not to use FreeType? It looks like a good 
alternative for Unicode.

>
> Any insights appreciated!
>
> Cheers,
>   - Andreas
>
> [1] http://www.emdpi.com/emsquare.html

Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list