[Fonts]zh-hk font support/priority in Xft/Pango

2002-12-02 Thread Anthony Fok
Hello Keith and all,

I was trying to run a Gtk2 application built with Xft/Fontconfig (2.0)
and Pango under the zh_HK locale, on a system with only zh_CN (GB2312)
and zh_TW (Big5) fonts installed.  Under zh_CN and zh_TW locales, the
correct fonts are chosen.  Under zh_HK locale, however, since no zh_HK
fonts were found on the system, the zh_CN font appears to have a
higher priority over the zh_TW one, resulting in a funny-looking mosaic
of text rendered with about 1/3 zh_CN and 2/3 zh_TW.  This is my first
problem.

The second problem is that fontconfig 2.0 does not seem to recognize a
zh_HK (HKSCS-2001) font as such.  (This is on a different system where
a full set of Chinese fonts is installed.)  I have with me AR Mingti
Light B5 v2.50 with HKSCS-2001, and here is roughly what fc-list tells
me (from memory; I don't have access to that machine now):

$ fc-list :lang=zh-cn
FZShuSong\-Z01:style=Regular
FZHei\-B01:style=Regular

$ fc-list :lang=zh-tw
AR Mingti Light B5:style=Regular
AR PL Mingti2L Big5:style=Reguler [sic]
AR PL KaitiM Big5:style=Regular

$ fc-list :lang=zh-hk
[no output]

AR Mingti Light B5 should be complete, but just to make sure, I chdir
to fontconfig/fc-lang, modified zh-hk.orth and kept only the first code
(4E04?), ran 'xmkmf -a; make' etc., and fc-list :lang=zh-hk still
showed no font.  Now, I changed zh-hk.orth to just include
zh-tw.orth, and finally fc-list :lang=zh-hk works, just as
fc-list :lang=zh-mo does.

So yes, there appears to be two related but separate issues:

  1. When no zh_HK font is found, fontconfig (or is it Pango?) looks
 for zh_CN before zh_TW, but the right thing is to go to zh_TW
 first because zh_TW is 98% of the time adequate for zh_HK.
 (Yes, there are some 4800+ HKSCS characters, but their use is rare
 compared to the core Big-5 in a zh_TW font.

  2. When a zh_HK font is available, fontconfig does actually
 recognize it.  Could it have something to do with the algorithm
 where fontconfig decides a font to be either zh_CN or zh_TW (and
 not both?)

And, hereby I admit my inadequacy, and I am no advanced programmer. 
I am not quite sure where to look.  In fontconfig?  Or in Pango?
Any pointers would be helpful.  Thanks in advance!  :-)

Cheers,

Anthony

-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   [EMAIL PROTECTED] http://www.thizlinux.com/
Debian Chinese Project [EMAIL PROTECTED]   http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!   http://www.olvc.ab.ca/
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]zh-hk font support/priority in Xft/Pango

2002-12-02 Thread Keith Packard

Around 0 o'clock on Dec 3, Anthony Fok wrote:

 Under zh_HK locale, however, since no zh_HK fonts were found on the system,
 the zh_CN font appears to have a higher priority over the zh_TW one,
 resulting in a funny-looking mosaic of text rendered with about 1/3 zh_CN
 and 2/3 zh_TW.  This is my first problem.

We can solve this with a configuration change:

match target=pattern
test qual=any name=lang
stringzh-hk/string
/test
edit name=lang mode=append
stringzh-tw/string
/edit
/match

This says that when asking for a font which supports 'zh-hk', accept as a 
reasonable substitute a font which supports 'zh-tw'.

 The second problem is that fontconfig 2.0 does not seem to recognize a
 zh_HK (HKSCS-2001) font as such.

It's quite possible that the hk orthography is too selective; the HKSCS 
includes a lot of codepoints which may not be in the fonts you're 
interested in.  You can check which codepoints are supported in that font 
using 'xfd'.  If you can, send as many HKSCS fonts as you can along to me 
and I'll modify the orthography to fit them.  The trick is to make sure 
that only fonts with reasonable HKSCS support are matched.

Keith PackardXFree86 Core TeamHP Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]zh-hk font support/priority in Xft/Pango

2002-12-02 Thread Anthony Fok
Hello Keith,

On Mon, Dec 02, 2002 at 10:17:58AM -0800, Keith Packard wrote:
 
 Around 0 o'clock on Dec 3, Anthony Fok wrote:
 
  Under zh_HK locale, however, since no zh_HK fonts were found on the system,
  the zh_CN font appears to have a higher priority over the zh_TW one,
  resulting in a funny-looking mosaic of text rendered with about 1/3 zh_CN
  and 2/3 zh_TW.  This is my first problem.
 
 We can solve this with a configuration change:
 
   match target=pattern
   test qual=any name=lang
   stringzh-hk/string
   /test
   edit name=lang mode=append
   stringzh-tw/string
   /edit
   /match

Great!  Thanks!  I'll give it a try.  :-)

 This says that when asking for a font which supports 'zh-hk', accept as a 
 reasonable substitute a font which supports 'zh-tw'.
 
  The second problem is that fontconfig 2.0 does not seem to recognize a
  zh_HK (HKSCS-2001) font as such.
 
 It's quite possible that the hk orthography is too selective; the HKSCS 
 includes a lot of codepoints which may not be in the fonts you're 
 interested in.  You can check which codepoints are supported in that font 
 using 'xfd'.  If you can, send as many HKSCS fonts as you can along to me 
 and I'll modify the orthography to fit them.  The trick is to make sure 
 that only fonts with reasonable HKSCS support are matched.

That's true.  Yes, for starters, I suppose zh-hk.orth only need to cover
HKSCS-1999 (with 116 less characters).  Nevertheless, I reduced zh-hk.orth
to only one single line (just the code 4E04) and fontconfig still wouldn't
recognize any font as such, so I suspect the problem lies somewhere else. 
But yes, I shall do more experiment and let you know of the result.  :-)

Thanks again,

Anthony

-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   [EMAIL PROTECTED] http://www.thizlinux.com/
Debian Chinese Project [EMAIL PROTECTED]   http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!   http://www.olvc.ab.ca/
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts