[cairo] Cairo, pango and Win32.. incorrect font rendering

Behdad Esfahbod behdad at behdad.org
Mon Jan 18 13:01:50 PST 2010


On 01/18/2010 03:59 PM, Peter Clifton wrote:
> On Mon, 2010-01-18 at 15:54 -0500, Behdad Esfahbod wrote:
>> On 01/18/2010 03:51 PM, Peter Clifton wrote:
>>> On Mon, 2010-01-18 at 15:36 -0500, Behdad Esfahbod wrote:
>>>> On 01/18/2010 03:28 PM, Peter Clifton wrote:
>>>>>
>>>>> Is the pango_cairo_context_set_resolution affecting the choice of fonts
>>>>> being offered by the system?
>>>>
>>>> The resolution set there is used to convert from font size in points to font
>>>> size in cairo user units.  A number in the tens of thousands doesn't make
>>>> sense to me.
>>>
>>> No - it isn't obvious where that number has come from. My win32-debug-fu
>>> is pretty low unfortunately - I can't really think how best to
>>> instrument or debug the issue.
>>>
>>> Where is the calculation which comes up with the font-size it should ask
>>> Windows for?
>>
>> I'm not well-versed in the win32 code.
>>
>> There's not much I can help with given the current information.  Tor may have
>> ideas.
> 
> I think I "might" have figured it out..
> 
>> (gschem.exe:3036): Pango-WARNING **: couldn't load font "Arial 10 400000", falli
>> ng back to "Sans 400000", expect ugly output.
> 
> Compare to the font description my code issues:
> 
> 177   font_string = g_strdup_printf ("%s %f\n", FONT_NAME, font_size_pt);
> 
> 
> I believe (although this is unconfirmed) that my colleagues with the
> issue are in locales where "," is the decimal point separator.
> 
> What if my code is asking for:
> 
> Arial 10,400000
> 
> E.g. 10.4 point font?


Yes, that sounds like the bug!

You can totally avoid using a font string and use
pango_font_description_set_family and set_size() directly.

behdad

> 
> Again, I don't know the easiest way to test this hypothesis - or where
> the bug actually lies.
> 
> Do Pango font descriptions allow floating point? If so, is the decimal
> separator "." or does it follow the system locale?
> 
> Best regards,
> 
> Peter C.
> 
> 
> 


More information about the cairo mailing list