From 96eef3faf780294e3f9949460940665e80820ff7 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Fri, 27 Dec 2024 18:39:34 +0100 Subject: [PATCH] roboto: patch `RobotoCondensed` font to fix `usWidthClass` See https://github.com/googlefonts/roboto-3-classic/issues/130 Upstream patch: https://github.com/googlefonts/roboto-3-classic/pull/131 --- pkgs/by-name/ro/roboto/package.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/by-name/ro/roboto/package.nix b/pkgs/by-name/ro/roboto/package.nix index b22a68fde945..b2b7880f9726 100644 --- a/pkgs/by-name/ro/roboto/package.nix +++ b/pkgs/by-name/ro/roboto/package.nix @@ -2,6 +2,7 @@ lib, stdenvNoCC, fetchzip, + python3Packages, }: stdenvNoCC.mkDerivation rec { @@ -14,9 +15,24 @@ stdenvNoCC.mkDerivation rec { hash = "sha256-ue3PUZinBpcYgSho1Zrw1KHl7gc/GlN1GhWFk6g5QXE="; }; + nativeBuildInputs = [ + python3Packages.fonttools + ]; + installPhase = '' runHook preInstall + # The RobotoCondensed fonts have a usWidthClass value of 5, which is + # incorrect. It should be 3. + # See the corresponding issue at https://github.com/googlefonts/roboto-3-classic/issues/130 + for file in RobotoCondensed*; do + fontname=$(echo $file | sed 's/\.ttf//') + ttx -v -o $fontname.xml $file + substituteInPlace $fontname.xml \ + --replace-fail "" "" + ttx $fontname.xml -o $fontname.ttf + done + install -Dm644 *.ttf -t $out/share/fonts/truetype runHook postInstall