[gimpwin-dev] Re: GTK+2.0 Chinese (or CJK) fonts on win32



Tor Lillqvist writes:
 > I'll also look into making pango_win32_font_get_coverage() actually
 > use the PangoLanguage passed to it. Will check what FreeType2 does, if
 > it does something similar. It seems that you can use this heuristics:
 > If the font name table has an entry in Traditional Chinese (0x404), it
 > is for zh_TW. If it has a name in Simplified Chinese (0x804), it is
 > for zh_CN.

Yup, works fine! I now have pango.aliases contain:

courier = "courier new"
sans = "arial,mingliu,simhei,gulimche,ms gothic"
serif = "times new roman,mingliu,simsun,gulimche,ms gothic"
monospace = "courier new,mingliu,simhei,gulimche,ms gothic"

and when starting testgtk with LANG=zh_TW, the colorselector uses
mingliu:

PNG image


with LANG=zh_CN, it uses simhei:

PNG image


and for Japanese, ms gothic:

PNG image


(I don't think mingliu necessarily is the best choice for blending
visually well with the arial font used for the latin characters in
"sans". But the main point is visible: depending on locale, a correct
font is chosen for the unihan characters.)

(I also used a gtkrc that set the default font_name to sans 18 to see
the differences better.)

I had to add an #ifdef G_OS_WIN32 section to
gtkmain.c:gtk_get_default_language(), because he setlocale() in
Microsoft's C library doesn't return the sv_FI style locale codes, but
Swedish_Finland etc. On Win32, you have to use g_win32_getlocale().

--tml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]