about summary refs log tree commit diff
path: root/pkgs/data/fonts
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2020-02-29 15:29:11 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2020-02-29 15:29:11 +0100
commit79217339d26ff51ccacf10967de700d785f088e5 (patch)
treea3fd63289448ed29c4ce387fa883e57f8ce55273 /pkgs/data/fonts
parentbb701376cf3d7d1ffe65b31dc6a1c46dd80a673b (diff)
parentcf6477076b4ea05e9dcf1e6dda565604076ec6d8 (diff)
downloadnixlib-79217339d26ff51ccacf10967de700d785f088e5.tar
nixlib-79217339d26ff51ccacf10967de700d785f088e5.tar.gz
nixlib-79217339d26ff51ccacf10967de700d785f088e5.tar.bz2
nixlib-79217339d26ff51ccacf10967de700d785f088e5.tar.lz
nixlib-79217339d26ff51ccacf10967de700d785f088e5.tar.xz
nixlib-79217339d26ff51ccacf10967de700d785f088e5.tar.zst
nixlib-79217339d26ff51ccacf10967de700d785f088e5.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/data/fonts')
-rw-r--r--pkgs/data/fonts/gdouros/default.nix9
-rw-r--r--pkgs/data/fonts/noto-fonts/default.nix101
-rw-r--r--pkgs/data/fonts/source-han-sans/default.nix52
-rw-r--r--pkgs/data/fonts/source-han-serif/default.nix52
-rw-r--r--pkgs/data/fonts/source-han/default.nix54
5 files changed, 119 insertions, 149 deletions
diff --git a/pkgs/data/fonts/gdouros/default.nix b/pkgs/data/fonts/gdouros/default.nix
index 71c92a72e593..afe73aa1caf1 100644
--- a/pkgs/data/fonts/gdouros/default.nix
+++ b/pkgs/data/fonts/gdouros/default.nix
@@ -26,10 +26,11 @@ let
 
     meta = {
       inherit description;
-      # In lieu of a license:
-      # Fonts in this site are offered free for any use;
-      # they may be installed, embedded, opened, edited, modified, regenerated, posted, packaged and redistributed.
-      license = lib.licenses.free;
+      # see http://users.teilar.gr/~g1951d/License.pdf
+      # quite draconian: non-commercial, no modifications,
+      # no redistribution, "a single instantiation and no
+      # network installation"
+      license = lib.licenses.unfree;
       homepage = http://users.teilar.gr/~g1951d/;
     };
   };
diff --git a/pkgs/data/fonts/noto-fonts/default.nix b/pkgs/data/fonts/noto-fonts/default.nix
index 04e8e581b634..9681bb50efac 100644
--- a/pkgs/data/fonts/noto-fonts/default.nix
+++ b/pkgs/data/fonts/noto-fonts/default.nix
@@ -1,28 +1,44 @@
-{ stdenv, fetchzip, fetchFromGitHub, optipng, cairo, python3Packages, pkgconfig, pngquant, which, imagemagick }:
+{ stdenv
+, stdenvNoCC
+, lib
+, fetchFromGitHub
+, fetchzip
+, optipng
+, cairo
+, python3Packages
+, pkgconfig
+, pngquant
+, which
+, imagemagick
+}:
 
 let
-  mkNoto = { name, weights, sha256, }:
-    let
-      version = "2018-11-30";
-      ref = "85e78f831469323c85847e23f95026c894159135";
-    in
-    fetchzip {
-      name = "${name}-${version}";
-      inherit sha256;
-      url = "https://github.com/googlei18n/noto-fonts/archive/${ref}.zip";
-      postFetch = ''
-        unzip $downloadedFile
-        mkdir -p $out/share/fonts/noto
-        # Also copy unhinted & alpha fonts for better glyph coverage,
-        # if they don't have a hinted version
-        # (see https://groups.google.com/d/msg/noto-font/ZJSkZta4n5Y/tZBnLcPdbS0J)
-        for ttf in noto-fonts-*/{hinted,unhinted,alpha}/*-${weights}.ttf
-        do
-            cp -n "$ttf" -t "$out/share/fonts/noto"
-        done
+  mkNoto = { pname, weights }:
+    stdenvNoCC.mkDerivation {
+      inherit pname;
+      version = "2020-01-23";
+
+      src = fetchFromGitHub {
+        owner = "googlefonts";
+        repo = "noto-fonts";
+        rev = "f4726a2ec36169abd02a6d8abe67c8ff0236f6d8";
+        sha256 = "0zc1r7zph62qmvzxqfflsprazjf6x1qnwc2ma27kyzh6v36gaykw";
+      };
+
+      installPhase = ''
+        # We copy in reverse preference order -- unhinted first, then
+        # hinted -- to get the "best" version of each font while
+        # maintaining maximum coverage.
+        #
+        # TODO: install OpenType, variable versions?
+        local out_ttf=$out/share/fonts/truetype/noto
+        install -m444 -Dt $out_ttf phaseIII_only/unhinted/ttf/*/*-${weights}.ttf
+        install -m444 -Dt $out_ttf phaseIII_only/hinted/ttf/*/*-${weights}.ttf
+        install -m444 -Dt $out_ttf unhinted/*/*-${weights}.ttf
+        install -m444 -Dt $out_ttf hinted/*/*-${weights}.ttf
       '';
-      meta = with stdenv.lib; {
-        inherit version;
+
+      meta = with lib; {
         description = "Beautiful and free fonts for many languages";
         homepage = https://www.google.com/get/noto/;
         longDescription =
@@ -39,37 +55,39 @@ let
 
           This package also includes the Arimo, Cousine, and Tinos fonts.
         '';
-        license = licenses.asl20;
+        license = licenses.ofl;
         platforms = platforms.all;
-        maintainers = with maintainers; [ mathnerd314 ];
+        maintainers = with maintainers; [ mathnerd314 emily ];
       };
     };
 in
 
 {
   noto-fonts = mkNoto {
-    name = "noto-fonts";
+    pname = "noto-fonts";
     weights = "{Regular,Bold,Light,Italic,BoldItalic,LightItalic}";
-    sha256 = "0kvq5ldip2ra2njlxg9fxj46nfqzq5l3n359d3kwfbsld7hixm2d";
   };
+
   noto-fonts-extra = mkNoto {
-    name = "noto-fonts-extra";
+    pname = "noto-fonts-extra";
     weights = "{Black,Condensed,Extra,Medium,Semi,Thin}*";
-    sha256 = "0l94aiy1b3qirg2mmbagbr0014vqk32za79pzck1acy2hgy716kq";
   };
-  noto-fonts-cjk = let version = "1.004"; in fetchzip {
-    name = "noto-fonts-cjk-${version}";
-
-    # Same as https://noto-website.storage.googleapis.com/pkgs/NotoSansCJK.ttc.zip but versioned & with no extra SIL license file
-    url = "https://raw.githubusercontent.com/googlei18n/noto-cjk/40d9f5b179a59a06b98373c76bdc3e2119e4e6b2/NotoSansCJK.ttc.zip";
-    postFetch = ''
-      mkdir -p $out/share/fonts
-      unzip -j $downloadedFile \*.ttc -d $out/share/fonts/noto
+
+  noto-fonts-cjk = let zip = fetchzip {
+    url = let rev = "be6c059ac1587e556e2412b27f5155c8eb3ddbe6"; in
+      "https://raw.githubusercontent.com/googlefonts/noto-cjk/${rev}/NotoSansCJK.ttc.zip";
+    # __MACOSX...
+    stripRoot = false;
+    sha256 = "0ik4z2b15i0pghskgfm3adzb0h35fr4gyzvz3bq49hhkhn9h85vi";
+  }; in stdenvNoCC.mkDerivation {
+    pname = "noto-fonts-cjk";
+    version = "2.001";
+
+    buildCommand = ''
+      install -m444 -Dt $out/share/fonts/opentype/noto-cjk ${zip}/*.ttc
     '';
-    sha256 = "0ghw2azqq3nkcxsbvf53qjmrhcfsnry79rq7jsr0wwi2pn7d3dsq";
 
-    meta = with stdenv.lib; {
-      inherit version;
+    meta = with lib; {
       description = "Beautiful and free fonts for CJK languages";
       homepage = https://www.google.com/get/noto/help/cjk/;
       longDescription =
@@ -86,9 +104,10 @@ in
       '';
       license = licenses.ofl;
       platforms = platforms.all;
-      maintainers = with maintainers; [ mathnerd314 ];
+      maintainers = with maintainers; [ mathnerd314 emily ];
     };
   };
+
   noto-fonts-emoji = let
     version = "unstable-2019-10-22";
   in stdenv.mkDerivation {
@@ -118,7 +137,7 @@ in
       cp NotoColorEmoji.ttf fonts/NotoEmoji-Regular.ttf $out/share/fonts/noto
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       inherit version;
       description = "Color and Black-and-White emoji fonts";
       homepage = https://github.com/googlei18n/noto-emoji;
diff --git a/pkgs/data/fonts/source-han-sans/default.nix b/pkgs/data/fonts/source-han-sans/default.nix
deleted file mode 100644
index 87e24c0e23c3..000000000000
--- a/pkgs/data/fonts/source-han-sans/default.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ lib, fetchzip }:
-
-let
-  makePackage = {variant, language, region, sha256}: let
-    version = "1.004R";
-    revision = "5f5311e71cb628321cc0cffb51fb38d862b726aa";
-  in fetchzip {
-    name = "source-han-sans-${variant}-${version}";
-
-    url = "https://github.com/adobe-fonts/source-han-sans/raw/${revision}/SubsetOTF/SourceHanSans${region}.zip";
-
-    postFetch = ''
-      mkdir -p $out/share/fonts
-      unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
-    '';
-
-    inherit sha256;
-
-    meta = {
-      description = "${language} subset of an open source Pan-CJK sans-serif typeface";
-      homepage = https://github.com/adobe-fonts/source-han-sans;
-      license = lib.licenses.ofl;
-      maintainers = with lib.maintainers; [ taku0 ];
-    };
-  };
-in
-{
-  japanese = makePackage {
-    variant = "japanese";
-    language = "Japanese";
-    region = "JP";
-    sha256 = "194zapswaqly8ycx3k66vznlapvpyhdigp3sabsl4hn87j9xsc5v";
-  };
-  korean = makePackage {
-    variant = "korean";
-    language = "Korean";
-    region = "KR";
-    sha256 = "0xij6mciiqgpwv1agqily2jji377x084k7fj4rpv6z0r5vvhqr08";
-  };
-  simplified-chinese = makePackage {
-    variant = "simplified-chinese";
-    language = "Simplified Chinese";
-    region = "CN";
-    sha256 = "038av18d45qr85bgx95j2fm8j64d72nsm9xzg0lpwr9xwni2sbx0";
-  };
-  traditional-chinese = makePackage {
-    variant = "traditional-chinese";
-    language = "Traditional Chinese";
-    region = "TW";
-    sha256 = "1mzcv5hksyxplyv5q3w5nr1xz73hdnvip5gicz35j0by4gc739lr";
-  };
-}
diff --git a/pkgs/data/fonts/source-han-serif/default.nix b/pkgs/data/fonts/source-han-serif/default.nix
deleted file mode 100644
index bb5a67c83068..000000000000
--- a/pkgs/data/fonts/source-han-serif/default.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ lib, fetchzip }:
-
-let
-  makePackage = {variant, language, region, sha256}: let
-    version = "1.000R";
-    revision = "f6cf97d92b22e7bd77e355a61fe549ae44b6de76";
-  in fetchzip {
-    name = "source-han-serif-${variant}-${version}";
-
-    url = "https://github.com/adobe-fonts/source-han-serif/raw/${revision}/SubsetOTF/SourceHanSerif${region}.zip";
-
-    postFetch = ''
-      mkdir -p $out/share/fonts/opentype
-      unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype
-    '';
-
-    inherit sha256;
-
-    meta = {
-      description = "${language} subset of an open source Pan-CJK serif typeface";
-      homepage = https://github.com/adobe-fonts/source-han-sans;
-      license = lib.licenses.ofl;
-      maintainers = with lib.maintainers; [ taku0 ];
-    };
-  };
-in
-{
-  japanese = makePackage {
-    variant = "japanese";
-    language = "Japanese";
-    region = "JP";
-    sha256 = "0cklcy6y3r7pg8z43fzd8zl5g46bkqa1iy0li49rm0fgdaw7kin2";
-  };
-  korean = makePackage {
-    variant = "korean";
-    language = "Korean";
-    region = "KR";
-    sha256 = "0lxrr978djsych8fmbl57n1c9c7ihl61w0b9q4plw27vd6p41fza";
-  };
-  simplified-chinese = makePackage {
-    variant = "simplified-chinese";
-    language = "Simplified Chinese";
-    region = "CN";
-    sha256 = "0k3x4kncjnbipf4i3lkk6b33zpf1ckp5648z51v48q47l3zqpm6p";
-  };
-  traditional-chinese = makePackage {
-    variant = "traditional-chinese";
-    language = "Traditional Chinese";
-    region = "TW";
-    sha256 = "00bi66nlkrargmmf4av24qfd716py7a9smcvr4xnll7fffldxv06";
-  };
-}
diff --git a/pkgs/data/fonts/source-han/default.nix b/pkgs/data/fonts/source-han/default.nix
new file mode 100644
index 000000000000..7b6bef0198da
--- /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";
+  };
+}