summary refs log tree commit diff
path: root/pkgs/data/fonts/source-han
diff options
context:
space:
mode:
authorEmily <vcs@emily.moe>2020-02-10 22:59:42 +0000
committerYegor Timoshenko <yegortimoshenko@riseup.net>2020-02-29 14:57:27 +0300
commit6eb45bf38ac122a242be8bce2b9868ac72a6e0cc (patch)
treefa6f911fef7395f98101b00444d46ad7e82c6ac6 /pkgs/data/fonts/source-han
parentc580dfc0cee3a201521df41ce4c8adbdecd971c0 (diff)
downloadnixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar.gz
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar.bz2
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar.lz
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar.xz
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.tar.zst
nixpkgs-6eb45bf38ac122a242be8bce2b9868ac72a6e0cc.zip
source-han-{sans,serif,mono}: {update,refactor,init}
* source-han-sans: 1.004R -> 2.001
* source-han-serif: switch to Super OTC
* source-han-mono: init at 1.002

The Source Han fonts now use shared package infrastructure, and the
Super OTC distributions, which unify the various scripts into a single
bundle file, improving automatic font selection and reducing overall
disk space usage. This also means that the Traditional
Chinese—Hong Kong language variant is now included.

The old package names including language are aliased to the Super OTC
bundle packages.
Diffstat (limited to 'pkgs/data/fonts/source-han')
-rw-r--r--pkgs/data/fonts/source-han/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/data/fonts/source-han/default.nix b/pkgs/data/fonts/source-han/default.nix
new file mode 100644
index 00000000000..7b6bef0198d
--- /dev/null
+++ b/pkgs/data/fonts/source-han/default.nix
@@ -0,0 +1,54 @@
+{ stdenvNoCC
+, lib
+, fetchzip
+, fetchurl
+}:
+
+let
+  makePackage = { family, description, rev, sha256 }: let
+    Family =
+      lib.toUpper (lib.substring 0 1 family) +
+      lib.substring 1 (lib.stringLength family) family;
+
+    ttc = fetchurl {
+      url = "https://github.com/adobe-fonts/source-han-${family}/releases/download/${rev}/SourceHan${Family}.ttc";
+      inherit sha256;
+    };
+  in stdenvNoCC.mkDerivation {
+    pname = "source-han-${family}";
+    version = lib.removeSuffix "R" rev;
+
+    buildCommand = ''
+      install -m444 -Dt $out/share/fonts/opentype/source-han-${family} ${ttc}
+    '';
+
+    meta = {
+      description = "An open source Pan-CJK ${description} typeface";
+      homepage = "https://github.com/adobe-fonts/source-han-${family}";
+      license = lib.licenses.ofl;
+      maintainers = with lib.maintainers; [ taku0 emily ];
+    };
+  };
+in
+{
+  sans = makePackage {
+    family = "sans";
+    description = "sans-serif";
+    rev = "2.001R";
+    sha256 = "101p8q0sagf1sd1yzwdrmmxvkqq7j0b8hi0ywsfck9w56r4zx54y";
+  };
+
+  serif = makePackage {
+    family = "serif";
+    description = "serif";
+    rev = "1.001R";
+    sha256 = "1d968h30qvvwy3s77m9y3f1glq8zlr6bnfw00yinqa18l97n7k45";
+  };
+
+  mono = makePackage {
+    family = "mono";
+    description = "monospaced";
+    rev = "1.002";
+    sha256 = "1haqffkcgz0cc24y8rc9bg36v8x9hdl8fdl3xc8qz14hvr42868c";
+  };
+}