home/fonts: update fontconfig
This commit is contained in:
parent
54353a4ad9
commit
1cab188b0d
8 changed files with 119 additions and 222 deletions
|
@ -1,10 +1,8 @@
|
|||
{pkgs, ...}: {
|
||||
fonts.fontconfig.enable = true;
|
||||
# Fontconfig
|
||||
xdg.configFile = {
|
||||
"fontconfig" = {
|
||||
source = ./fontconfig;
|
||||
recursive = true;
|
||||
};
|
||||
"fontconfig/fonts.conf".source = ./fonts.conf;
|
||||
|
||||
"fontconfig/conf.d/web-ui-fonts.conf".source = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/lilydjwg/dotconfig/1b22d4f0740bb5bbd7c65b6c468920775171b207/fontconfig/web-ui-fonts.conf";
|
||||
hash = "sha256-A4DcV6HTW/IRxXN3NaI1GUfoFdalwgFLpCjgbWENdZU=";
|
||||
|
@ -15,28 +13,20 @@
|
|||
};
|
||||
};
|
||||
|
||||
gtk.font.name = "Sans";
|
||||
# Make GTK listen to fontconfig
|
||||
dconf.settings = {
|
||||
"org/gnome/desktop/wm/preferences" = {
|
||||
"titlebar-font" = "Sans Bold";
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
"font-name" = "Sans";
|
||||
"document-font-name" = "Sans";
|
||||
"monospace-font-name" = "Monospace";
|
||||
# "font-name" is unneeded
|
||||
# https://github.com/nix-community/home-manager/blob/8765d4e38aa0be53cdeee26f7386173e6c65618d/modules/misc/gtk.nix#L237C19-L237C19
|
||||
};
|
||||
};
|
||||
xresources.properties = {
|
||||
# Fonts
|
||||
"Xft.autohint" = "0";
|
||||
"Xft.lcdfilter" = "lcddefault";
|
||||
"Xft.hintstyle" = "hintslight";
|
||||
"Xft.hinting" = "1";
|
||||
"Xft.antialias" = "1";
|
||||
"Xft.rgba" = "rgb";
|
||||
};
|
||||
|
||||
# HM managed fonts
|
||||
fonts.fontconfig.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
### Inter
|
||||
inter
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
|
||||
<!-- Reject DejaVu Sans -->
|
||||
<!-- why is DejaVu Sans still here after fonts.enableDefaultPackages = false -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern><patelt name="family" ><string>DejaVu Sans</string></patelt></pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
|
||||
</fontconfig>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
|
||||
<!-- Rebind old Chinese fonts -->
|
||||
<!-- Sans -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Zen Hei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Micro Hei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Micro Hei Light</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
|
@ -1,45 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
|
||||
<!-- Adjust font order for Qt applications -->
|
||||
<alias>
|
||||
<family>sans-serif</family>
|
||||
<prefer>
|
||||
<!-- 格拉哥里字母:Ⰽⱁⱀⱄⱅⰰⱀⱅⰹⱀ Ⰹⱍⰹⰳⱁⰲ -->
|
||||
<family>Noto Sans Glagolitic</family>
|
||||
<!-- 爪哇文:꧁ ꧂ -->
|
||||
<family>Noto Sans Javanese</family>
|
||||
<!-- 西夏文:𗷲𗒅 -->
|
||||
<family>Noto Serif Tangut</family>
|
||||
<!-- 埃及象形文字:𓁹 -->
|
||||
<family>Noto Sans Egyptian Hieroglyphs</family>
|
||||
<!-- 苏美尔楔形文字:𒆠𒂗𒂠 -->
|
||||
<family>Noto Sans Cuneiform</family>
|
||||
<!-- 中日韩统一表意文字扩展 C:𫚥 -->
|
||||
<family>HanaMinB</family>
|
||||
<!-- 拉让文:ꥃ -->
|
||||
<family>Noto Sans Rejang</family>
|
||||
<!-- 越南傣文:ꪀꪑ -->
|
||||
<family>Noto Sans Tai Viet</family>
|
||||
<!-- 切罗基文:ꮳꮧꮢ ᨣ -->
|
||||
<family>Noto Sans Cherokee</family>
|
||||
<!-- 老傣仂文:ᨣ -->
|
||||
<family>Noto Sans Tai Tham</family>
|
||||
<!-- 安纳托利亚象形文字:𔘓 -->
|
||||
<family>Noto Sans Anatolian Hieroglyphs</family>
|
||||
<!-- 马姆穆文补充:𖤍 -->
|
||||
<family>Noto Sans Bamum</family>
|
||||
<!-- 图标字体(PUA): -->
|
||||
<family>OperatorMonoSSmLig Nerd Font</family>
|
||||
<!-- 巴塔克文:ᯤ -->
|
||||
<family>Noto Sans Batak</family>
|
||||
<!-- 古北欧文:ᛋᛖᚱᚣᚨᛚᚳᚨᚾᛞᛚᛖ -->
|
||||
<family>Noto Sans Runic</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
</fontconfig>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
|
||||
<!-- Rebind unliked fonts -->
|
||||
<!-- Monospace -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Liberation Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SF Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Noto Sans Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
|
||||
<!-- Rebind Windows fonts -->
|
||||
<!-- Sans -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Microsoft YaHei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimHei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<!-- Serif -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimSun</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimSun-18030</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>serif</string></edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
<description>trash Font Config 3.0</description>
|
||||
|
||||
<!-- Modified version of https://wiki.archlinux.org/title/Font_configuration/Examples#CJK,_but_other_Latin_fonts_are_preferred -->
|
||||
|
||||
<!--
|
||||
(default = true) Use antialias
|
||||
Disable embedded bitmap fonts
|
||||
(default = false) Disable autohint
|
||||
(default = true) Hinting
|
||||
(default = hintslight) Hint style
|
||||
RGBA
|
||||
LCD filter
|
||||
Set DPI
|
||||
-->
|
||||
<match target="font">
|
||||
<!-- <edit mode="assign" name="antialias"> <bool>true</bool></edit> --> <!-- breaks emoji in GTK, unsure why -->
|
||||
<edit mode="assign" name="embeddedbitmap"> <bool>false</bool></edit>
|
||||
<edit mode="assign" name="autohint"> <bool>false</bool></edit>
|
||||
<edit mode="assign" name="hinting"> <bool>true</bool></edit>
|
||||
<edit mode="assign" name="hintstyle"> <const>hintslight</const></edit>
|
||||
<edit mode="assign" name="rgba"> <const>rgb</const></edit>
|
||||
<edit mode="assign" name="lcdfilter"> <const>lcddefault</const></edit>
|
||||
<edit mode="assign" name="dpi"> <double>96</double></edit>
|
||||
</match>
|
||||
|
||||
<!-- Latin font -->
|
||||
<!-- Default serif font -->
|
||||
<alias binding="strong"><family>serif</family>
|
||||
<prefer><family>Source Han Serif SC VF</family></prefer></alias>
|
||||
|
||||
<!-- Default sans-serif font -->
|
||||
<alias binding="strong"><family>sans-serif</family>
|
||||
<prefer><family>Inter</family></prefer></alias>
|
||||
|
||||
<!-- Default monospace font -->
|
||||
<alias binding="strong"><family>monospace</family>
|
||||
<prefer><family>JetBrainsMono Nerd Font</family></prefer></alias>
|
||||
|
||||
<!-- Default system-ui font -->
|
||||
<alias binding="strong"><family>system-ui</family>
|
||||
<prefer><family>Inter</family></prefer></alias>
|
||||
|
||||
|
||||
<!-- CJK -->
|
||||
<!-- Default fonts when the "lang" attribute is not given -->
|
||||
<!-- You can change this font to the language variant you want -->
|
||||
<match target="pattern">
|
||||
<test name="family"><string>serif</string></test>
|
||||
<edit name="family" mode="append" binding="strong"><string>Source Han Serif SC VF</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family"><string>sans-serif</string></test>
|
||||
<edit name="family" mode="append" binding="strong"><string>Source Han Sans SC VF</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family"><string>monospace</string></test>
|
||||
<edit name="family" mode="append" binding="strong"><string>Source Han Sans SC VF</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family"><string>system-ui</string></test>
|
||||
<edit name="family" mode="append" binding="strong"><string>Source Han Sans SC VF</string></edit>
|
||||
</match>
|
||||
|
||||
</fontconfig>
|
112
nixos/profiles/common/graphical/home/fonts/fonts.conf
Normal file
112
nixos/profiles/common/graphical/home/fonts/fonts.conf
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<its:rules version="1.0" xmlns:its="http://www.w3.org/2005/11/its">
|
||||
<its:translateRule selector="/fontconfig/*[not(self::description)]" translate="no"/>
|
||||
</its:rules>
|
||||
<description>trash Font Config 4.0</description>
|
||||
|
||||
<match target="font">
|
||||
<!-- <edit mode="assign" name="antialias"> <bool>true</bool></edit> --> <!-- breaks emoji in GTK, unsure why -->
|
||||
<edit mode="assign" name="hinting"> <bool>true</bool></edit>
|
||||
<edit mode="assign" name="hintstyle"> <const>hintslight</const></edit>
|
||||
<edit mode="assign" name="autohint"> <bool>false</bool></edit>
|
||||
<edit mode="assign" name="embeddedbitmap"> <bool>false</bool></edit>
|
||||
<edit mode="assign" name="lcdfilter"> <const>lcddefault</const></edit>
|
||||
<edit mode="assign" name="rgba"> <const>rgb</const></edit>
|
||||
</match>
|
||||
|
||||
<!-- Default fonts -->
|
||||
<alias binding="strong">
|
||||
<family>serif</family>
|
||||
<prefer>
|
||||
<family>Source Han Serif SC VF</family>
|
||||
<family>Noto Color Emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
<alias binding="strong">
|
||||
<family>sans-serif</family>
|
||||
<prefer>
|
||||
<family>Inter</family>
|
||||
<family>Source Han Sans SC VF</family>
|
||||
<family>Noto Color Emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
<alias binding="strong">
|
||||
<family>monospace</family>
|
||||
<prefer>
|
||||
<family>JetBrainsMono Nerd Font</family>
|
||||
<family>Source Han Sans SC VF</family>
|
||||
<family>Noto Color Emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
<alias binding="strong">
|
||||
<family>system-ui</family>
|
||||
<prefer>
|
||||
<family>Inter</family>
|
||||
<family>Source Han Sans SC VF</family>
|
||||
<family>Noto Color Emoji</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
|
||||
|
||||
<!-- Rebind unliked/old fonts -->
|
||||
<!-- Sans -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Microsoft YaHei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimHei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Zen Hei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Micro Hei</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>WenQuanYi Micro Hei Light</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>sans-serif</string></edit>
|
||||
</match>
|
||||
|
||||
<!-- Serif -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimSun</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>serif</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SimSun-18030</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>serif</string></edit>
|
||||
</match>
|
||||
|
||||
<!-- Monospace -->
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Liberation Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>SF Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
<match target="pattern">
|
||||
<test name="family" qual="any"><string>Noto Sans Mono</string></test>
|
||||
<edit name="family" binding="same" mode="assign"><string>monospace</string></edit>
|
||||
</match>
|
||||
|
||||
<!-- Reject DejaVu Sans -->
|
||||
<!-- why is DejaVu Sans still here after fonts.enableDefaultPackages = false -->
|
||||
<selectfont>
|
||||
<rejectfont>
|
||||
<pattern><patelt name="family" ><string>DejaVu Sans</string></patelt></pattern>
|
||||
</rejectfont>
|
||||
</selectfont>
|
||||
|
||||
</fontconfig>
|
Loading…
Reference in a new issue