noto-fonts: separate package for unusual weights

Noto provides a large number of unusual font weights so that the complete
package of fonts is more than 300 MB in size. Most of these weights are moved
into noto-fonts-extra; noto-fonts retains the ordinary weights and styles.

See also: #31543
This commit is contained in:
Thomas Tuegel 2018-05-28 10:32:16 -05:00
parent a797bd6bda
commit 8f43bb4e23
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
2 changed files with 52 additions and 41 deletions

View File

@ -1,38 +1,38 @@
{ stdenv, fetchzip, fetchFromGitHub, optipng, cairo, unzip, pythonPackages, pkgconfig, pngquant, which, imagemagick }: { stdenv, fetchzip, fetchFromGitHub, optipng, cairo, unzip, pythonPackages, pkgconfig, pngquant, which, imagemagick }:
rec { let
# 18MB mkNoto = { name, weights, sha256, }:
noto-fonts = let version = "2017-10-24-phase3-second-cleanup"; in fetchzip { let version = "2017-10-24-phase3-second-cleanup"; in
name = "noto-fonts-${version}"; fetchzip {
name = "${name}-${version}";
inherit sha256;
url = "https://github.com/googlei18n/noto-fonts/archive/v${version}.zip"; url = "https://github.com/googlei18n/noto-fonts/archive/v${version}.zip";
postFetch = '' postFetch = ''
unzip $downloadedFile unzip $downloadedFile
mkdir -p $out/share/fonts/noto mkdir -p $out/share/fonts/noto
cp noto-fonts-*/hinted/*.ttf $out/share/fonts/noto
# Also copy unhinted & alpha fonts for better glyph coverage, # Also copy unhinted & alpha fonts for better glyph coverage,
# if they don't have a hinted version # if they don't have a hinted version
# (see https://groups.google.com/d/msg/noto-font/ZJSkZta4n5Y/tZBnLcPdbS0J) # (see https://groups.google.com/d/msg/noto-font/ZJSkZta4n5Y/tZBnLcPdbS0J)
cp -n noto-fonts-*/unhinted/*.ttf $out/share/fonts/noto for ttf in noto-fonts-*/{hinted,unhinted,alpha}/*-${weights}.ttf
cp -n noto-fonts-*/alpha/*.ttf $out/share/fonts/noto do
cp -n "$ttf" -t "$out/share/fonts/noto"
done
''; '';
sha256 = "013l816cq9svdji266sccscm9sf9pfn472gq9lnqkzlwaxx9qrrl";
meta = with stdenv.lib; { meta = with stdenv.lib; {
inherit version; inherit version;
description = "Beautiful and free fonts for many languages"; description = "Beautiful and free fonts for many languages";
homepage = https://www.google.com/get/noto/; homepage = https://www.google.com/get/noto/;
longDescription = longDescription =
'' ''
When text is rendered by a computer, sometimes characters are displayed as When text is rendered by a computer, sometimes characters are
tofu. They are little boxes to indicate your device doesnt have a font to displayed as tofu. They are little boxes to indicate your device
display the text. doesnt have a font to display the text.
Google has been developing a font family called Noto, which aims to support all Google has been developing a font family called Noto, which aims to
languages with a harmonious look and feel. Noto is Googles answer to tofu. The support all languages with a harmonious look and feel. Noto is
name noto is to convey the idea that Googles goal is to see no more tofu. Googles answer to tofu. The name noto is to convey the idea that
Noto has multiple styles and weights, and freely available to all. Googles goal is to see no more tofu. Noto has multiple styles and
weights, and freely available to all.
This package also includes the Arimo, Cousine, and Tinos fonts. This package also includes the Arimo, Cousine, and Tinos fonts.
''; '';
@ -41,7 +41,19 @@ rec {
maintainers = with maintainers; [ mathnerd314 ]; maintainers = with maintainers; [ mathnerd314 ];
}; };
}; };
# 89MB in
rec {
noto-fonts = mkNoto {
name = "noto-fonts";
weights = "{Regular,Bold,Light,Italic,BoldItalic,LightItalic}";
sha256 = "1dmarbsfank6xzzx31h5jdv6n99rzblqyb1iqjkpll6dl3627pnb";
};
noto-fonts-extra = mkNoto {
name = "noto-fonts-extra";
weights = "{Black,Condensed,Extra,Medium,Semi,Thin}*";
sha256 = "1lih49bqmsmblczvbl7qb1bhn0bq8v5xkr991b3gjghpdkx584bc";
};
noto-fonts-cjk = let version = "1.004"; in fetchzip { noto-fonts-cjk = let version = "1.004"; in fetchzip {
name = "noto-fonts-cjk-${version}"; name = "noto-fonts-cjk-${version}";
@ -74,7 +86,6 @@ rec {
maintainers = with maintainers; [ mathnerd314 ]; maintainers = with maintainers; [ mathnerd314 ];
}; };
}; };
# 12MB
noto-fonts-emoji = let version = "2017-09-13-design-refresh"; in stdenv.mkDerivation { noto-fonts-emoji = let version = "2017-09-13-design-refresh"; in stdenv.mkDerivation {
name = "noto-fonts-emoji-${version}"; name = "noto-fonts-emoji-${version}";

View File

@ -14516,7 +14516,7 @@ with pkgs;
nafees = callPackage ../data/fonts/nafees { }; nafees = callPackage ../data/fonts/nafees { };
inherit (callPackages ../data/fonts/noto-fonts {}) inherit (callPackages ../data/fonts/noto-fonts {})
noto-fonts noto-fonts-cjk noto-fonts-emoji; noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra;
nullmailer = callPackage ../servers/mail/nullmailer { nullmailer = callPackage ../servers/mail/nullmailer {
stdenv = gccStdenv; stdenv = gccStdenv;