The URW fontconfig dilemma

  • Open
  • quality assurance status badge
Details
2 participants
  • Felix Lechner
  • Bruno Victal
Owner
unassigned
Submitted by
Bruno Victal
Severity
normal
B
B
Bruno Victal wrote on 4 Sep 2023 19:33
(name . bug-guix)(address . bug-guix@gnu.org)
e9c47e35-1b50-4db3-b1ee-6659b22b2381@makinata.eu
During my attempt to build the enblend-enfuse documentation [1],
it would fail and display the following message:
Toggle snippet (3 lines)
Error: fontconfig: Didn't find expected font family. Perhaps URW Type 1 fonts need installing?

Naturally searching for the URW fonts in guix didn't yield anything
other than some texlive packages so I ended up writing a definition
for it.
It turned out to be unnecessary as I later found out 'font-ghostscript'
provides just that. (an issue of discoverability perhaps?)

Nonetheless my newly written package (which should be “merged” into
the definition of 'font-ghostscript' with a better description and
perhaps a rename) is an update of what font-ghostscript provides and
should work just the same, in theory. (spoilers: it doesn't)

Intrigued by this difference and after some doc reading and several
arcane commands thrown in desperation, I've distilled them to this:

With the existing font-ghostscript package:
Toggle snippet (5 lines)
$ guix shell -C font-ghostscript fontconfig
[env]$ fc-match 'Nimbus Sans L'
n019003l.pfb: "Nimbus Sans L" "Regular"

With the new font-urw-base35 package (definition below):
Toggle snippet (5 lines)
$ ~/src/guix/pre-inst-env guix shell -C font-urw-base35 fontconfig
[env]$ fc-match 'Nimbus Sans L'
DejaVuSans.ttf: "DejaVu Sans" "Book"

The source of the font-urw-base35 has a file for fontconfig at
'fontconfig/urw-fallback-backwards.conf' that contains this:
Toggle snippet (36 lines)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!--
This file is used to alias/map previous versions of font families from (URW)++
to similar/metric-conmpatible font families of latest font versions from
(URW)++ itself.

Most likely this aliasing/mapping will be useful for people who:
* have latest versions of (URW)++ fonts, but their documents still reference
or requires older versions of these fonts

latest URW fonts: previous URW fonts:
==================== =============================================
Nimbus Mono PS Nimbus Mono L | Nimbus Mono
URW Gothic URW Gothic L
URW Bookman URW Bookman L | Bookman URW
Z003 URW Chancery L | Chancery URW
D050000L Dingbats
Nimbus Sans Nimbus Sans L
Nimbus Sans Narrow Nimbus Sans Narrow (same as current name)
C059 Century Schoolbook L | Century SchoolBook URW
P052 URW Palladio L | Palladio URW
Standard Symbols PS Standard Symbols L
Nimbus Roman Nimbus Roman No9 L
-->
<alias binding="same">
<family>Nimbus Sans L</family>
<accept>
<family>Nimbus Sans</family>
</accept>
</alias>

So unless I misunderstood the fontconfig documentation and the comment,
'fc-match' should have found the newer Nimbus Sans, not DejaVu Sans.
What gives?


The definition for this font-urw-base35 package:
Toggle snippet (50 lines)
;; Note: add #:use-module (guix build-system copy) to gnu/packages/fonts.scm.
;; when trying this out.
;; See <https://src.fedoraproject.org/rpms/urw-base35-fonts/blob/ed09bf27915269b454df3efb36b2e0cf45accd26/f/urw-base35-fonts.spec> for more information.
(define-public font-urw-base35
(let ((commit "3c0ba3b5687632dfc66526544a4e811fe0ec0cd9")
(revision "0")
(base-version "20200910"))
(package
(name "font-urw-base35")
(version (git-version base-version revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ArtifexSoftware/urw-base35-fonts")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"11mc9r2ap80jmh0w5jmypyq9hzyi9g9g4hcj45d5xn66m3jnlgjq"))))
(build-system copy-build-system)
(arguments
(list
#:install-plan
#~`(("fonts/" "share/fonts/urw-base35"
#:exclude ("README" "COPYING"))
("appstream/" "share/metainfo"
#:exclude ("README.md"))
("fontconfig/" "share/fontconfig/conf.avail/"
#:exclude ("README.md")))
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'configure
(lambda _
;; Set font priority for fontconfig.
(with-directory-excursion "fontconfig"
(for-each (lambda (f)
;; As recommended in the README.md.
(rename-file f
(string-append "61-"
(basename f))))
(find-files "." "\\.conf$"
#:fail-on-error? #t))))))))
(home-page "https://github.com/ArtifexSoftware/urw-base35-fonts")
(synopsis "URW++ base 35 font set.")
(description "This package provides substitutes for the 35 fonts
required by Adobe Postscript(c) Language Level 2 specification.")
(license license:agpl3))))



--
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.
F
F
Felix Lechner wrote on 7 Sep 2023 18:47
Thanks for debugging!
(address . 65741@debbugs.gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
CAFHYt561MY7ca=3pSOfXT0=rYgFbSD4_BpCfVPZLuQQF6sYLqA@mail.gmail.com
Hi Bruno,

I also noticed that message. Thanks for proposing a fix!

Kind regards
Felix
?