You are not logged in.

#1 2013-11-30 15:58:23

axper
Member
Registered: 2013-01-25
Posts: 115

Setting font attributes for specific language only

Is it possible to assign font attributes only when a specific language is requested?
I want to enable autohinting and use slight hinting when using DejaVu Serif and Armenian (hy) language is used.

I have this in my /etc/fonts/local.conf : http://pastebin.com/aMECdUdj
(^all smoothing disabled for debugging)
Symlinks in /etc/fonts/conf.d :

09-texlive-fonts.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-rgb.conf
11-lcdfilter-legacy.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-serif.conf
20-unhint-small-vera.conf
25-unhint-nonlatin.conf
30-metric-aliases.conf
30-urw-aliases.conf
30-win32-aliases.conf
40-nonlatin.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
57-dejavu-sans.conf
57-dejavu-sans-mono.conf
57-dejavu-serif.conf
60-latin.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
70-no-bitmaps.conf
75-ttf-inconsolata.conf
80-delicious.conf
90-synthetic.conf
99pdftoopvp.conf
README

After changing configuartion I run fc-cache -f to update font list.

In local.conf, when using "<test name="lang" compare="eq"><string>hy</string></test>" to match a value, it doesn't change anything. When using "<test name="lang" compare="contains"><string>hy</string></test>" it sets attributes for every language in the whole DejaVu Serif family.

I am really stuck. Any help appreciated.

Offline

#2 2013-12-02 14:59:39

ganlu
Member
From: ChongQing, China
Registered: 2004-01-04
Posts: 336

Re: Setting font attributes for specific language only

Does this work for you?

<!--
    CJK字体AA设置
-->
    <match target="font" >
        <test name="lang" compare="contains" >
            <string>zh</string>
        </test>
        <edit name="antialias" mode="assign" >
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign" >
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign" >
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign" >
            <const>hintslight</const>
        </edit>
        <edit name="rgba" mode="assign">
            <const>rgb</const>
        </edit>
    </match>

Or this:

<!--
	单独字体AA设置
-->
    <match target="font" >
        <test qual="any" name="family">
            <string>Luxi Sans</string>
        </test>
        <edit name="antialias" mode="assign" >
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign" >
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign" >
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign" >
            <const>hintslight</const>
        </edit>
        <edit name="rgba" mode="assign">
            <const>rgb</const>
        </edit>
    </match>

Last edited by ganlu (2013-12-02 15:01:28)

Offline

#3 2013-12-02 15:26:11

axper
Member
Registered: 2013-01-25
Posts: 115

Re: Setting font attributes for specific language only

    <match target="font" >
        <test name="lang" compare="contains" >
            <string>zh</string>
        </test>
        <edit ..........

This changes the attributes for every font that contains "zh" in it's supported languages list.

    <match target="font" >
        <test qual="any" name="family">
            <string>Luxi Sans</string>
        </test>
        <edit ....

This would change attributes for the whole faimly, again not what I want.

I guess I could copy the font with a different name but I am looking for a more elegant solution. Thanks for reply anyway.

Offline

Board footer

Powered by FluxBB