Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / no / noto-fonts / package.nix
blobf700f8ad121c50082c5d520cf9a1981005badb7b
1 { lib
2 , stdenvNoCC
3 , fetchFromGitHub
4 , gitUpdater
5 , variants ? [ ]
6 , suffix ? ""
7 , longDescription ? ''
8     When text is rendered by a computer, sometimes characters are
9     displayed as “tofu”. They are little boxes to indicate your device
10     doesn’t have a font to display the text.
11     Google has been developing a font family called Noto, which aims to
12     support all languages with a harmonious look and feel. Noto is
13     Google’s answer to tofu. The name noto is to convey the idea that
14     Google’s goal is to see “no more tofu”.  Noto has multiple styles and
15     weights, and freely available to all.
16   ''
19 stdenvNoCC.mkDerivation rec {
20   pname = "noto-fonts${suffix}";
21   version = "24.3.1";
23   src = fetchFromGitHub {
24     owner = "notofonts";
25     repo = "notofonts.github.io";
26     rev = "noto-monthly-release-${version}";
27     hash = "sha256-bopBRpIGXtRyAjBuMhJCjwFUlK8WDurxIFbZbRzEE40=";
28   };
30   _variants = map (variant: builtins.replaceStrings [ " " ] [ "" ] variant) variants;
32   installPhase = ''
33     # We check availability in order of variable -> otf -> ttf
34     # unhinted -- the hinted versions use autohint
35     # maintaining maximum coverage.
36     #
37     # We have a mix of otf and ttf fonts
38     local out_font=$out/share/fonts/noto
39   '' + (if _variants == [ ] then ''
40     for folder in $(ls -d fonts/*/); do
41       if [[ -d "$folder"unhinted/variable-ttf ]]; then
42         install -m444 -Dt $out_font "$folder"unhinted/variable-ttf/*.ttf
43       elif [[ -d "$folder"unhinted/otf ]]; then
44         install -m444 -Dt $out_font "$folder"unhinted/otf/*.otf
45       else
46         install -m444 -Dt $out_font "$folder"unhinted/ttf/*.ttf
47       fi
48     done
49   '' else ''
50     for variant in $_variants; do
51       if [[ -d fonts/"$variant"/unhinted/variable-ttf ]]; then
52         install -m444 -Dt $out_font fonts/"$variant"/unhinted/variable-ttf/*.ttf
53       elif [[ -d fonts/"$variant"/unhinted/otf ]]; then
54         install -m444 -Dt $out_font fonts/"$variant"/unhinted/otf/*.otf
55       else
56         install -m444 -Dt $out_font fonts/"$variant"/unhinted/ttf/*.ttf
57       fi
58     done
59   '');
61   passthru.updateScript = gitUpdater {
62     rev-prefix = "noto-monthly-release-";
63   };
65   meta = {
66     description = "Beautiful and free fonts for many languages";
67     homepage = "https://www.google.com/get/noto/";
68     inherit longDescription;
69     license = lib.licenses.ofl;
70     platforms = lib.platforms.all;
71     maintainers = with lib.maintainers; [ mathnerd314 emily jopejoe1 ];
72   };