From 6eb45bf38ac122a242be8bce2b9868ac72a6e0cc Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 10 Feb 2020 22:59:42 +0000 Subject: [PATCH] source-han-{sans,serif,mono}: {update,refactor,init} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- pkgs/data/fonts/source-han-sans/default.nix | 52 ------------------- pkgs/data/fonts/source-han-serif/default.nix | 52 ------------------- pkgs/data/fonts/source-han/default.nix | 54 ++++++++++++++++++++ pkgs/top-level/aliases.nix | 23 +++++++++ pkgs/top-level/all-packages.nix | 14 ++--- 5 files changed, 81 insertions(+), 114 deletions(-) delete mode 100644 pkgs/data/fonts/source-han-sans/default.nix delete mode 100644 pkgs/data/fonts/source-han-serif/default.nix create mode 100644 pkgs/data/fonts/source-han/default.nix 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"; + }; +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 7a7139cb3ceb..3a504f20d944 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -425,6 +425,29 @@ mapAliases ({ slim = throw "slim has been removed. Please use a different display-manager"; # added 2019-11-11 slimThemes = throw "slimThemes has been removed because slim has been also"; # added 2019-11-11 sundials_3 = throw "removed 2020-02. outdated and no longer needed"; + + # added 2020-02-10 + sourceHanSansPackages = { + japanese = source-han-sans; + korean = source-han-sans; + simplified-chinese = source-han-sans; + traditional-chinese = source-han-sans; + }; + source-han-sans-japanese = source-han-sans; + source-han-sans-korean = source-han-sans; + source-han-sans-simplified-chinese = source-han-sans; + source-han-sans-traditional-chinese = source-han-sans; + sourceHanSerifPackages = { + japanese = source-han-serif; + korean = source-han-serif; + simplified-chinese = source-han-serif; + traditional-chinese = source-han-serif; + }; + source-han-serif-japanese = source-han-serif; + source-han-serif-korean = source-han-serif; + source-han-serif-simplified-chinese = source-han-serif; + source-han-serif-traditional-chinese = source-han-serif; + net_snmp = net-snmp; # added 2019-12-21 spaceOrbit = space-orbit; # addewd 2016-05-23 speech_tools = speech-tools; # added 2018-04-25 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b40eb6db6b5c..6e02b42d95a7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18010,16 +18010,10 @@ in source-han-code-jp = callPackage ../data/fonts/source-han-code-jp { }; - sourceHanSansPackages = dontRecurseIntoAttrs (callPackage ../data/fonts/source-han-sans { }); - source-han-sans-japanese = sourceHanSansPackages.japanese; - source-han-sans-korean = sourceHanSansPackages.korean; - source-han-sans-simplified-chinese = sourceHanSansPackages.simplified-chinese; - source-han-sans-traditional-chinese = sourceHanSansPackages.traditional-chinese; - sourceHanSerifPackages = dontRecurseIntoAttrs (callPackage ../data/fonts/source-han-serif { }); - source-han-serif-japanese = sourceHanSerifPackages.japanese; - source-han-serif-korean = sourceHanSerifPackages.korean; - source-han-serif-simplified-chinese = sourceHanSerifPackages.simplified-chinese; - source-han-serif-traditional-chinese = sourceHanSerifPackages.traditional-chinese; + sourceHanPackages = dontRecurseIntoAttrs (callPackage ../data/fonts/source-han { }); + source-han-sans = sourceHanPackages.sans; + source-han-serif = sourceHanPackages.serif; + source-han-mono = sourceHanPackages.mono; spleen = callPackage ../data/fonts/spleen { inherit (buildPackages.xorg) mkfontscale; };