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

Igor Stasenko siguctua at gmail.com
Fri Apr 4 07:44:49 EDT 2014


On 4 April 2014 11:17, J.F. Rick <self at je77.com> wrote:

> Woohoo! Works for me. You made my day.
>
> yeah.. i am happy i figured it out finally :)
i now making some cleanup and lill optimizations before committing the
update.


> In regards to determining the DPI of the display, can't we just set that
> as a preference with a default value of 96? That would satisfy 98% of
> cases.
>

it is already like that..
see
TextStyle class>>#pixelsPerInch / #pixelsPerInch:



> We could also add a primitive that would allow the VM to have its say
> (e.g., retina display on MacOS). When that primitive fails, it would
> default to the preference.
>
> sure.. one day we may add it.
but in fact, who cares? if you think in terms of vectors, knowing screen
DPI is something you largely don't need.. because DPI is thinking in terms
of pixels :)
As soon as you give user a way to zoom things in/out to make things
convenient to him, it will no longer matter what is the absolute values
like font sizes in UI design,
the only thing what will matter is relative sizes between UI elements
(like: here i want 2 times bigger font than here etc)

Cheers,
>
> Jeff
>
>
> On Fri, Apr 4, 2014 at 2:55 AM, Igor Stasenko <siguctua at gmail.com> wrote:
>
>> 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.
>>
>
>
>
> --
> Jochen "Jeff" Rick, Ph.D.
> http://www.je77.com/
> Skype ID: jochenrick
>



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


More information about the Pharo-dev mailing list