about summary refs log tree commit diff
path: root/nixpkgs/pkgs/data/fonts/vista-fonts-chs
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/data/fonts/vista-fonts-chs')
-rw-r--r--nixpkgs/pkgs/data/fonts/vista-fonts-chs/default.nix42
-rw-r--r--nixpkgs/pkgs/data/fonts/vista-fonts-chs/no-op.conf9
2 files changed, 51 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/data/fonts/vista-fonts-chs/default.nix b/nixpkgs/pkgs/data/fonts/vista-fonts-chs/default.nix
new file mode 100644
index 000000000000..7c5d9dbba6ea
--- /dev/null
+++ b/nixpkgs/pkgs/data/fonts/vista-fonts-chs/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenvNoCC, fetchurl, cabextract }:
+
+stdenvNoCC.mkDerivation {
+  pname = "vista-fonts-chs";
+  version = "1";
+
+  src = fetchurl {
+    url = "http://web.archive.org/web/20161221192937if_/http://download.microsoft.com/download/d/6/e/d6e2ff26-5821-4f35-a18b-78c963b1535d/VistaFont_CHS.EXE";
+    # Alternative mirror:
+    # http://www.eeo.cn/download/font/VistaFont_CHS.EXE
+    sha256 = "1qwm30b8aq9piyqv07hv8b5bac9ms40rsdf8pwix5dyk8020i8xi";
+  };
+
+  nativeBuildInputs = [ cabextract ];
+
+  unpackPhase = ''
+    cabextract --lowercase --filter '*.TTF' $src
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/fonts/truetype
+    cp *.ttf $out/share/fonts/truetype
+
+    # Set up no-op font configs to override any aliases set up by
+    # other packages.
+    mkdir -p $out/etc/fonts/conf.d
+    substitute ${./no-op.conf} $out/etc/fonts/conf.d/30-msyahei.conf \
+      --subst-var-by fontname "Microsoft YaHei"
+  '';
+
+  meta = {
+    description = "TrueType fonts from Microsoft Windows Vista For Simplified Chinese (Microsoft YaHei)";
+    homepage = "https://www.microsoft.com/typography/fonts/family.aspx?FID=350";
+    license = lib.licenses.unfree;
+    maintainers = [ lib.maintainers.ChengCat ];
+
+    # Set a non-zero priority to allow easy overriding of the
+    # fontconfig configuration files.
+    priority = 5;
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/data/fonts/vista-fonts-chs/no-op.conf b/nixpkgs/pkgs/data/fonts/vista-fonts-chs/no-op.conf
new file mode 100644
index 000000000000..20d1b49d1580
--- /dev/null
+++ b/nixpkgs/pkgs/data/fonts/vista-fonts-chs/no-op.conf
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
+<fontconfig>
+  <!-- This configuation is intentionally left empty in order to
+       override any other font package that may wish to set up an
+       alias for the @fontname@ font. If you actually do
+       want to have the alias then please change the priority of that
+       package; see the Nix manual page for nix-env for details. -->
+</fontconfig>