Skip to content

Instantly share code, notes, and snippets.

@mertcanekiz
Created October 4, 2015 07:31
Show Gist options
  • Save mertcanekiz/2044abae0388e6fb7383 to your computer and use it in GitHub Desktop.
Save mertcanekiz/2044abae0388e6fb7383 to your computer and use it in GitHub Desktop.
Mac-like font rendering for Linux
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
<bool>false</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="lcdfilter">
<const>lcddefault</const>
</edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>
@gxanshu
Copy link

gxanshu commented Jul 20, 2025

where to put this fonts.conf ?

@x7dl8p
Copy link

x7dl8p commented Aug 13, 2025

where to put this fonts.conf ?

bro, he uploaded it 10 years ago, i dont think he will reply,

check this out https://youtu.be/CPgMbyFI-88?si=GSt7HGoBSpy1B0gE

@x7dl8p
Copy link

x7dl8p commented Aug 13, 2025

the same thing can be expressed in a minimal, modern ~/.config/fontconfig/fonts.conf like this:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias"><bool>true</bool></edit>
    <edit name="hinting"><bool>false</bool></edit>
    <edit name="rgba"><const>rgb</const></edit>
    <edit name="lcdfilter"><const>lcddefault</const></edit>
  </match>
</fontconfig>

Differences from yours:

  • Removed duplicate <match> blocks (one block is enough).
  • Dropped hintstyle (irrelevant if hinting is off).
  • Removed old <dir>~/.fonts</dir> (nowadays ~/.local/share/fonts is auto-scanned).
  • Uses modern Fontconfig directory (~/.config/fontconfig/fonts.conf).

If you drop this file in ~/.config/fontconfig/fonts.conf and run:

fc-cache -fv

it’ll apply system-wide for your user.

-- chatgpt 5

@nektro
Copy link

nektro commented Aug 15, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment