Subject: Re: [version-1.4.0] Package with texlive-updmap.cfg and texlive-amsfonts failing to find Euler

From: Ricardo Wurmus <[email-masked]>
Date: Thu, 20 Jan 2022 11:20:55 +0100

[email-masked] writes:

> Attached patch on top of version-1.4.0 attempts to typset PDF docs for the
> metamath package. However, the below error results, which seems to indicate
> that the Euler fonts are not found, despite texlive-amsfonts existing in the
> texlive-updmap.cfg input.
>
>     (/gnu/store/s952x1vkbbcprklzlzimn3m2dn53mjx9-texlive-amsfonts-59745/share/texmf-dist/tex/latex/amsfonts/ueuf.fd)
>     kpathsea: Running mktextfm eufm10
>     mkdir: cannot create directory ?././homeless-shelter?: Permission denied
>     mktextfm: mktexdir /homeless-shelter/.texlive2021/texmf-var/fonts/tfm/ams/euler failed.
>     kpathsea: Appending font creation commands to missfont.log.
>     
>     ! Font U/euf/m/n/10=eufm10 at 10.0pt not loadable: Metric (TFM) file not found.
>     <to be read again>

This is a problem with the texlive-amsfonts package.  The tlpdb says
that it should provide eufm10.tfm, but it doesn’t.

We’re building the fonts from source:

--8<---------------cut here---------------start------------->8---
                   ;; Frustratingly, not all fonts can be created this way.  To
                   ;; generate eufm8.tfm, for example, we first scale down
                   ;; eufm10.afm to eufm8.pl, and then generate the tfm file from
                   ;; the pl file.
                   (setenv "TEXINPUTS"
                           (string-append ":" build "//:"
                                          (getcwd) "/fonts/afm/public/amsfonts//:"
                                          (getcwd) "/source/latex/amsfonts//:"))
                   (with-directory-excursion build
                     (for-each (match-lambda
                                 (((target-base target-size)
                                   (source-base source-size))
                                  (let ((factor (number->string
                                                 (truncate/ (* 1000 target-size)
                                                            source-size))))
                                    (invoke "tex"
                                            "-interaction=scrollmode"
                                            (string-append "\\input fontinst.sty "
                                                           "\\transformfont{" target-base "}"
                                                           "{\\scalefont{" factor "}"
                                                           "{\\fromafm{" source-base "}}} "
                                                           "\\bye")))
                                  (invoke "pltotf"
                                          (string-append target-base ".pl")
                                          (string-append target-base ".tfm"))
                                  (delete-file (string-append target-base ".pl"))))

                               '((("eufm8" 8) ("eufm10" 10))

                                 (("eufb6" 6) ("eufb7" 7))
                                 (("eufb8" 8) ("eufb10" 10))
                                 (("eufb9" 9) ("eufb10" 10))

                                 (("eufm6" 6) ("eufb7" 7))
                                 (("eufm9" 9) ("eufb10" 10))

                                 (("eurb6" 6) ("eurb7" 7))
                                 (("eurb8" 8) ("eurb10" 10))
                                 (("eurb9" 9) ("eurb10" 10))

                                 (("eurm6" 6) ("eurm7" 7))
                                 (("eurm8" 8) ("eurm10" 10))
                                 (("eurm9" 9) ("eurm10" 10)))))
--8<---------------cut here---------------end--------------->8---

As you can see, we’re not building eufm10.tfm from the pl file.  Oops.
Fixing this is easy, but any change to texlive-amsfonts will require
rebuilding the world — unless we use grafts.

We can avoid these problems by checking that all texlive packages
produce all the outputs that the tlpdb specifies.  The texlive importer
already works with the tlpdb; we’d just need some sort of automatic
test.  We could do this as part of an optional build phase.

-- 
Ricardo