Skip to content

Instantly share code, notes, and snippets.

@radupotop
Last active May 31, 2023 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radupotop/acec155e01a3b5c7ec9beff10068462c to your computer and use it in GitHub Desktop.
Save radupotop/acec155e01a3b5c7ec9beff10068462c to your computer and use it in GitHub Desktop.
Set default system-wide fonts
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- See: man 5 fonts-conf -->
<!-- Antialias rules -->
<match target="font">
<!--
Subpixel smoothing: rgb, bgr, vrgb, vbgr, none
Most monitors manufactured today use the Red, Green, Blue (RGB) specification.
Fontconfig will need to know your monitor type to be able to display your fonts correctly. Monitors are either: RGB (most common), BGR, V-RGB (vertical), or V-BGR
-->
<edit mode="assign" name="rgba"><const>none</const></edit>
<!--
Use hinting true/false. Usually true.
Font hinting (also known as instructing) is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid, (i.e. the pixel grid of the display). Its intended effect is to make fonts appear more crisp so that they are more readable. Fonts will line up correctly without hinting when displays have around 300 DPI.
-->
<edit mode="assign" name="hinting"><bool>true</bool></edit>
<!--
Hinting values are: hintnone, hintslight, hintmedium, and hintfull.
hintslight will make the font more fuzzy to line up to the grid but will be better in retaining font shape,
while hintfull will be a crisp font that aligns well to the pixel grid but will lose a greater amount of font shape.
-->
<edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
<!--
By default, apply antialias to all, filter on the following lines.
Font rasterization converts vector font data to bitmap data so that it can be displayed. The result can appear jagged due to aliasing. anti-aliasing is enabled by default and increases the apparent resolution of font edges.
-->
<edit mode="assign" name="antialias"><bool>true</bool></edit>
</match>
<!-- Default fonts -->
<alias>
<family>serif</family>
<prefer>
<family>Source Serif Pro</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Lato</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Roboto Mono</family>
</prefer>
</alias>
<!--
Replace fonts
https://jichu4n.com/posts/how-to-set-default-fonts-and-font-aliases-on-linux/
-->
<!-- Serif -->
<match>
<test name="family">
<string>Times New Roman</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Source Serif Pro</string>
</edit>
</match>
<match>
<test name="family">
<string>Times</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Source Serif Pro</string>
</edit>
</match>
<match>
<test name="family">
<string>Tinos</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Source Serif Pro</string>
</edit>
</match>
<!-- Monospace -->
<match>
<test name="family">
<string>Courier</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Roboto Mono</string>
</edit>
</match>
<match>
<test name="family">
<string>Courier New</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Roboto Mono</string>
</edit>
</match>
<match>
<test name="family">
<string>Consolas</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Roboto Mono</string>
</edit>
</match>
<match>
<test name="family">
<string>Menlo</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Roboto Mono</string>
</edit>
</match>
<match>
<test name="family">
<string>Monaco</string>
</test>
<edit name="family" mode="assign" binding="strong">
<string>Roboto Mono</string>
</edit>
</match>
</fontconfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment