fonts: tell websites inter is a ui font

This commit is contained in:
Artemis Tosini 2024-02-25 00:47:04 +00:00
parent f38be57cac
commit 029dc5d1eb
Signed by: artemist
SSH key fingerprint: SHA256:EsuWCwx6fjxxExxf65rX+ocQJJAdw4R1KarpFue6Uwc

View file

@ -1,12 +1,56 @@
{ pkgs, inputs, ... }: { pkgs, ... }:
{ {
fonts = { fonts = {
fontconfig.enable = true; fontconfig = {
fontconfig.localConf = '' enable = true;
defaultFonts = {
sansSerif = [ "Inter" ];
# Not really compatible with inter but i'm used to it
monospace = [ "Fira Code" ];
serif = [ "DejaVu Serif" ];
emoji = [ "Noto Color Emoji" "Noto Emoji" ];
};
localConf = ''
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <fontconfig>
<!-- For some reason websites really want ui font instead of default -->
<match target="pattern">
<test qual="any" name="family">
<string>ui-monospace</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>monospace</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>system-ui</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>BlinkMacSystemFont</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>-apple-system</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>
<match target="font"> <match target="font">
<test name="family"> <test name="family">
<string>Inter</string> <string>Inter</string>
@ -29,6 +73,7 @@
</match> </match>
</fontconfig> </fontconfig>
''; '';
};
enableDefaultPackages = true; enableDefaultPackages = true;
packages = with pkgs; packages = with pkgs;