[Fontconfig] How to use different fonts for different characters?
Wang WenRui
wangwr at mail.ustc.edu.cn
Thu May 1 06:02:23 EST 2003
On Tue, Apr 29, 2003 at 10:20:31PM -0700, Keith Packard wrote:
>
> Around 12 o'clock on Apr 30, Wang WenRui wrote:
>
> <match target="pattern">
> <test qual="any" name="family">
> <string>sans-serif</string>
> </test>
> <edit name="family" mode="append" binding="strong">
> <string>Bitstream Vera Sans</string>
> </edit>
> </match>
>
> Very nicely done. That should do precisely what you want -- prefer
> Bitstream Vera Sans for any characters that it does support in place of any
> other fonts that are weakly substituted and overriding any language
> specification from the locale or document.
Could you tell me how to get this work in source code? My program broke
in this way(it just render letters only, while doesn't render any
Chinese characters), but pango and mozilla works.
Thanks a lot.
Best regards
Wang WenRui
--------- my code ---------
pattern = XftPatternCreate ();
XftPatternAddString (pattern, "family", "monospace");
XftPatternAddString (pattern, XFT_ENCODING, "iso10646-1");
XftPatternAddString (pattern, "lang", "zh-CN");
XftPatternAddInteger (pattern, XFT_SPACING, XFT_MONO);
xftFont = XftFontOpenPattern (dpy, XftFontMatch (dpy, iScreen,
pattern, &result));
Then I draw the utf8 string with :
XftTextExtentsUtf8 (dpy, xftFont, strOutput, strlen (strOutput),
&extents);
XftDrawStringUtf8 (xftDraw, &color, xftFont, x, y, strOutput, strlen
(strOutput))
FC_DEBUG=1 myprogram shows:
FC_DEBUG=1
Match Pattern 20 of 32
antialias: FcFalse(w)
autohint: FcFalse(s)
dpi: 100.037(f)(s)
encoding: "iso10646-1"(s)
family: "Bitstream Vera Sans Mono"(w) "SimSun"(w) "STXihei"(w)
"Bitstream Vera Sans Mono"(w) "Andale Mono"(w) "Courier New"(w) "Luxi
Mono"(w) "Nimbus Mono L"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w)
"Baekmuk Dotum"(w) "monospace"(s) "Bitstream Vera Sans Mono"(s)
fontversion: 2147483647(i)(s)
globaladvance: FcTrue(s)
hinting: FcTrue(s)
lang: "zh-CN"(s)
maxglyphmemory: 1048576(i)(s)
minspace: FcFalse(s)
pixelsize: 16(i)(s)
render: FcTrue(s)
rgba: 0(i)(s)
scale: 1(f)(s)
slant: 0(i)(s)
spacing: 100(i)(s)
verticallayout: FcFalse(s)
weight: 100(i)(s)
width: 100(i)(s)
Best score 0 0 12 200 0 0 0 0 0 2000 0 0 0 0 2.14735e+11Pattern 14 of 14
charset: set(s)
family: "Bitstream Vera Sans Mono"(s)
file:
"/usr/share/fonts/truetype/ttf-bitstream-vera/VeraMono.ttf"(s)
fontversion: 131072(i)(s)
foundry: "bitsteam"(s)
index: 0(i)(s)
lang:
aa|ast|ay|bi|br|ch|co|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|ia|id|ie|io|is|it|lb|mg|nb|nl|nn|no|oc|om|pt|rm|sma|smj|so|sq|sv|sw|tn|tr|ts|vo|vot|wa|xh|yap|zu(s)
outline: FcTrue(s)
scalable: FcTrue(s)
slant: 0(i)(s)
spacing: 100(i)(s)
style: "Roman"(s)
weight: 80(i)(s)
width: 100(i)(s)
>
> -keith
>
>
>
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at fontconfig.org
> http://mail.fontconfig.org/mailman/listinfo/fontconfig
More information about the Fontconfig
mailing list