From 5ed81935cdc0738b4c55daf7f3322d9d7c8e18d0 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 7 Mar 2022 17:09:00 +0100 Subject: [PATCH] source-{sans,serif}-pro: reintroduce older font versions Recently, Source Sans/Serif Pro fonts got renamed. The "Pro" suffix was replaced with the major version of the font name. In the case of Source Serif, the change was announced in https://github.com/adobe-fonts/source-serif/issues/77 and besides the name font metric have been changed too. Therefore, documents using the old "Pro" version might look differently when the font is changed to the new "4" version. In the case of Source Sans, the metrics seem not to have been changed (https://github.com/adobe-fonts/source-sans/issues/192), but this comment (https://github.com/adobe-fonts/source-sans/issues/192#issuecomment-790143280) suggests that it might happen in the future. Due to the above, it makes sense to keep both old "Pro" and new (numbered) fonts as separate packages. This commit reintroduced the old "Pro" versions. It seems that Arch Linux is also distributing both versions: https://github.com/archlinux/svntogit-packages/blob/0d70461e5a26cde02cadfda64078eb93192c6caa/trunk/PKGBUILD Closes #157972 --- pkgs/data/fonts/source-sans-pro/default.nix | 30 ++++++++++++++++++++ pkgs/data/fonts/source-serif-pro/default.nix | 30 ++++++++++++++++++++ pkgs/top-level/aliases.nix | 2 -- pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 pkgs/data/fonts/source-sans-pro/default.nix create mode 100644 pkgs/data/fonts/source-serif-pro/default.nix diff --git a/pkgs/data/fonts/source-sans-pro/default.nix b/pkgs/data/fonts/source-sans-pro/default.nix new file mode 100644 index 000000000000..879f5083e235 --- /dev/null +++ b/pkgs/data/fonts/source-sans-pro/default.nix @@ -0,0 +1,30 @@ +{ lib, fetchzip }: + +# Source Sans Pro got renamed to Source Sans 3 (see +# https://github.com/adobe-fonts/source-sans/issues/192). This is the +# last version named "Pro". It is useful for backward compatibility +# with older documents/templates/etc. +let + version = "3.006"; +in fetchzip { + name = "source-sans-pro-${version}"; + + url = "https://github.com/adobe-fonts/source-sans/archive/${version}R.zip"; + + postFetch = '' + mkdir -p $out/share/fonts/{opentype,truetype,variable} + unzip -j $downloadedFile "*/OTF/*.otf" -d $out/share/fonts/opentype + unzip -j $downloadedFile "*/TTF/*.ttf" -d $out/share/fonts/truetype + unzip -j $downloadedFile "*/VAR/*.otf" -d $out/share/fonts/variable + ''; + + sha256 = "sha256-uWr/dFyLF65v0o6+oN/3RQoe4ziPspzGB1rgiBkoTYY="; + + meta = with lib; { + homepage = "https://adobe-fonts.github.io/source-sans/"; + description = "Sans serif font family for user interface environments"; + license = licenses.ofl; + platforms = platforms.all; + maintainers = with maintainers; [ ttuegel ]; + }; +} diff --git a/pkgs/data/fonts/source-serif-pro/default.nix b/pkgs/data/fonts/source-serif-pro/default.nix new file mode 100644 index 000000000000..a4d472d60856 --- /dev/null +++ b/pkgs/data/fonts/source-serif-pro/default.nix @@ -0,0 +1,30 @@ +{ lib, fetchzip }: + +# Source Serif Pro got renamed to Source Serif 4 (see +# https://github.com/adobe-fonts/source-serif/issues/77). This is the +# last version named "Pro". It is useful for backward compatibility +# with older documents/templates/etc. +let + version = "3.001"; +in fetchzip { + name = "source-serif-pro-${version}"; + + url = "https://github.com/adobe-fonts/source-serif/releases/download/${version}R/source-serif-pro-${version}R.zip"; + + postFetch = '' + mkdir -p $out/share/fonts/{opentype,truetype,variable} + unzip -j $downloadedFile "*/OTF/*.otf" -d $out/share/fonts/opentype + unzip -j $downloadedFile "*/TTF/*.ttf" -d $out/share/fonts/truetype + unzip -j $downloadedFile "*/VAR/*.otf" -d $out/share/fonts/variable + ''; + + sha256 = "sha256-rYWk8D41QMuuSP+cQMk8ttT7uX3a7gBk4OqjA7K9udk="; + + meta = with lib; { + homepage = "https://adobe-fonts.github.io/source-serif/"; + description = "Typeface for setting text in many sizes, weights, and languages. Designed to complement Source Sans"; + license = licenses.ofl; + platforms = platforms.all; + maintainers = with maintainers; [ ttuegel ]; + }; +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 02bc197f92ad..e69ad01ab651 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1123,8 +1123,6 @@ mapAliases ({ source-han-serif-korean = source-han-serif; source-han-serif-simplified-chinese = source-han-serif; source-han-serif-traditional-chinese = source-han-serif; - source-sans-pro = source-sans; # Added 2021-10-20 - source-serif-pro = source-serif; # Added 2021-10-20 spaceOrbit = throw "'spaceOrbit' has been renamed to/replaced by 'space-orbit'"; # Converted to throw 2022-02-22 spectral = neochat; # Added 2020-12-27 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3b53cd082929..ff41d322fbcc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24239,8 +24239,10 @@ with pkgs; source-code-pro = callPackage ../data/fonts/source-code-pro {}; source-sans = callPackage ../data/fonts/source-sans { }; + source-sans-pro = callPackage ../data/fonts/source-sans-pro { }; source-serif = callPackage ../data/fonts/source-serif { }; + source-serif-pro = callPackage ../data/fonts/source-serif-pro { }; source-han-code-jp = callPackage ../data/fonts/source-han-code-jp { };