GNOME Bugzilla – Bug 528550
Wrong glyphs using a japanese locale
Last modified: 2008-04-17 16:15:55 UTC
When using a japanese locale with the pango back-end of WebKit then wrong characters are displayed. See https://bugs.webkit.org/show_bug.cgi?id=18335 and the screenshot at https://bugs.webkit.org/attachment.cgi?id=20581&action=view I'm not sure that the bug is in Pango but I was able to reproduce the problem with a small snippet of code.
Created attachment 109412 [details] Test glyphs in pango The program tries to get the glyph using both FcFreeTypeCharIndex() and pango_shape() but the results are not always the same. The error could be in pango_font_get_glyph(), copied from WebKit, but it seems ok to me. Run it with (the ja_JP.UTF-8 locale must be enabled to test it): $ gcc -o lang-test `pkg-config --cflags --libs gtk+-2.0 cairo-ft fontconfig freetype2` lang-test.c $ LANG=C ./lang-test freetype: 43, pango: 43 $ LANG=ja_JP.UTF-8 ./lang-test freetype: 42, pango: 43
You have noticed that the font passed into your pango_font_get_glyph() isn't used, right? Basically, the pango_itemize() is picking a different font from the "first choice" font that pango_font_map_load_font() returns. Nothing using a function like your pango_font_get_glyph() should be called a "Pango" backend, though maybe there was some significant distortion in the translation to a test case. None of the capabilities of Pango (combining fonts, shaping international text, kerning, etc, etc, etc) will be available. (Also, don't put even static functions into the pango_ namespace. If they conflict with future pango functions, that isn't our problem.)
Sorry for the useless bug report, but I really didn't notice it. There is some significant distortion from the code in WebKit, that code is only used for "simple" (and optimised in some ways I don't want to know) text rendering. For more complex things I didn't write the code, just trying to fix a bug, so I didn't choose the name but probably it should be a C++ private method to follow WebKit conventions. Thanks.
Gcc should have warned you that the font argument to your pango_font_get_glyph() function is unused. That's quite telling.