8

I can specify the default font family used to display a particular language in X by editing .fonts.conf in my user directory (or editing the global /etc/fonts/fonts.conf). However, I've not been able to force a particular font size in the same way.

For example, the following forces the Russian language to be displayed in Linux Libertine:

<fontconfig>
    <match>
        <test name="lang">
            <string>rus</string>
        </test>
         <edit mode="prepend" name="family">
            <string>Linux Libertine</string>
        </edit>
    </match>
</fontconfig>

I have tried adding the following XML tag, but it does not work:

         <edit mode="assign" name="size">
             <int>18</int>
         </edit>
10

You can try re-using this my snippet which increases font size of specified font by a given factor:

<!--
    Scaling a chosen font with Fontconfig.
    By poige, 2008.
-->
<match target="font">
    <test name="family">
        <string>Liberation Sans</string>
    </test>
    <edit name="pixelsize" mode="assign">
        <times><name>pixelsize</name>, <double>1.1</double></times>
    </edit>
</match>
  • Changing the tag <size> to <pixelsize> was enough to get my current .fonts.conf to work. – SigueSigueBen Jun 19 '12 at 14:22
  • Apparently you cannot change the <size> of a font, but setting its <pixelsize> works perfectly. Very useful to force a given size on bitmap fonts. Thanks. – Tobia Jan 5 '17 at 14:31
  • @SigueSigueBen Does your snippet work in Firefox? I'm trying to change the size of Inconsolata, which is my favorite font but is smaller than other fonts. It works in some apps, such as Urxvt, but in Firefox does not seem to do anything. Other font configurations, such as <alias> substitutions, work in Firefox too. – Tobia Oct 2 '18 at 5:05
  • Haven't been using it all for a while (Mac OS mostly now) but AFAIR, FF could have own approach to font rasterisation — not sharing the system's one, probably. – poige Oct 4 '18 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.