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.
This commit is contained in:
Emily 2020-02-10 22:59:42 +00:00 committed by Yegor Timoshenko
parent c580dfc0ce
commit 6eb45bf38a
5 changed files with 81 additions and 114 deletions

View File

@ -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";
};
}

View File

@ -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";
};
}

View File

@ -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";
};
}

View File

@ -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

View File

@ -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; };