nixos/fontconfig: separate rendering and alias configuration
Fixes #9110. Fontconfig recommends different precedence for rendering settings and generic alias settings. To comply with the recommendations, `98-nixos.conf` has been separated into `10-nixos-rendering.conf` and `60-nixos-generic-alias.conf`.
This commit is contained in:
parent
47dad51c2b
commit
ba59ff2160
|
@ -142,7 +142,7 @@ with lib;
|
||||||
config =
|
config =
|
||||||
let fontconfig = config.fonts.fontconfig;
|
let fontconfig = config.fonts.fontconfig;
|
||||||
fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
|
fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
|
||||||
nixosConf = ''
|
renderConf = ''
|
||||||
<?xml version='1.0'?>
|
<?xml version='1.0'?>
|
||||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||||
<fontconfig>
|
<fontconfig>
|
||||||
|
@ -169,6 +169,21 @@ with lib;
|
||||||
</edit>
|
</edit>
|
||||||
</match>
|
</match>
|
||||||
|
|
||||||
|
${optionalString (fontconfig.dpi != 0) ''
|
||||||
|
<match target="pattern">
|
||||||
|
<edit name="dpi" mode="assign">
|
||||||
|
<double>${toString fontconfig.dpi}</double>
|
||||||
|
</edit>
|
||||||
|
</match>
|
||||||
|
''}
|
||||||
|
|
||||||
|
</fontconfig>
|
||||||
|
'';
|
||||||
|
genericAliasConf = ''
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||||
|
<fontconfig>
|
||||||
|
|
||||||
<!-- Default fonts -->
|
<!-- Default fonts -->
|
||||||
${optionalString (fontconfig.defaultFonts.sansSerif != []) ''
|
${optionalString (fontconfig.defaultFonts.sansSerif != []) ''
|
||||||
<alias>
|
<alias>
|
||||||
|
@ -201,14 +216,6 @@ with lib;
|
||||||
</alias>
|
</alias>
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (fontconfig.dpi != 0) ''
|
|
||||||
<match target="pattern">
|
|
||||||
<edit name="dpi" mode="assign">
|
|
||||||
<double>${toString fontconfig.dpi}</double>
|
|
||||||
</edit>
|
|
||||||
</match>
|
|
||||||
''}
|
|
||||||
|
|
||||||
</fontconfig>
|
</fontconfig>
|
||||||
'';
|
'';
|
||||||
in mkIf fontconfig.enable {
|
in mkIf fontconfig.enable {
|
||||||
|
@ -219,7 +226,8 @@ with lib;
|
||||||
environment.etc."fonts/fonts.conf".source =
|
environment.etc."fonts/fonts.conf".source =
|
||||||
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
|
pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
|
||||||
|
|
||||||
environment.etc."fonts/conf.d/98-nixos.conf".text = nixosConf;
|
environment.etc."fonts/conf.d/10-nixos-rendering.conf".text = renderConf;
|
||||||
|
environment.etc."fonts/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf;
|
||||||
|
|
||||||
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
|
# Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig.
|
||||||
# Otherwise specify only font directories.
|
# Otherwise specify only font directories.
|
||||||
|
@ -236,7 +244,8 @@ with lib;
|
||||||
</fontconfig>
|
</fontconfig>
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/98-nixos.conf".text = nixosConf;
|
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/10-nixos-rendering.conf".text = renderConf;
|
||||||
|
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf;
|
||||||
|
|
||||||
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = {
|
environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = {
|
||||||
enable = fontconfig.includeUserConf;
|
enable = fontconfig.includeUserConf;
|
||||||
|
|
Loading…
Reference in a new issue