vanadium: implement conditional fontsize in fontconfig

This commit is contained in:
Primrose 2026-01-23 02:09:23 +01:00
parent e08afde62f
commit ae75eae20f
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -17,6 +17,46 @@
monospace = [ "IosevkaPTMono" ];
emoji = [ "Noto Color Emoji" ];
};
configFile = {
thick-iosevka = {
enable = true;
# https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
# https://gist.github.com/yuttie/adb22a6c07ef8e75d82e48d5484b7ad8
# https://github.com/N1k3YB/CS2FontChanger_ru/blob/5f1d8189220f42286d773c536ff83a49b2556da2/app.py#L227
#
# Use the following script to test
# for size in (seq 9 15)
# echo
# echo
# for weight in {regular,medium,bold}
# echo "weight=$weight:size=$size"
# fc-match "mono:weight=$weight:size=$size"
# end
# end | less
text = /* xml */ ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family" compare="contains"><string>Iosevka</string></test>
<edit name="weight" mode="assign" binding="strong">
<if> <eq><name>weight</name><const>bold</const></eq> <!-- then --> <const>bold</const>
<if> <eq><name>weight</name><const>medium</const></eq> <!-- then --> <const>medium</const>
<!-- not bold nor medium -->
<if> <more><name>size</name><double>15</double></more> <!-- then --> <const>regular</const>
<if> <more><name>size</name><double>10</double></more> <!-- then --> <const>medium</const>
<!-- else --> <const>bold</const>
</if>
</if>
</if>
</if>
</edit>
</match>
</fontconfig>
'';
};
};
};
home.packages = [
pkgs.noto-fonts