Jump to content

Font configuration/Examples

From ArchWiki

See Font configuration for the main article.

Configurations can vary to a degree. Please post Fontconfig configurations with an explanation for why they were done.

Hinted fonts

~/.config/fontconfig/fonts.conf



  
    
      true
    
    
      false
    
    
      true
    
    
      hintslight
    
    
      lcddefault
    
    
      rgb
    
  

No hinting for italic or bold




  
    
      true
    
    
      false
    
    
      lcddefault
    
    
      hintslight
    
    
      true
    
    
      rgb
    
  
  
    
      15
    
    
      lcdlight
    
    
      hintnone
    
  
  
    
      medium
    
    
      hintnone
    
    
      lcdlight
    
  
  
    
      0
    
    
      hintnone
    
    
      lcdlight
    
  

Enable anti-aliasing only for bigger fonts or certain fonts

Some users prefer the sharper rendering that anti-aliasing does not offer:




  
    
      false
    
  
  
    
      12
    
    
      true
    
  
  
    
      16
    
    
      true
    
  

You might also want to disable anti-aliasing only for fonts that look well without anti-aliasing. See Font configuration/Examples/No anti-aliasing.

Disable bold font

For when a font does not present itself well in bold and you cannot disable bold fonts in the application (st for example).

...

  
    Envy Code R
  
  
    medium
  
  
    medium
  


...

Disable ligatures for monospaced fonts

This prevents letter combinations like "ffi" from being squashed into a single-width character in some monospaced fonts. The whole block needs to be duplicated to include extra fonts.




  Disable ligatures for monospaced fonts to avoid ff, fi, ffi, etc. becoming only one character wide
  
    
      Nimbus Mono PS
    
    
      liga off
      dlig off
    
  

Some other fonts may also require disabling features such as calt and/or clig.

You can test the effectiveness of this with the following command:

$ echo -e "| worksheet |\n| buffering |\n| difficult |\n| finishing |\n| different |\n| efficient |" | pango-view --font="Nimbus Mono PS" /dev/stdin

Some programs do not support the fontfeatures tag, so for those replacing the font with another is the only option. See Font configuration#Set default or fallback fonts for details.

Enable typographic features

Some fonts like inter-font support many useful typographic features that are not enabled by default.

Those features can be managed system-wide (for all users) or per user using fontconfig, and/or per application, using applications internal setting. (For those programs which support configuring them internally, like LibreOffice.)

Below is an example of enabling dlig, tnum, ccmp, ss01 and ss02 features for the Inter font. You can substitute them with any other feature of any other font supporting them. A complete list of all possible typographic features can be found at Wikipedia:List of typographic features, but check if your font of choice supports a feature, before trying to enable it.




        Enable some typographic features of Inter font, for all applications.
        
                
                        Inter
                
                
                        dlig on
                        tnum on
                        ccmp on
                        ss01 on
                        ss02 on
                
        

Verification of those features being enabled can be done both visually or using fc-match -v fontfamilyname command.

Default fonts

For font consistency, all applications should be set to use the serif, sans-serif, and monospace aliases, which are mapped to particular fonts by fontconfig. See Metric-compatible fonts for options and examples.

Note Fontconfig 2.18.0 introduced new "genericfamily" feature [1]. It is enabled by default via 48-guessfamily.conf preset and takes precedence over weak aliases for generic family names. Use binding="strong" to override it.

The standard names

The standard names are the aliases serif, sans-serif, and monospace. Setting custom values for these aliases will change the defaults for almost all applications, including sway, alacritty, and firefox. This example prefers gnu-free-fonts for everything except fixed-width fonts, for which Source Code Pro is preferred.




  
    serif
    FreeSerif
  
  
    sans-serif
    FreeSans
  
  
    monospace
    Source Code Pro
  

Arabic

Example fonts.conf which specifies a default font for the Arabic language and keeps western style fonts for Latin letters. You will require either ttf-arabeyes-fontsAUR or noto-fonts for the below to work. You can also choose to install any other Arabic fonts and accordingly change the font name below based on your preference




  
  
    
      ar
    
    
      Tholoth
    
  

The above should work for most applications but some applications like Chromium do not work with the language match test. If you find some applications not using your selected fonts, you can use the below alias and prefer tags which seems to work.




  
  
    sans-serif
    
      Noto Sans
      Open Sans
      Droid Sans
      Roboto
      Tholoth
      Noto Sans Arabic
    
  
  
    serif
    
      Noto Serif
      Droid Serif
      Roboto Slab
      Tholoth
      Noto Sans Arabic
    
  
  
    monospace
    
      Noto Sans Mono
      Inconsolata
      Droid Sans Mono
      Roboto Mono
    
  

Excluding Arabic script from other languages

Fonts using Arabic script but are of other languages can be excluded. For example, the Nastaliq Urdu fonts could be chosen by default for Arabic. Use the following configuration to blacklist them, ensuring the system uses a proper Arabic font.

/etc/fonts/conf.d/66-noto-reject-nastaliq.conf

urn:fontconfig:fonts.dtd">

  
    
      /usr/share/fonts/noto/NotoNastaliq*
    
  

Japanese

Example fonts.conf which also specifies a default font for the Japanese locale (ja_JP) and keeps western style fonts for Latin letters.




  
  
    
      Noto Sans
    
  
  
  
    
      ja
    
    
      Noto Sans CJK JP
    
  
  
  
    
      sans-serif
    
    
    
      Noto Sans
    
  
  
  
    
      serif
    
    
      Noto Serif
    
    
      IPAPMincho
    
    
      HanaMinA
    
  
  
  
    
      monospace
    
    
      Noto Sans Mono
    
    
      Inconsolatazi4
    
    
      IPAGothic
    
  
  
  
    sans-serif
    
      Noto Sans
      Open Sans
      Droid Sans
      Ubuntu
      Roboto
      NotoSansCJK
      Source Han Sans JP
      IPAPGothic
      VL PGothic
      Koruri
    
  
  
    serif
    
      Noto Serif
      Droid Serif
      Roboto Slab
      IPAPMincho
    
  
  
    monospace
    
      Noto Sans Mono
      Inconsolatazi4
      Ubuntu Mono
      Droid Sans Mono
      Roboto Mono
      IPAGothic
    
  

Chinese

~/.config/fontconfig/fonts.conf
or
/etc/fonts/local.conf



  
    
      false
    
  
  
    
      serif
    
    
      Noto Serif
    
  
  
    
      sans-serif
    
    
      Roboto
    
  
  
    
      monospace
    
    
      DejaVu Sans Mono
    
  
  
    
      zh
    
    
      serif
    
    
      Source Han Serif CN
    
  
  
    
      zh
    
    
      sans-serif
    
    
      Source Han Sans CN
    
  
  
    
      zh
    
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  
  
  
    
      WenQuanYi Zen Hei
    
    
      Source Han Sans CN
    
  
  
    
      WenQuanYi Micro Hei
    
    
      Source Han Sans CN
    
  
  
    
      WenQuanYi Micro Hei Light
    
    
      Source Han Sans CN
    
  
  
    
      Microsoft YaHei
    
    
      Source Han Sans CN
    
  
  
    
      SimHei
    
    
      Source Han Sans CN
    
  
  
    
      SimSun
    
    
      Source Han Serif CN
    
  
  
    
      SimSun-18030
    
    
      Source Han Serif CN
    
  

Chinese in Noto Fonts

Apply Noto Fonts while replacing Microsoft Fonts with WenQuanYi Micro Hei

~/.config/fontconfig/fonts.conf
or
/etc/fonts/local.conf



  
    
      false
    
  
  
    
      serif
    
    
      Noto Serif
    
  
  
    
      sans-serif
    
    
      Noto Sans
    
  
  
    
      monospace
    
    
      Noto Sans Mono
    
  
  
    
      zh
    
    
      serif
    
    
      Noto Serif CJK SC
    
  
  
    
      zh
    
    
      sans-serif
    
    
      Noto Sans CJK SC
    
  
  
    
      zh
    
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  
  
  
    
      WenQuanYi Zen Hei
    
    
      WenQuanYi Micro Hei
    
  
  
    
      WenQuanYi Zen Hei Lite
    
    
      WenQuanYi Micro Hei Lite
    
  
  
    
      WenQuanYi Zen Hei Mono
    
    
      WenQuanYi Micro Hei Mono
    
  
  
  
    
      Microsoft YaHei
    
    
      WenQuanYi Micro Hei
    
  
  
    
      SimHei
    
    
      WenQuanYi Micro Hei
    
  
  
    
      SimSun
    
    
      WenQuanYi Micro Hei
    
  
  
    
      SimSun-18030
    
    
      WenQuanYi Micro Hei
    
  

CJK, but other Latin fonts are preferred

Requires noto-fonts-cjk.

You can replace PT Serif/Roboto/Cascadia Code PL with your favorite serif/sans-serif/monospace fonts.

~/.config/fontconfig/fonts.conf



  
  
    serif
    
      PT Serif
    
  

  
  
    sans-serif
    
      Roboto
    
  

  
  
    monospace
    
      Cascadia Code PL
    
  

  
  
    system-ui
    
      Roboto
    
  

  

  
  
  
    
      serif
    
    
      Noto Serif CJK SC
    
  

  
  
  
    
      ja
    
    
      serif
    
    
      Noto Serif CJK JP
    
  

  
  
  
    
      ko
    
    
      serif
    
    
      Noto Serif CJK KR
    
  

  
  
  
    
      zh
    
    
      serif
    
    
      Noto Serif CJK SC
    
  
  
  
    
      zh-hans
    
    
      serif
    
    
      Noto Serif CJK SC
    
  
  
  
    
      zh-hant
    
    
      serif
    
    
      Noto Serif CJK TC
    
  
  
  
  
    
      zh-cn
    
    
      serif
    
    
      Noto Serif CJK SC
    
  
  
  
    
      zh-tw
    
    
      serif
    
    
      Noto Serif CJK TC
    
  

  

  
  
  
    
      sans-serif
    
    
      Noto Sans CJK SC
    
  

  
  
  
    
      ja
    
    
      sans-serif
    
    
      Noto Sans CJK JP
    
  

  
  
  
    
      ko
    
    
      sans-serif
    
    
      Noto Sans CJK KR
    
  

  
  
  
    
      zh
    
    
      sans-serif
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-hans
    
    
      sans-serif
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-hant
    
    
      sans-serif
    
    
      Noto Sans CJK TC
    
  
  
  
    
      zh-hant-hk
    
    
      sans-serif
    
    
      Noto Sans CJK HK
    
  
  
  
  
    
      zh-cn
    
    
      sans-serif
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-tw
    
    
      sans-serif
    
    
      Noto Sans CJK TC
    
  
  
  
    
      zh-hk
    
    
      sans-serif
    
    
      Noto Sans CJK HK
    
  

  

  
  
  
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  

  
  
  
    
      ja
    
    
      monospace
    
    
      Noto Sans Mono CJK JP
    
  

  
  
  
    
      ko
    
    
      monospace
    
    
      Noto Sans Mono CJK KR
    
  

  
  
  
    
      zh
    
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  
  
  
    
      zh-hans
    
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  
  
  
    
      zh-hant
    
    
      monospace
    
    
      Noto Sans Mono CJK TC
    
  
  
  
    
      zh-hant-hk
    
    
      monospace
    
    
      Noto Sans Mono CJK HK
    
  
  
  
  
    
      zh-cn
    
    
      monospace
    
    
      Noto Sans Mono CJK SC
    
  
  
  
    
      zh-tw
    
    
      monospace
    
    
      Noto Sans Mono CJK TC
    
  
  
  
    
      zh-hk
    
    
      monospace
    
    
      Noto Sans Mono CJK HK
    
  

  

  
  
  
    
      system-ui
    
    
      Noto Sans CJK SC
    
  

  
  
  
    
      ja
    
    
      system-ui
    
    
      Noto Sans CJK JP
    
  

  
  
  
    
      ko
    
    
      system-ui
    
    
      Noto Sans CJK KR
    
  

  
  
  
    
      zh
    
    
      system-ui
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-hans
    
    
      system-ui
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-hant
    
    
      system-ui
    
    
      Noto Sans CJK TC
    
  
  
  
    
      zh-hant-hk
    
    
      system-ui
    
    
      Noto Sans CJK HK
    
  
  
  
  
    
      zh-cn
    
    
      system-ui
    
    
      Noto Sans CJK SC
    
  
  
  
    
      zh-tw
    
    
      system-ui
    
    
      Noto Sans CJK TC
    
  
  
  
    
      zh-hk
    
    
      system-ui
    
    
      Noto Sans CJK HK
    
  

Alternate stylistic sets for fonts

Certain fonts come with alternate stylistic sets for characters through an OpenType feature. Generally these stylistic sets are named ss0x and contain small changes to individual characters. This shows how to change the default dotted zero to a slashed zero for the monospace version of ttf-ibm-plex.

~/.config/fontconfig/fonts.conf



  
    
      
    
    
      IBM Plex Mono
    
    
      ss03
    
  

See What are "Stylistic Sets?" for more information on this.

See also