Add no-op fontconfig files for Microsoft fonts.

With these fontconfig files it becomes possible for other packages to
configure font aliases for the Microsoft fonts. If both, for example,
vista-fonts and some package providing an alias for Cambria are
installed then the user may control whether or not the alias is active
by manipulating the package priorities.

+53 -6
+19 -3
pkgs/data/fonts/corefonts/default.nix
··· 34 34 35 35 buildInputs = [cabextract]; 36 36 37 - buildCommand = " 37 + buildCommand = '' 38 38 for i in $exes; do 39 39 cabextract --lowercase $i 40 40 done 41 41 42 42 cabextract --lowercase viewer1.cab 43 - 43 + 44 44 fontDir=$out/share/fonts/truetype 45 45 mkdir -p $fontDir 46 46 cp *.ttf $fontDir 47 47 48 48 # Also put the EULA there to be on the safe side. 49 49 cp ${eula} $fontDir/eula.html 50 - "; 50 + 51 + # Set up no-op font configs to override any aliases set up by 52 + # other packages. 53 + mkdir -p $out/etc/fonts/conf.d 54 + for name in Andale-Mono Arial-Black Arial Comic-Sans-MS \ 55 + Courier-New Georgia Impact Times-New-Roman \ 56 + Trebuchet Verdana Webdings ; do 57 + substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-''${name,,}.conf \ 58 + --subst-var-by fontname "''${name//-/ }" 59 + done 60 + ''; 61 + 62 + meta = { 63 + # Set a non-zero priority to allow easy overriding of the 64 + # fontconfig configuration files. 65 + priority = 5; 66 + }; 51 67 }
+9
pkgs/data/fonts/corefonts/no-op.conf
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 3 + <fontconfig> 4 + <!-- This configuation is intentionally left empty in order to 5 + override any other font package that may wish to set up an 6 + alias for the Microsoft @fontname@ font. If you actually do 7 + want to have the alias then please change the priority of that 8 + package; see the Nix manual page for nix-env for details. --> 9 + </fontconfig>
+16 -3
pkgs/data/fonts/vista-fonts/default.nix
··· 18 18 19 19 buildPhase = "true"; 20 20 21 - installPhase = " 22 - mkdir -p $out/share/fonts/truetype; cp *.ttf $out/share/fonts/truetype 23 - "; 21 + installPhase = '' 22 + mkdir -p $out/share/fonts/truetype 23 + cp *.ttf $out/share/fonts/truetype 24 + 25 + # Set up no-op font configs to override any aliases set up by 26 + # other packages. 27 + mkdir -p $out/etc/fonts/conf.d 28 + for name in Calibri Cambria Candara Consolas Constantia Corbel ; do 29 + substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-''${name,,}.conf \ 30 + --subst-var-by fontname $name 31 + done 32 + ''; 24 33 25 34 meta = { 26 35 description = "Some TrueType fonts from Microsoft Windows Vista (Calibri, Cambria, Candara, Consolas, Constantia, Corbel)"; 27 36 homepage = http://www.microsoft.com/typography/ClearTypeFonts.mspx; 28 37 binaryDistribution = false; # haven't read the EULA, but we probably can't redistribute these files, so... 38 + 39 + # Set a non-zero priority to allow easy overriding of the 40 + # fontconfig configuration files. 41 + priority = 5; 29 42 }; 30 43 }
+9
pkgs/data/fonts/vista-fonts/no-op.conf
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 3 + <fontconfig> 4 + <!-- This configuation is intentionally left empty in order to 5 + override any other font package that may wish to set up an 6 + alias for the Microsoft @fontname@ font. If you actually do 7 + want to have the alias then please change the priority of that 8 + package; see the Nix manual page for nix-env for details. --> 9 + </fontconfig>