roboto: patch RobotoCondensed font to fix usWidthClass (#368615)

This commit is contained in:
Pol Dellaiera
2024-12-29 10:01:55 +01:00
committed by GitHub
+16
View File
@@ -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 "<usWidthClass value=\"5\"/>" "<usWidthClass value=\"3\"/>"
ttx $fontname.xml -o $fontname.ttf
done
install -Dm644 *.ttf -t $out/share/fonts/truetype
runHook postInstall