Font configuration/Examples/No anti-aliasing - ArchWiki

Jump to content

# Font configuration/Examples/No anti-aliasing

2 languages

- 日本語
- Русский

From ArchWiki
< Font configuration‎ | Examples

The following is a comprehensive fontconfig for turning off anti-aliasing under certain conditions.

Most contemporary fonts are not very readable when anti-aliasing is turned off. Hence, the following fontconfig disables anti-aliasing only for certain fonts — mostly Microsoft fonts — that are designed to look well without anti-aliasing.

It also re-enable anti-aliasing above a certain size.

Finally, it sets preferred fonts that look well without anti-aliasing. This is useful for web browsing, as many websites specify font family names such as "serif", "sans-serif", and "monospace". In these situations fontconfig will choose nice fonts without anti-aliasing.

    ~/.config/fontconfig/fonts.conf

    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
    <fontconfig>

    <match target="font">
        <edit name="autohint" mode="assign"><bool>false</bool></edit>
        <edit name="rgba" mode="assign"><const>none</const></edit>
        <edit name="hinting" mode="assign"><bool>true</bool></edit>
        <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq" qual="any"><string>Arial</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Times New Roman</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>21</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Helvetica</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Verdana</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Georgia</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Bitstream Vera Sans Mono</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Andale Mono</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="contains"><string>DejaVu</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Trebuchet MS</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <match target="font">
        <test name="family" compare="eq"><string>Courier New</string></test>
        <test qual="any" name="pixelsize" compare="less"><double>20</double></test>
        <edit name="antialias" mode="assign"><bool>false</bool></edit>
    </match>

    <alias>
    	<family>Times</family>
    	<prefer><family>Times New Roman</family></prefer>
    	<default><family>serif</family></default>
    </alias>
    <alias>
    	<family>Helvetica</family>
    	<prefer><family>Arial</family></prefer>
    	<default><family>sans</family></default>
    </alias>
    <alias>
    	<family>Courier</family>
    	<prefer><family>DejaVu Sans Mono</family></prefer>
    	<default><family>monospace</family></default>
    </alias>

    <alias>
    	<family>serif</family>
    	<prefer><family>Times New Roman</family></prefer>
    </alias>
    <alias>
    	<family>sans-serif</family>
    	<prefer><family>Arial</family></prefer>
    </alias>
    <alias>
    	<family>monospace</family>
    	<prefer><family>DejaVu Sans Mono</family></prefer>
    </alias>

    </fontconfig>

Category:

- Fonts