[cairo] Cairo, pango and Win32.. incorrect font rendering
spitzak at gmail.com
Mon Jan 18 16:40:13 PST 2010
I usually force the locale to "C" on startup of my software to avoid
this problems (and also with isalpha() changing behavior and probably
some other problems).
The whole "locale" idea is stupid, it should not change the behavior of
any fundemental libc calls! They should instead have put something into
%f to show whether , or . is wanted (and also if thousands separators
are wanted), and let everybody use it. Anybody doing I18N has to
translate all the strings anyway so they can translate their format
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
> 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.
> 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?
> Best wishes,
> Peter C.
More information about the cairo