From 4cf65b59fa00c98ab416414078fee928a930c13b Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 16 Aug 2026 10:12:16 -0400 Subject: [PATCH] unifont: Don't ship sample font in default output The use-case for these font files is detailed in their 2013 changelog entry: > These "Unifont Sample" fonts contain combining circles, and four-digit > hexadecimal glyphs for unassigned code points and Private Use Area glyphs. > Because of the inclusion of combining cirlces, "Unifont Sample" font > versions are only intended for illustrating individual glyphs, not for > general-purpose writing. What this means, in practice, is that since #550059 unifont *may* end-up being picked rather than any other font that actually has a glyph, instead of a replacement glyph. And even if there was no proper glyph to use, a replacement glyph is made on the fly anyway. This regression can be checked with, for example, Font Awesome, on the same config, Nixpkgs `b7c2ada94fe9..0e251e24a4f2`. Before regression: ``` /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-font-awesome-7.2.0/share/fonts/opentype/Font Awesome 7 Free-Solid-900.otf: Font Awesome 7 Free,Font Awesome 7 Free Solid:style=Solid,Regular ``` Current: ``` $ fc-list :charset=f244 /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-font-awesome-7.2.0/share/fonts/opentype/Font Awesome 7 Free-Solid-900.otf: Font Awesome 7 Free,Font Awesome 7 Free Solid:style=Solid,Regular /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-unifont-17.0.05/share/fonts/opentype/unifont/unifont_sample.otf: Unifont Sample:style=Regular /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-unifont-17.0.05/share/fonts/X11/misc/unifont_sample.pcf.gz: Unifont Sample:style=Sans-Serif ``` After fix: ``` $ fc-list :charset=f244 /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-font-awesome-7.2.0/share/fonts/opentype/Font Awesome 7 Free-Solid-900.otf: Font Awesome 7 Free,Font Awesome 7 Free Solid:style=Solid,Regular ``` --- pkgs/by-name/un/unifont/package.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/by-name/un/unifont/package.nix b/pkgs/by-name/un/unifont/package.nix index 04323ca1cb29..8a4f84661576 100644 --- a/pkgs/by-name/un/unifont/package.nix +++ b/pkgs/by-name/un/unifont/package.nix @@ -42,9 +42,26 @@ stdenv.mkDerivation (finalAttrs: { buildFlags = [ "BUILDFONT=1" ]; + # The `sample` variants are not intended for general use. + # + # From the 2013 changelog: + # + # > These "Unifont Sample" fonts contain combining circles, and four-digit + # > hexadecimal glyphs for unassigned code points and Private Use Area glyphs. + # > Because of the inclusion of combining cirlces, "Unifont Sample" font + # > versions are only intended for illustrating individual glyphs, not for + # > general-purpose writing. postInstall = '' moveToOutput bin "$bin" moveToOutput share/unifont "$doc" + + # Move `sample` into its own output. + mkdir -vp "$sample/share/fonts/X11/misc/" + mkdir -vp "$sample/share/fonts/opentype/unifont/" + mv -vt "$sample/share/fonts/X11/misc/" \ + "$out"/share/fonts/X11/misc/*_sample.* + mv -vt "$sample/share/fonts/opentype/unifont/" \ + "$out"/share/fonts/opentype/unifont/*_sample.* ''; outputs = [ @@ -53,6 +70,7 @@ stdenv.mkDerivation (finalAttrs: { "doc" "man" "info" + "sample" ]; passthru.updateScript = ./update.sh;