@@ -1,7 +1,7 @@
11{ abiCompat ? null,
22 stdenv, makeWrapper, fetchurl, fetchpatch, fetchFromGitLab, buildPackages,
33 automake, autoconf, gettext, libiconv, libtool, intltool,
4− freetype, tradcpp, fontconfig, meson, ninja, ed,
4+ freetype, tradcpp, fontconfig, meson, ninja, ed, fontforge,
55 libGL, spice-protocol, zlib, libGLU, dbus, libunwind, libdrm,
66 mesa, udev, bootstrap_cmds, bison, flex, clangStdenv, autoreconfHook,
77 mcpp, epoxy, openssl, pkgconfig, llvm_6, python3,
@@ -50,10 +50,6 @@ self: super:
5050 hardeningDisable = [ "format" ];
5151 });
5252
53− fontbhttf = super.fontbhttf.overrideAttrs (attrs: {
54− meta = attrs.meta // { license = lib.licenses.unfreeRedistributable; };
55− });
56−
5753 fontmiscmisc = super.fontmiscmisc.overrideAttrs (attrs: {
5854 postInstall =
5955 ''
@@ -848,4 +844,63 @@ self: super:
848844 --set XAPPLRESDIR ${placeholder "out"}/share/X11/app-defaults
849845 '';
850846 });
847+
848+ # convert Type1 vector fonts to OpenType fonts
849+ fontbitstreamtype1 = super.fontbitstreamtype1.overrideAttrs (attrs: {
850+ nativeBuildInputs = attrs.nativeBuildInputs ++ [ fontforge ];
851+
852+ postBuild = ''
853+ # convert Postscript (Type 1) font to otf
854+ for i in $(find -type f -name '*.pfa' -o -name '*.pfb'); do
855+ name=$(basename $i | cut -d. -f1)
856+ fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$name.otf\")"
857+ done
858+ '';
859+
860+ postInstall = ''
861+ # install the otf fonts
862+ fontDir="$out/lib/X11/fonts/misc/"
863+ install -D -m 644 -t "$fontDir" *.otf
864+ mkfontscale "$fontDir"
865+ '';
866+ });
867+
851868}
869+
870+# mark some packages as unfree
871+// (
872+ let
873+ # unfree but redistributable
874+ redist = [
875+ "fontadobeutopiatype1"
876+ "fontadobeutopia100dpi"
877+ "fontadobeutopia75dpi"
878+ "fontbhtype1"
879+ "fontibmtype1"
880+ "fontbhttf"
881+ "fontbh100dpi"
882+ "fontbh75dpi"
883+ ];
884+
885+ # unfree, possibly not redistributable
886+ unfree = [
887+ # no license, just a copyright notice
888+ "fontbhlucidatypewriter100dpi"
889+ "fontbhlucidatypewriter75dpi"
890+ "fontdaewoomisc"
891+
892+ # unclear license, "permission to use"?
893+ "fontjismisc"
894+ ];
895+
896+ setLicense = license: name:
897+ super.${name}.overrideAttrs (attrs: {
898+ meta = attrs.meta // { inherit license; };
899+ });
900+ mapNamesToAttrs = f: names: with lib;
901+ listToAttrs (zipListsWith nameValuePair names (map f names));
902+
903+ in
904+ mapNamesToAttrs (setLicense lib.licenses.unfreeRedistributable) redist //
905+ mapNamesToAttrs (setLicense lib.licenses.unfree) unfree
906+)