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
```
This commit is contained in:
Samuel Dionne-Riel
2026-08-16 10:12:16 -04:00
parent 0c8ee58805
commit 4cf65b59fa

View File

@@ -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;