Skip to content

Commit

Permalink
Merge pull request #211672 from jopejoe1/noto-fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored Apr 11, 2023
2 parents f63ba61 + c347bd6 commit 71e76c7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
56 changes: 26 additions & 30 deletions pkgs/data/fonts/noto-fonts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,53 @@ let
Google’s answer to tofu. The name noto is to convey the idea that
Google’s 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.
'';
in
rec {
mkNoto =
{ pname
, weights
, variants ? [ ]
, longDescription ? notoLongDescription
}:
stdenvNoCC.mkDerivation rec {
inherit pname;
version = "20201206-phase3";
version = "23.4.1";

src = fetchFromGitHub {
owner = "googlefonts";
repo = "noto-fonts";
rev = "v${version}";
hash = "sha256-x60RvCRFLoGe0CNvswROnDkIsUFbWH+/laN8q2qkUPk=";
owner = "notofonts";
repo = "notofonts.github.io";
rev = "noto-monthly-release-${version}";
hash = "sha256-hiBbhcwktacuoYJnZcsh7Aej5QIrBNkqrel2NhjNjCU=";
};

_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
# We check availability in order of variable -> otf -> ttf
# unhinted -- the hinted versions use autohint
# maintaining maximum coverage.
#
# TODO: install OpenType, variable versions?
local out_ttf=$out/share/fonts/truetype/noto
# We have a mix of otf and ttf fonts
local out_font=$out/share/fonts/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
for folder in $(ls -d fonts/*/); do
if [[ -d "$folder"unhinted/variable-ttf ]]; then
install -m444 -Dt $out_font "$folder"unhinted/variable-ttf/*.ttf
elif [[ -d "$folder"unhinted/otf ]]; then
install -m444 -Dt $out_font "$folder"unhinted/otf/*.otf
else
install -m444 -Dt $out_font "$folder"unhinted/ttf/*.ttf
fi
done
'' 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
if [[ -d fonts/"$variant"/unhinted/variable-ttf ]]; then
install -m444 -Dt $out_font fonts/"$variant"/unhinted/variable-ttf/*.ttf
elif [[ -d fonts/"$variant"/unhinted/otf ]]; then
install -m444 -Dt $out_font fonts/"$variant"/unhinted/otf/*.otf
else
install -m444 -Dt $out_font fonts/"$variant"/unhinted/ttf/*.ttf
fi
done
'');

Expand All @@ -75,7 +80,7 @@ rec {
inherit longDescription;
license = licenses.ofl;
platforms = platforms.all;
maintainers = with maintainers; [ mathnerd314 emily ];
maintainers = with maintainers; [ mathnerd314 emily jopejoe1 ];
};
};

Expand Down Expand Up @@ -120,17 +125,13 @@ rec {

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"
Expand All @@ -145,11 +146,6 @@ rec {
'';
};

noto-fonts-extra = mkNoto {
pname = "noto-fonts-extra";
weights = "{Black,Condensed,Extra,Medium,Semi,Thin}*";
};

noto-fonts-cjk-sans = mkNotoCJK {
typeface = "Sans";
version = "2.004";
Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ mapAliases ({
nomad_1_1 = throw "nomad_1_1 has been removed because it's outdated. Use a a newer version instead"; # Added 2022-05-22
nordic-polar = throw "nordic-polar was removed on 2021-05-27, now integrated in nordic"; # Added 2021-05-27
noto-fonts-cjk = noto-fonts-cjk-sans; # Added 2021-12-16
noto-fonts-extra = noto-fonts; # Added 2023-04-08
nottetris2 = throw "nottetris2 was removed because it is unmaintained by upstream and broken"; # Added 2022-01-15
now-cli = throw "now-cli has been replaced with nodePackages.vercel"; # Added 2021-08-05
ntdb = throw "ntdb has been removed: abandoned by upstream"; # Added 2022-04-21
Expand Down
3 changes: 1 addition & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28185,8 +28185,7 @@ with pkgs;
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
noto-fonts-emoji-blob-bin
noto-fonts-extra;
noto-fonts-emoji-blob-bin;

nuclear = callPackage ../applications/audio/nuclear { };

Expand Down

0 comments on commit 71e76c7

Please sign in to comment.