noto-fonts-lgc-plus: init at 20201206-phase3
This is an effort to provide more sane defaults when it comes to which fonts to install. Nobody needs Noto fonts for >190 different scripts. The noto-fonts-lgc-plus package provides the Noto Fonts for latin, greek and cyrillic, and some extras and it gives users the opportunity to specify extra fonts to install. This shoud especially be used by other modules to prevent polluting the installed fonts, making font selection in some Programs almost unusable.
This commit is contained in:
parent
31f5f62c50
commit
34e2d79450
2 changed files with 118 additions and 77 deletions
|
@ -11,39 +11,10 @@
|
|||
, imagemagick
|
||||
, zopfli
|
||||
, buildPackages
|
||||
, variants ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
mkNoto = { pname, weights }:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
inherit pname;
|
||||
version = "v20201206-phase3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "googlefonts";
|
||||
repo = "noto-fonts";
|
||||
rev = version;
|
||||
hash = "sha256-x60RvCRFLoGe0CNvswROnDkIsUFbWH+/laN8q2qkUPk=";
|
||||
};
|
||||
|
||||
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 archive/unhinted/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf archive/hinted/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf unhinted/*/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf hinted/*/*/*-${weights}.ttf
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Beautiful and free fonts for many languages";
|
||||
homepage = "https://www.google.com/get/noto/";
|
||||
longDescription =
|
||||
''
|
||||
notoLongDescription = ''
|
||||
When text is rendered by a computer, sometimes characters are
|
||||
displayed as “tofu”. They are little boxes to indicate your device
|
||||
doesn’t have a font to display the text.
|
||||
|
@ -56,6 +27,52 @@ let
|
|||
|
||||
This package also includes the Arimo, Cousine, and Tinos fonts.
|
||||
'';
|
||||
in
|
||||
rec {
|
||||
mkNoto =
|
||||
{ pname
|
||||
, weights
|
||||
, variants ? [ ]
|
||||
, longDescription ? notoLongDescription
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
inherit pname;
|
||||
version = "20201206-phase3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "googlefonts";
|
||||
repo = "noto-fonts";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-x60RvCRFLoGe0CNvswROnDkIsUFbWH+/laN8q2qkUPk=";
|
||||
};
|
||||
|
||||
_variants = map (variant: builtins.replaceStrings [ " " ] [ "" ] variant) variants;
|
||||
|
||||
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
|
||||
'' + (if _variants == [ ] then ''
|
||||
install -m444 -Dt $out_ttf archive/unhinted/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf archive/hinted/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf unhinted/*/*/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf hinted/*/*/*-${weights}.ttf
|
||||
'' else ''
|
||||
for variant in $_variants; do
|
||||
install -m444 -Dt $out_ttf archive/unhinted/$variant/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf archive/hinted/$variant/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf unhinted/*/$variant/*-${weights}.ttf
|
||||
install -m444 -Dt $out_ttf hinted/*/$variant/*-${weights}.ttf
|
||||
done
|
||||
'');
|
||||
|
||||
meta = with lib; {
|
||||
description = "Beautiful and free fonts for many languages";
|
||||
homepage = "https://www.google.com/get/noto/";
|
||||
inherit longDescription;
|
||||
license = licenses.ofl;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ mathnerd314 emily ];
|
||||
|
@ -100,14 +117,34 @@ let
|
|||
maintainers = with maintainers; [ mathnerd314 emily ];
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
noto-fonts = mkNoto {
|
||||
pname = "noto-fonts";
|
||||
weights = "{Regular,Bold,Light,Italic,BoldItalic,LightItalic}";
|
||||
};
|
||||
|
||||
noto-fonts-lgc-plus = mkNoto {
|
||||
pname = "noto-fonts-lgc-plus";
|
||||
weights = "{Regular,Bold,Light,Italic,BoldItalic,LightItalic}";
|
||||
variants = [
|
||||
"Noto Sans"
|
||||
"Noto Serif"
|
||||
"Noto Sans Display"
|
||||
"Noto Serif Display"
|
||||
"Noto Sans Mono"
|
||||
"Noto Music"
|
||||
"Noto Sans Symbols"
|
||||
"Noto Sans Symbols 2"
|
||||
"Noto Sans Math"
|
||||
];
|
||||
longDescription = ''
|
||||
This package provides the Noto Fonts, but only for latin, greek
|
||||
and cyrillic scripts, as well as some extra fonts. To create a
|
||||
custom Noto package with custom variants, see the `mkNoto`
|
||||
helper function.
|
||||
'';
|
||||
};
|
||||
|
||||
noto-fonts-extra = mkNoto {
|
||||
pname = "noto-fonts-extra";
|
||||
weights = "{Black,Condensed,Extra,Medium,Semi,Thin}*";
|
||||
|
@ -127,11 +164,13 @@ in
|
|||
sha256 = "sha256-1w66Ge7DZjbONGhxSz69uFhfsjMsDiDkrGl6NsoB7dY=";
|
||||
};
|
||||
|
||||
noto-fonts-emoji = let
|
||||
noto-fonts-emoji =
|
||||
let
|
||||
version = "2.038";
|
||||
emojiPythonEnv =
|
||||
buildPackages.python3.withPackages (p: with p; [ fonttools nototools ]);
|
||||
in stdenvNoCC.mkDerivation {
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "noto-fonts-emoji";
|
||||
inherit version;
|
||||
|
||||
|
|
|
@ -26683,7 +26683,9 @@ with pkgs;
|
|||
nordzy-icon-theme = callPackage ../data/icons/nordzy-icon-theme { };
|
||||
|
||||
inherit (callPackages ../data/fonts/noto-fonts {})
|
||||
mkNoto
|
||||
noto-fonts
|
||||
noto-fonts-lgc-plus
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-cjk-serif
|
||||
noto-fonts-emoji
|
||||
|
|
Loading…
Reference in a new issue