Nguyen Thai Ngoc Duy
2009-Sep-24 13:55 UTC
[Fontconfig] How to make Arial support Vietnamese?
Hi, I would like to make arial the prefered Sans font in my system. It works great if I use locale C. If I use locale vi_VN.UTF-8 then it fails to recognize Vietnamese is supported by Arial and pass on. Is there anyway to make it work? I''m using fontconfig 2.7.2. The output of Arial in my machine is below. I guess field "charset" is surprisingly short, but I don''t know why. Pattern has 30 elts (size 32) family: "Arial"(s) familylang: "en"(s) style: "Normal"(s) stylelang: "ca"(s) fullname: "Arial"(s) fullnamelang: "en"(s) slant: 0(i)(s) weight: 80(i)(s) width: 100(i)(s) size: 12(f)(s) pixelsize: 12.5(f)(s) foundry: "monotype"(s) hintstyle: 3(i)(s) hinting: FcTrue(s) verticallayout: FcFalse(s) autohint: FcFalse(s) globaladvance: FcTrue(s) file: "/usr/share/fonts/corefonts/arial.ttf"(s) index: 0(i)(s) outline: FcTrue(s) scalable: FcTrue(s) dpi: 75(f)(s) scale: 1(f)(s) charset: 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff 0001: ffffffff ffffffff ffffffff ffffffff 00048000 00018003 1fffe000 fc000000 0002: 00000000 00000000 02000000 00000000 00000000 00000000 3f0002c0 00000000 0003: 0000020b 00000008 00000000 40000000 ffffd7f0 fffffffb 00007fff 00000000 0004: ffffdffe ffffffff dffeffff 00000000 3ccf0000 0f0fc00c 03000000 00000300 0005: 00000000 00000000 00000000 00000000 00000000 fbff0000 ffff000f 001f07ff 0006: 88001000 07fffffe 0007ffff 40022fff 01000040 00008210 00201000 03ff0000 001e: 00000000 00000000 00000000 00000000 0000003f ffffffff ffffffff 03ffffff 0020: 7fb8f000 560d7c47 00000010 8000fc00 00000000 00001c98 00000000 00000000 0021: 00480020 00004044 78180000 00000000 003f0000 00000100 00000000 00000000 0022: c6268044 00000a00 00000100 00000033 00000000 00000000 00000000 00000000 0023: 00010004 00000003 00000000 00000000 00000000 00000000 00000000 00000000 0025: 11111005 10101010 ffff0000 00001fff 000f1111 14041c03 03008c10 00000040 0026: 00000000 1c000000 00000005 00000c69 00000000 00000000 00000000 00000000 00e8: 0100003e 04000000 00000000 00000000 00000000 00000000 00000000 00000000 00f0: fffffff6 0003ffff 00000000 00000000 00000000 00000000 00000000 00000000 00fb: 00000006 5f7ffc01 03c0ffdb 3c000000 003fcc00 00000000 00000000 f0000000 00fc: 00000000 00000000 c0000000 00000007 00000000 00000000 00000000 00000000 00fd: 00000000 c0000000 00000000 00000000 00000000 00000000 00000000 00040000 00fe: 00000000 00000000 00000000 00000000 ffffffff ffffffff ffffffff 1fffffff 00ff: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 10000000 (s) lang: aa|af|ar|ast|av|ay|az-az|be|bg|bi|bin|br|bs|bua|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fa|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|he|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|ky|la|lb|lez|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|tt|tyv|ug|uk|uz|vo|vot|wa|wen|wo|xh|yap|yi|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s) fontversion: 184812(i)(s) capability: "otlayout:arab"(s) fontformat: "TrueType"(s) embeddedbitmap: FcTrue(s) decorative: FcFalse(s) My modified /etc/fonts/conf.d/60-latin.conf <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias> <family>serif</family> <prefer> <family>Times New Roman</family> <family>Bitstream Vera Serif</family> <family>DejaVu Serif</family> <family>Thorndale AMT</family> <family>Luxi Serif</family> <family>Nimbus Roman No9 L</family> <family>Times</family> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>Arial</family> <family>Bitstream Vera Sans</family> <family>DejaVu Sans</family> <family>Verdana</family> <family>Albany AMT</family> <family>Luxi Sans</family> <family>Nimbus Sans L</family> <family>Helvetica</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>Terpinus</family> <family>Courier New</family> <family>Bitstream Vera Sans Mono</family> <family>DejaVu Sans Mono</family> <family>Andale Mono</family> <family>Cumberland AMT</family> <family>Luxi Mono</family> <family>Nimbus Mono L</family> <family>Courier</family> </prefer> </alias> </fontconfig> -- Duy
Nguyen Thai Ngoc Duy wrote:> I would like to make arial the prefered Sans font in my system. It > works great if I use locale C. If I use locale vi_VN.UTF-8 then it > fails to recognize Vietnamese is supported by Arial and pass on. Is > there anyway to make it work? I''m using fontconfig 2.7.2.This is one of the more annoying aspects of fontconfig when dealing with Asian locales. I made a similar rule to prefer the Latin characters in the DejaVu fonts over the ones in a Chinese font, when in a Chinese locale. Naturally, the Chinese font supported Chinese character sets, so it was chosen. <match target="pattern"> <test qual="any" name="family"> <string>sans-serif</string> </test> <edit name="family" mode="append" binding="same"> <string>DejaVu Sans</string> </edit> </match> <match target="pattern"> <test qual="any" name="family"> <string>serif</string> </test> <edit name="family" mode="append" binding="same"> <string>DejaVu Serif</string> </edit> </match> <match target="pattern"> <test qual="any" name="family"> <string>monospace</string> </test> <edit name="family" mode="append" binding="same"> <string>DejaVu Sans Mono</string> </edit> </match> Basically, it forces the three DejaVu fonts to the top of the substitution list. Initially, I was using "strong" bindings, but that broke Flash 9 at the time. I don''t know if it would still break Flash 10. --Pat
I don''t think it is that bad when dealing with CJKV languages. You can find an example in the attachment from this link https://bugzilla.redhat.com/show_bug.cgi?id=499902 such as this one https://bugzilla.redhat.com/attachment.cgi?id=343148 you can even merge multiple edit blocks, or change binding from same to "strong" (or prepend to prepend_first) <match> <test name="lang" compare="contains"> <string>zh</string> </test> <test name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>DejaVu Sans</string> <string>Bitstream Vera Sans</string> <string>WenQuanYi Bitmap Song</string> <string>WenQuanYi Micro Hei</string> <string>WenQuanYi Zen Hei</string> <string>AR PL UMing CN</string> </edit> </match> Pat Suwalski wrote:> Nguyen Thai Ngoc Duy wrote: > >> I would like to make arial the prefered Sans font in my system. It >> works great if I use locale C. If I use locale vi_VN.UTF-8 then it >> fails to recognize Vietnamese is supported by Arial and pass on. Is >> there anyway to make it work? I''m using fontconfig 2.7.2. >> > > This is one of the more annoying aspects of fontconfig when dealing with > Asian locales. I made a similar rule to prefer the Latin characters in > the DejaVu fonts over the ones in a Chinese font, when in a Chinese > locale. Naturally, the Chinese font supported Chinese character sets, so > it was chosen. > > <match target="pattern"> > <test qual="any" name="family"> > <string>sans-serif</string> > </test> > <edit name="family" mode="append" binding="same"> > <string>DejaVu Sans</string> > </edit> > </match> > > <match target="pattern"> > <test qual="any" name="family"> > <string>serif</string> > </test> > <edit name="family" mode="append" binding="same"> > <string>DejaVu Serif</string> > </edit> > </match> > > <match target="pattern"> > <test qual="any" name="family"> > <string>monospace</string> > </test> > <edit name="family" mode="append" binding="same"> > <string>DejaVu Sans Mono</string> > </edit> > </match> > > Basically, it forces the three DejaVu fonts to the top of the > substitution list. > > Initially, I was using "strong" bindings, but that broke Flash 9 at the > time. I don''t know if it would still break Flash 10. > > --Pat > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig > > > >
Nguyen Thai Ngoc Duy
2009-Sep-27 08:14 UTC
[Fontconfig] How to make Arial support Vietnamese?
On 9/24/09, Qianqian Fang <fangq at nmr.mgh.harvard.edu> wrote:> I don''t think it is that bad when dealing with CJKV languages. > You can find an example in the attachment from this link > https://bugzilla.redhat.com/show_bug.cgi?id=499902 > such as this one > https://bugzilla.redhat.com/attachment.cgi?id=343148 > > you can even merge multiple edit blocks, or change binding > from same to "strong" (or prepend to prepend_first) > > <match> > <test name="lang" compare="contains"> > <string>zh</string> > </test> > <test name="family"> > <string>sans-serif</string> > </test> > <edit name="family" mode="prepend" binding="strong"> > <string>DejaVu Sans</string> > <string>Bitstream Vera Sans</string> > <string>WenQuanYi Bitmap Song</string> > <string>WenQuanYi Micro Hei</string> > <string>WenQuanYi Zen Hei</string> > <string>AR PL UMing CN</string> > </edit> > </match>That would work for me if I removed lang test (of course I tested against vi, not zh). <match> <test name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>Arial</string> </edit> </match> -- Duy
nicolas.mailhot at laposte.net
2009-Sep-27 08:38 UTC
[Fontconfig] How to make Arial support Vietnamese?
Take a look here, it may halp you understand how fontconfig works http://git.fedorahosted.org/git/fontpackages.git?p=fontpackages.git;a=tree;f=fontconfig-templates -- Nicolas Mailhot
Nguyen Thai Ngoc Duy
2009-Sep-29 13:33 UTC
[Fontconfig] How to make Arial support Vietnamese?
On 9/27/09, nicolas.mailhot at gmail.com <nicolas.mailhot at gmail.com> wrote:> Take a look here, it may halp you understand how fontconfig works > > > http://git.fedorahosted.org/git/fontpackages.git?p=fontpackages.git;a=tree;f=fontconfig-templates >Thanks. It turns out Arial does miss a few glyphs to satisfy vi.orth: 0x0302, 0x306 and 0x31b (all diacritics). -- Duy