about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorjopejoe1 <johannes@joens.email>2023-12-06 19:46:12 +0100
committerJörg Thalheim <Mic92@users.noreply.github.com>2023-12-13 21:28:44 +0100
commit73aa85d1152f4143269245f0c2929a679c1028f2 (patch)
treeb9ac12ea6418411794ef443a68099f23c1f2094a /pkgs/by-name
parent9fbcecc83f7fdc806874d80aef8859d661d4bac4 (diff)
downloadnixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar.gz
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar.bz2
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar.lz
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar.xz
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.tar.zst
nixlib-73aa85d1152f4143269245f0c2929a679c1028f2.zip
noto-fonts: move out of noto-fonts file
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/no/noto-fonts/package.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/by-name/no/noto-fonts/package.nix b/pkgs/by-name/no/noto-fonts/package.nix
new file mode 100644
index 000000000000..4f8606095e02
--- /dev/null
+++ b/pkgs/by-name/no/noto-fonts/package.nix
@@ -0,0 +1,73 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+, gitUpdater
+, variants ? [ ]
+, suffix ? ""
+, longDescription ? ''
+    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.
+    Google has been developing a font family called Noto, which aims to
+    support all languages with a harmonious look and feel. Noto is
+    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.
+  ''
+}:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "noto-fonts${suffix}";
+  version = "23.11.1";
+
+  src = fetchFromGitHub {
+    owner = "notofonts";
+    repo = "notofonts.github.io";
+    rev = "noto-monthly-release-${version}";
+    hash = "sha256-qBHLCOfVBOn9CV194S4cYw9nhHyAe2AUBJHQMvyEfW8=";
+  };
+
+  _variants = map (variant: builtins.replaceStrings [ " " ] [ "" ] variant) variants;
+
+  installPhase = ''
+    # We check availability in order of variable -> otf -> ttf
+    # unhinted -- the hinted versions use autohint
+    # maintaining maximum coverage.
+    #
+    # We have a mix of otf and ttf fonts
+    local out_font=$out/share/fonts/noto
+  '' + (if _variants == [ ] then ''
+    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
+      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
+  '');
+
+  passthru.updateScript = gitUpdater {
+    rev-prefix = "noto-monthly-release-";
+  };
+
+  meta = {
+    description = "Beautiful and free fonts for many languages";
+    homepage = "https://www.google.com/get/noto/";
+    inherit longDescription;
+    license = lib.licenses.ofl;
+    platforms = lib.platforms.all;
+    maintainers = with lib.maintainers; [ mathnerd314 emily jopejoe1 ];
+  };
+}