[Pharo-dev] [Moose-dev] Re: Re: Re: Fwd: Font problem is still there

Igor Stasenko siguctua at gmail.com
Thu Apr 3 20:55:01 EDT 2014


Okay, i think i got it..

Here is what happens:
- the font size is usually specified in points, not x at y points, but
typographical points,
which is
1/72 inch


TextStyle pointsToPixels: 14

TextStyle pointsToPixels: 14 => 18.666666666666668

pointsToPixels: points
    ^points * self pixelsPerInch / 72.0


but in Athens, i , stupid idiot, completely forgot about that,
and use point size directly, to scale up font ..
but the point is that this scaling performed in font units (EMs).

so, to actually scale font correctly, i must use same TextStyle
pointsToPixels: ..
as Freetype package using..

there is one caveat, that if you really want to see exactly , say 16 points
sized font on your screen,
it is not possible without knowing the display resolution - how many pixels
in one inch (hence
#pixelsPerInch ).
Unfortunately, our VMs don't give us a way to determine DPI of display..
and so, it is always 96 :/

pheww....

fromFreetypeFont: aFont cairoFace: face
.....

  -  fontMatrix scaleBy: aFont pointSize.

 +  fontMatrix scaleBy: (TextStyle pointsToPixels: aFont pointSize).

problem solved ... (i hope) :)

-- 
Best regards,
Igor Stasenko.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140404/f6188b75/attachment-0002.html>


More information about the Pharo-dev mailing list