From: Michael J G. <mic...@us...> - 2020-07-14 11:40:28
|
Hi Tony, first of all sorry for misdirecting my first answer. I didn't mean to steer you away from the list. The issue is a misunderstanding of the ascii package, it seems. It is a package for typesetting special ascii symbols. That's why it uses a special encoding and has glyphs only in specific positions of that encoding. In particular, you cannot use it as a textfont in T1. The doc tells you to either use the commands which it supplies, or use the glyph number as in \textascii{\char"16}. So: \documentclass{article} \usepackage{ascii} \begin{document} \SO \end{document} (when run through pdflatex) produces a PDF which uses the ascii font for the musical score (plus the standard text font for the page number which I did not turn off). from pyx import * text.set(cls=text.LatexRunner) text.preamble(r"\usepackage{ascii}") c = canvas.canvas() c.text(0,0,r"\SO") c.writePDFfile("test.pdf") (when run through python) produces that same symbol. If your PyX is quite new you'll get a warning to follow the switch from runner to engine, which does not matter for the font issue. Cheers Michael Am Di., 14. Juli 2020 um 10:56 Uhr schrieb jumbophut <jum...@gm...>: > > Thanks Michael. > > The output of kpsewhich sfrm1000.pfb was blank. I fixed this with > sudo apt-get install cm-super-minimal. This fixed the error I was > getting before, but I still wasn't getting font I wanted. The PDF was > still just computer modern. > > I then created the following LaTeX file and compiled with pdflatex test.tex: > \documentclass{article} > \usepackage{ascii} > \usepackage[T1]{fontenc} > \begin{document} > {\fontfamily{ascii}\selectfont Testing} > Testing > \end{document} > > This produced only CM output and the warning "Font shape > `T1/ascii/m/n' undefined". So I edited > /usr/share/texlive/texmf-dist/tex/latex/ascii-font/ascii.sty, which > had the encoding as 'U', and changed all the 'U's to 'T1's (seems like > an unwise thing but I couldn't work out what else to do). Recompiling > the .tex file gave ascii font for the first occurrence of testing and > CM for the second. > > So, the ascii font is there and usable from pdflatex directly. > > However, it is not usable if I instead compile the file with "latex > test.tex && dvips tex.dvi". In that case I get CM output in the > postscript and the warning "Font shape `T1/ascii/m/n' undefined". > > Next I tried to run my PyX file: > from pyx import * > text.set(cls=text.LatexRunner) > text.preamble(r"\usepackage{ascii} \usepackage[T1]{fontenc} ") > c = canvas.canvas() > c.text(0,0,"Testing") > c.writePDFfile("test.pdf") > > The output PDF was just CM, and I got warnings about extracting font > information from 'SFRM1000' being slow. > > Then I changed c.text(0,0,"Testing") to: > c.text(0,0,r"{\fontfamily{ascii}\selectfont Testing}") > > That didn't fix the problem and I additionally got the warnings: > "ignoring font substitutions of NFSS" and "Font shape `T1/ascii/m/n' > undefined". > > Any suggestions about where to go from here? I wonder if PyX is using > latex + dvips to initially set the text (the combination which didn't > work directly with my test .tex file) rather than pdflatex (which did > work directly). If so, one solution would be to make latex + dvips -- > like pdflatex -- see the fonts correctly, but I'm unsure how to do > that. (I realise that at this point it is starting to look more like > a bigger texlive/Ubuntu problem than a PyX problem but hoping there > might still be a straightforward solution). > > Cheers > Tony > > > On 7/14/20, Michael J Gruber <mic...@gm...> wrote: > > Hi there, > > > > what does > > > > kpsewhich sfrm1000.pfb > > > > say? If your distro does like mine then the map files in /var are > > recreated on the fly, taking into account which fonts are present. A > > good test is also to compile a small LaTeX file using pdflatex: Can > > you use the intended fonts this way? The error message indicates that > > LaTeX does not find them. > > > > Cheers > > Michael > > > > Am Mo., 13. Juli 2020 um 13:08 Uhr schrieb jumbophut <jum...@gm...>: > >> > >> 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!, > >> /l...@om...i/') > >> > >> > >> _______________________________________________ > >> PyX-user mailing list > >> PyX...@li... > >> https://lists.sourceforge.net/lists/listinfo/pyx-user > > > > > -- > Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /l...@om...i/') |