[cairo] Cairo, pango and Win32.. incorrect font rendering
behdad at behdad.org
Mon Jan 18 14:51:25 PST 2010
On 01/18/2010 05:44 PM, Peter Clifton wrote:
> On Mon, 2010-01-18 at 16:01 -0500, Behdad Esfahbod wrote:
>>> 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.
> Your suggestion fixed the bug - superb!
> Now, I'll just have to figure out if the Pango backend, or gEDA is being
> naught about mixing "," or ".", as I think we override some LOCALE
Pango hardcodes dot and comma. It's the g_strdup_printf() that is producing
"," instead of ".".
> I wonder why this has never manifested as an issue on Linux before (IE.
> With freetype). Perhaps if it "decides" to take the "10" part of the
> "10.400000" the effect would be too small for people to notice and
> grumble about. Perhaps it parses the font-string correctly.
Try under fr_FR maybe?
> I trust it is OK just to do this:
> desc = pango_font_description_new ();
> pango_font_description_set_family_static (desc, FONT_NAME);
> pango_font_description_set_size (desc, (int)((double)PANGO_SCALE * font_size_pt));
> //(Yes - my rounding is naughty - but I doubt anyone will ever notice)
> And not call any other of the pango_font_description_set_* () routines?
If your family name is just a family name, this is fine But if it has other
components, say, it may be "Sans Bold", then it's better to do
pango_font_description_from_string() and then call set_size(). Ie:
desc = pango_font_description_from_string (FONT_NAME);
pango_font_description_set_size (desc, pango_units_from_double (font_size_pt));
> Best wishes,
> Peter C.
More information about the cairo