fontconfig: add options for font rendering

This commit is contained in:
Benedikt Rips 2025-08-04 08:02:28 +02:00 committed by Austin Horstman
parent 672381a34e
commit 74b4edc2d2
4 changed files with 128 additions and 0 deletions

View file

@ -0,0 +1,47 @@
{
fonts.fontconfig = {
enable = true;
antialiasing = false;
hinting = "none";
subpixelRendering = "vertical-bgr";
};
nmt.script =
let
configFile = "home-files/.config/fontconfig/conf.d/10-hm-rendering.conf";
in
''
assertFileExists ${configFile}
assertFileContent ${configFile} ${builtins.toFile "rendering.conf" ''
<?xml version='1.0'?>
<!-- Generated by Home Manager. -->
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<description>Set the rendering mode</description>
<match target="font">
<edit mode="assign" name="antialias">
<bool>false</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintnone</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="rgba">
<const>vbgr</const>
</edit>
</match>
</fontconfig>
''}
'';
}

View file

@ -0,0 +1,7 @@
{
fonts.fontconfig.enable = true;
nmt.script = ''
assertPathNotExists home-files/.config/fontconfig/conf.d/10-hm-rendering.conf
'';
}

View file

@ -19,4 +19,7 @@
# /nix/store/da…g5-home-manager-path/lib/fontconfig/cache: invalid cache file: 786068e7df13f7c2105017ef3d78e351-x86_64.cache-7
# /nix/store/da…g5-home-manager-path/lib/fontconfig/cache: invalid cache file: 4766193978ddda4bd196f2b98c00fb00-x86_64.cache-7
#fontconfig-multiple-font-packages = ./multiple-font-packages.nix;
fontconfig-default-rendering = ./default-rendering.nix;
fontconfig-custom-rendering = ./custom-rendering.nix;
}