diff options
Diffstat (limited to 'pkgs/data/fonts/noto-fonts/default.nix')
-rw-r--r-- | pkgs/data/fonts/noto-fonts/default.nix | 84 |
1 files changed, 51 insertions, 33 deletions
diff --git a/pkgs/data/fonts/noto-fonts/default.nix b/pkgs/data/fonts/noto-fonts/default.nix index d6b4488daf05e..9c9996db39e04 100644 --- a/pkgs/data/fonts/noto-fonts/default.nix +++ b/pkgs/data/fonts/noto-fonts/default.nix @@ -3,8 +3,8 @@ , lib , fetchFromGitHub , fetchurl -, fetchzip , cairo +, nixosTests , python3 , pkg-config , pngquant @@ -61,6 +61,45 @@ let maintainers = with maintainers; [ mathnerd314 emily ]; }; }; + + mkNotoCJK = { typeface, version, rev, sha256 }: + stdenvNoCC.mkDerivation { + pname = "noto-fonts-cjk-${lib.toLower typeface}"; + inherit version; + + src = fetchFromGitHub { + owner = "googlefonts"; + repo = "noto-cjk"; + inherit rev sha256; + sparseCheckout = "${typeface}/OTC"; + }; + + installPhase = '' + install -m444 -Dt $out/share/fonts/opentype/noto-cjk ${typeface}/OTC/*.ttc + ''; + + passthru.tests.noto-fonts = nixosTests.noto-fonts; + + meta = with lib; { + description = "Beautiful and free fonts for CJK languages"; + homepage = "https://www.google.com/get/noto/help/cjk/"; + longDescription = '' + Noto ${typeface} CJK is a ${lib.toLower typeface} typeface designed as + an intermediate style between the modern and traditional. It is + intended to be a multi-purpose digital font for user interface + designs, digital content, reading on laptops, mobile devices, and + electronic books. Noto ${typeface} CJK comprehensively covers + Simplified Chinese, Traditional Chinese, Japanese, and Korean in a + unified font family. It supports regional variants of ideographic + characters for each of the four languages. In addition, it supports + Japanese kana, vertical forms, and variant characters (itaiji); it + supports Korean hangeul — both contemporary and archaic. + ''; + license = licenses.ofl; + platforms = platforms.all; + maintainers = with maintainers; [ mathnerd314 emily ]; + }; + }; in { @@ -74,39 +113,18 @@ in weights = "{Black,Condensed,Extra,Medium,Semi,Thin}*"; }; - noto-fonts-cjk = let zip = fetchzip { - url = let rev = "be6c059ac1587e556e2412b27f5155c8eb3ddbe6"; in - "https://raw.githubusercontent.com/googlefonts/noto-cjk/${rev}/NotoSansCJK.ttc.zip"; - # __MACOSX... - stripRoot = false; - sha256 = "0ik4z2b15i0pghskgfm3adzb0h35fr4gyzvz3bq49hhkhn9h85vi"; - }; in stdenvNoCC.mkDerivation { - pname = "noto-fonts-cjk"; - version = "2.001"; - - buildCommand = '' - install -m444 -Dt $out/share/fonts/opentype/noto-cjk ${zip}/*.ttc - ''; + noto-fonts-cjk-sans = mkNotoCJK { + typeface = "Sans"; + version = "2.004"; + rev = "9f7f3c38eab63e1d1fddd8d50937fe4f1eacdb1d"; + sha256 = "sha256-pNC/WJCYHSlU28E/CSFsrEMbyCe/6tjevDlOvDK9RwU="; + }; - meta = with lib; { - description = "Beautiful and free fonts for CJK languages"; - homepage = "https://www.google.com/get/noto/help/cjk/"; - longDescription = - '' - Noto Sans CJK is a sans serif typeface designed as an intermediate style - between the modern and traditional. It is intended to be a multi-purpose - digital font for user interface designs, digital content, reading on laptops, - mobile devices, and electronic books. Noto Sans CJK comprehensively covers - Simplified Chinese, Traditional Chinese, Japanese, and Korean in a unified font - family. It supports regional variants of ideographic characters for each of the - four languages. In addition, it supports Japanese kana, vertical forms, and - variant characters (itaiji); it supports Korean hangeul — both contemporary and - archaic. - ''; - license = licenses.ofl; - platforms = platforms.all; - maintainers = with maintainers; [ mathnerd314 emily ]; - }; + noto-fonts-cjk-serif = mkNotoCJK { + typeface = "Serif"; + version = "2.000"; + rev = "9f7f3c38eab63e1d1fddd8d50937fe4f1eacdb1d"; + sha256 = "sha256-Iy4lmWj5l+/Us/dJJ/Jl4MEojE9mrFnhNQxX2zhVngY="; }; noto-fonts-emoji = let |