I am trying to use a different font (not Computer Modern) in PyX, with
standard Ubuntu 18.04 installs of PyX and texlive, but it is not
working.  I have tried to resolve this but got lost in the minutiae of
TeX font management.  Can anybody help?

Running the following example:

from pyx import *
text.set(cls=text.LatexRunner)
text.preamble(r"\usepackage{ascii} \normalfont \usepackage[T1]{fontenc} ")
c = canvas.canvas()
c.text(0,0,"Testing")
c.writePDFfile("test.pdf")

gives this error:

RuntimeError: missing font information for 'ecrm1000'; check fontmapping file(s)

I have found a mapping for ecrm1000 in
/usr/share/texlive/texmf-dist/fonts/map/dvips/updmap/psfonts_t1.map
(file A):
ecrm1000 SFRM1000 " T1Encoding ReEncodeFont " <cm-super-t1.enc <sfrm1000.pfb

I tried adding the following to .pyxrc, but it does not resolve the error:
[text]
fontmaps = psfonts.map psfonts_T1.map psfonts.cmz psfonts.amz

There is no similar map in the other psfonts*.map files on my system.
In particular, there is no entry in
/var/lib/texmf/fonts/map/dvips/updmap/psfonts_t1.map (file B).  I
tried copying file A over file B but it does not fix the error.

If have also tried changing the preamble to:
text.preamble(r"\usepackage{ascii} \usepackage[T1]{fontenc} ")
(error is the same)

and to
text.preamble(r"\usepackage{ascii}")
(no error but also no new font, just Computer Modern).

Stack trace for the PyX error follows:

Ignoring line 16630 in mapping file 'pdftex.map': Unknown token '<MinLibBol'
Ignoring line 16631 in mapping file 'pdftex.map': Unknown token '<MinLibBol'
Ignoring line 16632 in mapping file 'pdftex.map': Unknown token '<MinLibBol'
Ignoring line 16633 in mapping file 'pdftex.map': Unknown token '<MinLibBolIta'
Ignoring line 16634 in mapping file 'pdftex.map': Unknown token '<MinLibBolIta'
Ignoring line 16635 in mapping file 'pdftex.map': Unknown token '<MinLibBolIta'
Ignoring line 16636 in mapping file 'pdftex.map': Unknown token '<MinLibIta'
Ignoring line 16637 in mapping file 'pdftex.map': Unknown token '<MinLibIta'
Ignoring line 16638 in mapping file 'pdftex.map': Unknown token '<MinLibIta'
Ignoring line 16639 in mapping file 'pdftex.map': Unknown token '<MinLibReg'
Ignoring line 16640 in mapping file 'pdftex.map': Unknown token '<MinLibReg'
Ignoring line 16641 in mapping file 'pdftex.map': Unknown token '<MinLibReg'
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    c.writePDFfile("test.pdf")
  File "/usr/lib/python3/dist-packages/pyx/canvas.py", line 50, in
wrappedindocument
    return method(d, file, **write_kwargs)
  File "/usr/lib/python3/dist-packages/pyx/document.py", line 193, in
writePDFfile
    pdfwriter.PDFwriter(self, f, **kwargs)
  File "/usr/lib/python3/dist-packages/pyx/pdfwriter.py", line 322, in __init__
    catalog = PDFcatalog(document, self, registry)
  File "/usr/lib/python3/dist-packages/pyx/pdfwriter.py", line 143, in __init__
    self.PDFpages = PDFpages(document, writer, registry)
  File "/usr/lib/python3/dist-packages/pyx/pdfwriter.py", line 208, in __init__
    page = PDFpage(page, pageno, self, writer, registry)
  File "/usr/lib/python3/dist-packages/pyx/pdfwriter.py", line 242, in __init__
    self.PDFcontent = PDFcontent(page, writer, self.pageregistry)
  File "/usr/lib/python3/dist-packages/pyx/pdfwriter.py", line 274, in __init__
    page.processPDF(contentfile, awriter, acontext, registry, self.bbox)
  File "/usr/lib/python3/dist-packages/pyx/document.py", line 135, in processPDF
    self._process("processPDF", *args)
  File "/usr/lib/python3/dist-packages/pyx/document.py", line 129, in _process
    getattr(cc, processMethod)(contentfile, writer, context, registry, bbox)
  File "/usr/lib/python3/dist-packages/pyx/canvas.py", line 238, in processPDF
    item.processPDF(file, writer, context, registry, nbbox)
  File "/usr/lib/python3/dist-packages/pyx/text.py", line 887, in processPDF
    self.dvicanvas.processPDF(file, writer, context, registry, abbox)
  File "/usr/lib/python3/dist-packages/pyx/canvas.py", line 238, in processPDF
    item.processPDF(file, writer, context, registry, nbbox)
  File "/usr/lib/python3/dist-packages/pyx/dvi/texfont.py", line 193,
in processPDF
    self._text(writer).processPDF(file, writer, context, registry, bbox)
  File "/usr/lib/python3/dist-packages/pyx/dvi/texfont.py", line 179, in _text
    mapline = self.font.getMAPline(writer.getfontmap())
  File "/usr/lib/python3/dist-packages/pyx/dvi/texfont.py", line 134,
in getMAPline
    raise RuntimeError("missing font information for '%s'; check
fontmapping file(s)" % self.name)
RuntimeError: missing font information for 'ecrm1000'; check fontmapping file(s)

Selected output from dpkg -l | grep ii texlive:

ii  texlive-base                               2017.20180305-1
                         all          TeX Live: Essential programs and
files
[...]
ii  texlive-fonts-extra                        2017.20180305-2
                         all          TeX Live: Additional fonts
[...]
ii  texlive-fonts-recommended                  2017.20180305-1
                         all          TeX Live: Recommended fonts
[...]

Output of locate ecrm1000:
/usr/share/texlive/texmf-dist/fonts/source/jknappen/ec/ecrm1000.mf
/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm1000.tfm

Output of cat /etc/lsb-release:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

I read the PyX FAQ, which has an entry about cmr10 in it.  This error
looks different, but just in case...

Output of kpsewhich cmr10.pfb
/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb

-- 
Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /[email protected]/')


_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to