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`.

+20 -11
+20 -11
nixos/modules/config/fonts/fontconfig.nix
··· 142 142 config = 143 143 let fontconfig = config.fonts.fontconfig; 144 144 fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>"; 145 - nixosConf = '' 145 + renderConf = '' 146 146 <?xml version='1.0'?> 147 147 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 148 148 <fontconfig> ··· 169 169 </edit> 170 170 </match> 171 171 172 + ${optionalString (fontconfig.dpi != 0) '' 173 + <match target="pattern"> 174 + <edit name="dpi" mode="assign"> 175 + <double>${toString fontconfig.dpi}</double> 176 + </edit> 177 + </match> 178 + ''} 179 + 180 + </fontconfig> 181 + ''; 182 + genericAliasConf = '' 183 + <?xml version='1.0'?> 184 + <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 185 + <fontconfig> 186 + 172 187 <!-- Default fonts --> 173 188 ${optionalString (fontconfig.defaultFonts.sansSerif != []) '' 174 189 <alias> ··· 201 216 </alias> 202 217 ''} 203 218 204 - ${optionalString (fontconfig.dpi != 0) '' 205 - <match target="pattern"> 206 - <edit name="dpi" mode="assign"> 207 - <double>${toString fontconfig.dpi}</double> 208 - </edit> 209 - </match> 210 - ''} 211 - 212 219 </fontconfig> 213 220 ''; 214 221 in mkIf fontconfig.enable { ··· 219 226 environment.etc."fonts/fonts.conf".source = 220 227 pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; }; 221 228 222 - environment.etc."fonts/conf.d/98-nixos.conf".text = nixosConf; 229 + environment.etc."fonts/conf.d/10-nixos-rendering.conf".text = renderConf; 230 + environment.etc."fonts/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf; 223 231 224 232 # Versioned fontconfig > 2.10. Take shared fonts.conf from fontconfig. 225 233 # Otherwise specify only font directories. ··· 236 244 </fontconfig> 237 245 ''; 238 246 239 - environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/98-nixos.conf".text = nixosConf; 247 + environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/10-nixos-rendering.conf".text = renderConf; 248 + environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/60-nixos-generic-alias.conf".text = genericAliasConf; 240 249 241 250 environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/99-user.conf" = { 242 251 enable = fontconfig.includeUserConf;