Cairo vs Widget Fonts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Cairo vs Widget Fonts

Maarten Mostert-2
Hi,
I would like to create precise matching Cairo text against Widget Text but don’t really manage that as shown in the image.
In this case the red text is Cairo and the black text is the LabelWidget system text.


In this case both supposed to be Helvetica fonds, but zooming in shows differences (notable the ‘C’).

This is could be normal in part as the Cairo font is created with:

=========
aCR
selectFontFace: Screen default defaultFontPolicy defaultFont
fontDescription family
slant: FontSlant normal
weight: FontWeight bold.

aCR fontSize: 11.3.

=========

Where the widget font does not completely follow this description.
as 
Screen default defaultFontPolicy defaultFont fontDescription boldness => 0.7
Screen default defaultFontPolicy defaultFont fontDescription pixelSize => 12
The Cairo toy interface only provides boldness values between 0 and 1 (FontWeight bold => 1) and it does not accept intermediate values.

So it is normal that the font not really matches.

According to the documentation Cairo seems to have other ways to match precise fonts, so I was wondering if anyone has experience with that.

Regards,

@+Maarten,



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Cairo vs Widget Fonts

Michael Lucas-Smith-2
It's probably the kerning that is different. CairoGraphics doesn't include the ability to modify the kerning parameter and the VM specifies a specific kerning on OS X - I don't know what the defaults are for the other operating systems. I'm not sure how you'd go about getting them the same.

Cheers,
Michael


On 22 August 2014 20:08, Maarten Mostert <[hidden email]> wrote:
Hi,
I would like to create precise matching Cairo text against Widget Text but don’t really manage that as shown in the image.
In this case the red text is Cairo and the black text is the LabelWidget system text.


In this case both supposed to be Helvetica fonds, but zooming in shows differences (notable the ‘C’).

This is could be normal in part as the Cairo font is created with:

=========
aCR
selectFontFace: Screen default defaultFontPolicy defaultFont
fontDescription family
slant: FontSlant normal
weight: FontWeight bold.

aCR fontSize: 11.3.

=========

Where the widget font does not completely follow this description.
as 
Screen default defaultFontPolicy defaultFont fontDescription boldness => 0.7
Screen default defaultFontPolicy defaultFont fontDescription pixelSize => 12
The Cairo toy interface only provides boldness values between 0 and 1 (FontWeight bold => 1) and it does not accept intermediate values.

So it is normal that the font not really matches.

According to the documentation Cairo seems to have other ways to match precise fonts, so I was wondering if anyone has experience with that.

Regards,

@+Maarten,



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Cairo vs Widget Fonts

Antony Blakey-5
It's not the kerning. The shape of the characters are fundamentally different. Either you are getting a different font, or the hinting is making some radical changes to the shapes - I suspect the former.

Every character looks very different to me in a consistent fashion.

I don't think it's the weight - normally more weight would force simplification of the line (if anything), which is the reverse of what you are seeing.

I've modified the font lookup machinery in 8.0 to access the normally hidden OSX UI fonts. You might want to look at that code, and maybe do some similar (Objective-C Runtime/Win32/X11) work to ensure you have the correct match according to the OS. The political term for the VW font machinery is: "not very nice" :) It's on our list.

On the other hand, Cairo text really is a toy. We've investigated proper text support (which is coming in VW) and it requires going to native facilities to get glyph geometry and then using that with Cairo. Before that you need to handle ligatures, combining characters etc (and hence layout) to get from characters to glyphs. It's interesting, albeit messy work, and it is the natural extension of Text2 into our new graphics substrate.

On 22 Aug 2014, at 19:59, Michael Lucas-Smith <[hidden email]> wrote:

> It's probably the kerning that is different. CairoGraphics doesn't include the ability to modify the kerning parameter and the VM specifies a specific kerning on OS X - I don't know what the defaults are for the other operating systems. I'm not sure how you'd go about getting them the same.
>
> Cheers,
> Michael
>
>
> On 22 August 2014 20:08, Maarten Mostert <[hidden email]> wrote:
> Hi,
> I would like to create precise matching Cairo text against Widget Text but don’t really manage that as shown in the image.
> In this case the red text is Cairo and the black text is the LabelWidget system text.
>
> https://www.dropbox.com/s/xijogdlv1knzw7p/cairoVSWidgetText.png
>
> In this case both supposed to be Helvetica fonds, but zooming in shows differences (notable the ‘C’).
>
> This is could be normal in part as the Cairo font is created with:
>
> =========
> aCR
> selectFontFace: Screen default defaultFontPolicy defaultFont
> fontDescription family
> slant: FontSlant normal
> weight: FontWeight bold.
>
> aCR fontSize: 11.3.
>
> =========
>
> Where the widget font does not completely follow this description.
> as
>
> Screen default defaultFontPolicy defaultFont fontDescription boldness => 0.7
> Screen default defaultFontPolicy defaultFont fontDescription pixelSize => 12
>
> The Cairo toy interface only provides boldness values between 0 and 1 (FontWeight bold => 1) and it does not accept intermediate values.
>
> So it is normal that the font not really matches.
>
> According to the documentation Cairo seems to have other ways to match precise fonts, so I was wondering if anyone has experience with that.
>
> Regards,
>
> @+Maarten,
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Antony Blakey
--------------------------
Ph: +61 438 840 787

The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honours the servant and has forgotten the gift.
  -- Albert Einstein




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Cairo vs Widget Fonts

Antony Blakey-5
In reply to this post by Maarten Mostert-2

On 22 Aug 2014, at 19:38, Maarten Mostert <[hidden email]> wrote:

> Hi,
> I would like to create precise matching Cairo text against Widget Text but don’t really manage that as shown in the image.
> In this case the red text is Cairo and the black text is the LabelWidget system text.
>
> https://www.dropbox.com/s/xijogdlv1knzw7p/cairoVSWidgetText.png
>
> In this case both supposed to be Helvetica fonds, but zooming in shows differences (notable the ‘C’).

Did you change it to be Helvetica? Widget font would normally be Lucida Grande on OSX (< 10.10) and Tahoma (XP) or SegoeUI (> XP) on Windows.

>
> This is could be normal in part as the Cairo font is created with:
>
> =========
> aCR
> selectFontFace: Screen default defaultFontPolicy defaultFont
> fontDescription family
> slant: FontSlant normal
> weight: FontWeight bold.
>
> aCR fontSize: 11.3.
>
> =========
>
> Where the widget font does not completely follow this description.
> as
>
> Screen default defaultFontPolicy defaultFont fontDescription boldness => 0.7
> Screen default defaultFontPolicy defaultFont fontDescription pixelSize => 12
>
> The Cairo toy interface only provides boldness values between 0 and 1 (FontWeight bold => 1) and it does not accept intermediate values.
>
> So it is normal that the font not really matches.
>
> According to the documentation Cairo seems to have other ways to match precise fonts, so I was wondering if anyone has experience with that.
>
> Regards,
>
> @+Maarten,
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Antony Blakey
--------------------------
Ph: +61 438 840 787

When I hear somebody sigh, 'Life is hard,' I am always tempted to ask, 'Compared to what?'
  -- Sydney Harris




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Cairo vs Widget Fonts

Antony Blakey-5

On 22 Aug 2014, at 22:56, Antony Blakey <[hidden email]> wrote:

>
> On 22 Aug 2014, at 19:38, Maarten Mostert <[hidden email]> wrote:
>
>> Hi,
>> I would like to create precise matching Cairo text against Widget Text but don’t really manage that as shown in the image.
>> In this case the red text is Cairo and the black text is the LabelWidget system text.
>>
>> https://www.dropbox.com/s/xijogdlv1knzw7p/cairoVSWidgetText.png
>>
>> In this case both supposed to be Helvetica fonds, but zooming in shows differences (notable the ‘C’).
>
> Did you change it to be Helvetica? Widget font would normally be Lucida Grande on OSX (< 10.10) and Tahoma (XP) or SegoeUI (> XP) on Windows.

And that's your problem ...

Nothing uses

    Screen default defaultFontPolicy defaultFont

The widget font is

    NativeGUIPolicy current fontDescriptionForWidgetOfSize: #small

or

    NativeGUIPolicy current textAttributesForWidgetOfSize: #small

which simply uses the former. I'm partway through redoing fonts. I've done what is required for UISkinning, but not revisited old apis.

Antony Blakey
--------------------------
Ph: +61 438 840 787

To remain silent and indifferent is the greatest sin of all.
 -- Elie Wiesel





_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc