4

I am running pdfTeX with dvi output. If font expansion is enabled, then I need the extra fonts, such as cmr10+20. When I try to view the dvi, xdvi tries to make various fonts and fails; the file missfont.log gets appended various commands, such as mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 cmr10+20. If I try that command, I get an error, with mktexpk: perhaps cmr10+20 is missing from the map file. It seems first I have to modify the map file. I don't know whether that is all I have to do or not, but I don't know how to do that for a font that does not exist yet. I realize that if I used pdf output, this would not be needed. I am running Ubuntu 14.04.

Edit: In response to a request, here is a sample file. The problem will occur with any file that needs font expansion, however.

\pdfoutput=0
\pdffontexpand\tenrm 20 20 10 autoexpand
\pdfadjustspacing=2
\hsize=3in
There is a striking, but easily established, correspondence between
electrical networks and
random walks on graphs (or on networks). 

\bye

Edit 2: The fonts I am actually using most and thus would like to enable expansion for are ntx-Regular-tlf-ot1 and ntx-Italic-tlf-ot1. I would also like to enable expansion for ntxmi.

  • I think that autoexpand only works for PDF output and that for DVI output you need to prepare in advance the TFM files for the expanded fonts. – egreg Dec 28 '15 at 22:37
  • Exactly. My question is how to do that. – Russ Lyons Dec 28 '15 at 22:44
  • My question is why do you want to do that? ;-) – egreg Dec 28 '15 at 22:50
  • Because it seems easier than to convert all my macros for my book to work with pdf output, as well as convert 100 figures from eps to pdf and make sure everything works at the end. Besides, this is the usual result with dvi output for pdfTeX, yet I could find nowhere that says what to do. – Russ Lyons Dec 28 '15 at 22:55

1 Answers1

5

The autoexpand option only works for PDF output, whereas for DVI output you have to create the expanded font instances in advance. Assuming you want to use the original Computer Modern Roman MetaFont, you would have to:

  • create a copy of the font source (let's say cmr10.mf),
  • add a line after the place where the unit width is defined:
   u#:=20/36pt#;      % unit width
   u#:=u#+20/1000u#;  % <-- scale by 20
  • rename the amended file to cmr10+20.mf.

  • Repeat the above steps for as many instances as you like (e.g., -20, -15, -10, -5, +5, +10, +15).

  • Repeat the above steps for all fonts that you want to have expanded (e.g., cmr12.mf, cmti10.mf ...).

When running pdftex the corresponding tfm and pk files will then be created. (BTW: You should remove the autoexpand keyword for \pdffontexpand, so as not to confuse pdftex.)

For Type1 fonts and Multiple Master fonts, the procedures are different. You can find all the details in Hàn Thé Thành's thesis, p. 370.


EDIT Since you are actually not using CMR, but a Type1 font, you'd have to create the expanded tfm files in advance:

  • grep ntx-Regular-tlf-ot1 `kpsewhich newtx.map` tells us that the font is a reencoded Type1 font:

    ntx-Regular-tlf-ot1 TeXGyreTermes-Regular " encntx-ot1-tlf ReEncodeFont " <[ntx-ot1-tlf.enc <qtmr.pfb
    
  • the base afm file is ntxtmr.afm (in fonts/afm/public/newtx/). (The base file for italics would be ntxtmri.afm, for bold ntxtmb.afm, and for bold italics ntxtmbi.afm.)

  • you can create the expanded tfms with afm2tfm:

    afm2tfm ntxtmr.afm -e 1.020 -T ntx-ot1-tlf.enc ntx-Regular-tlf-ot1+20.tfm
    afm2tfm ntxtmr.afm -e 0.980 -T ntx-ot1-tlf.enc ntx-Regular-tlf-ot1-20.tfm
    

    and so on for all required steps.

  • finally, you have to add the new map entries, based on the original one in newtx.map, adding the ExtendFont part (let's write them into a new file newtx-ext.map):

    ntx-Regular-tlf-ot1+20 TeXGyreTermes-Regular " 1.020 ExtendFont encntx-ot1-tlf ReEncodeFont " <[ntx-ot1-tlf.enc <qtmr.pfb
    ntx-Regular-tlf-ot1-20 TeXGyreTermes-Regular " 0.980 ExtendFont encntx-ot1-tlf ReEncodeFont " <[ntx-ot1-tlf.enc <qtmr.pfb
    

    You can then enable this map file with:

    updmap-sys --enable Map=newtx-ext.map
    
  • Repeat for all steps, and for all fonts.

Robert
  • 14,181
  • 1
  • 52
  • 77
  • In fact, my main font is ntx-Regular-tlf-ot1, not cmr. I see only a tfm file. I don't know what type of font it is and without any other files, I don't know how to modify it in any of the 3 ways you mention. – Russ Lyons Dec 29 '15 at 02:52
  • @RussLyons See newtx.map for details. Type1 reencoded. The map file will let you identify the type1 fonts you are using. – cfr Dec 29 '15 at 03:37
  • Thanks for the edit! I just noticed it, having spent the last 3 hours learning about fontinst and attempting to learn about \latinfamily (about which fontinst says: "There is really much too much about this command for it to be described in full here. Please see other available documentation."--but where is that other doc?). Since I am doing so little, your method looks much better. However, I have to figure out how to add map entries. I presume I need a new file. – Russ Lyons Dec 29 '15 at 17:59
  • P.S. Probably http://tex.stackexchange.com/questions/88423/manual-font-installation will tell me. – Russ Lyons Dec 29 '15 at 18:20
  • Robert: Sorry, I still am confused. First, how did you decide on ntxtmr.afm? I would have thought it was qtmr.afm. Second, there seem to be many map files for various interpreters; what map files should I modify or create? I think you are saying I only need to worry about psfonts.map. Third, do I need either of udpmap-sys or texhash? I think so, but I'm not sure how they work. – Russ Lyons Dec 30 '15 at 01:29
  • @RussLyons For the afm file I simply looked into the directory fonts/afm/public/newtx/, because the font you use is part of the newtx package. With regards to installing your new newtx-ext.map, this is really not different from enabling any other map file, as detailed in the question you linked to: put the file in a place where it will be found, update the data base, and enable the map file with updmap(-sys). – Robert Dec 30 '15 at 01:55
  • @Robert Thanks. Now pdftex runs fine, but xdvi complains and I cannot create the pdf from the dvi. The errors are kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+32/600 --dpi 632 ntx-Regular-tlf-ot1-20, mktexpk: don't know how to create bitmap font for ntx-Regular-tlf-ot1-20., and mktexpk: perhaps ntx-Regular-tlf-ot1-20 is missing from the map file.. – Russ Lyons Dec 30 '15 at 02:50
  • @RussLyons Sorry, I have no idea about xdvi. Does another texhash help? Does dvips run fine? – Robert Dec 30 '15 at 02:56
  • @Robert I did texhash multiple times, alternating with udpmap. dvips has the same problem. I tried sudo -H mktexlsr, but that did not help. – Russ Lyons Dec 30 '15 at 03:04
  • @RussLyons What does kpsewhich newtx-ext.map yield? And what kpsewhich ntx-Regular-tlf-ot1+20.tfm? And what happens if you run dvips -u+newtx-ext.map? – Robert Dec 30 '15 at 03:23
  • @RussLyons Maybe you should edit your question detailing what you did and what still doesn't work. Or even ask a new question, as installing the map file is not really related to font expansion but is a "normal" installation problem. – Robert Dec 31 '15 at 00:23
  • @Robert Are you sure that ntxtmr should appear in the map file just before TeXGyreTermes-Regular? At least, not both should appear. I think this does not comport with the format and leads to an error when running dvipdfmx as follows: dvipdfmx:warning: Invalid char in fontmap line: T dvipdfmx:warning: Invalid map record in fontmap line 16520 from pdftex.map. dvipdfmx:warning: -- Ignore the current input buffer: ntx-Regular-tlf-ot1+20 ntxtmr TeXGyreTermes-Regular " 1.020 ExtendFont encntx-ot1-tlf ReEncodeFont " <ntx-ot1-tlf.enc <[ntx-ot1-tlf.enc <qtmr.pfb – Russ Lyons Jan 08 '16 at 21:54
  • @Robert For ntx-Italic-tlf-ot1, I presume I want ntxtmri.afm. For ntxmi, I presume I cannot use an afm file, but instead want rntxmi.pfb. If so, why shouldn't I have used qtrm(i).pfb for the others? But how do I convert pfb to tfm? – Russ Lyons Jan 08 '16 at 23:12
  • @RussLyons Firstly, sorry, the map entries were indeed wrong, my bad. Secondly, you can convert a pfb to afm with pf2afm (from ghostscript) – Robert Jan 08 '16 at 23:28
  • @Robert OK, thanks. Also, I realized that (I think) for ntxmi, I want rtxmi.afm. – Russ Lyons Jan 08 '16 at 23:29
  • If you do that you will lose all kerning information as this is found only in the AFM file - not the PFB file. You don't turn PFB files into TFM. You always use AFM. The metrics are in the AFM. Only the little pictures are in the PFB. – cfr Jan 08 '16 at 23:29
  • I was wrong about using rtxmi.afm. In fact, there appears not to be any afm associated to ntxmi, but, rather, ntxmi.vf. This vf is explained here: http://tex.stackexchange.com/questions/151872/convert-certain-newtx-fonts-to-truetype-or-opentype I can convert vf to pl and pl to tfm, but how would I do font expansion? – Russ Lyons Jan 08 '16 at 23:54
  • @RussLyons Sorry, but this is really getting too confusing now. Could you not update your question, saying which fonts you are using and which you would like to have expanded? (ntxmi is a math font. And as it is virtual font, you'd have to use fontinst, for which you would need the source.) – Robert Jan 09 '16 at 02:11
  • @Robert Sorry for the confusion. I will limit myself to the ntx fonts listed in your edited answer. I'd like to include ntxmi, but if that is too hard, I can omit it. What do you mean by "for which you would need the source": do you mean the source for fontinst? If I use fontinst and use \latinfamily, is there documentation of that command? – Russ Lyons Jan 09 '16 at 02:35
  • @RussLyons Yes, I was referring to the fontinst source file (which is not included in the newtx package). It might be possible to reverse-engineer this virtual font, ie. to reconstruct the series of fontinst commands, but that's not something I would advise to do (\xscalefont would be the relevant command to add for expansion). As for documentation, there's fontinst.pdf, fisource.pdf, and also the fontinstallationguide.pdf. \latinfamily is only meant to install (Latin) text fonts, not math fonts, so it wouldn't be of any help in the case of ntxmi. – Robert Jan 09 '16 at 03:04
  • @Robert I don't know what the source file is for fontinst, but that's OK. I'm not going to delve into it. None of the docs you mention document \latinfamily; however, since you say that's not useful here, I'll forget it. In any case, it seems too hard to deal with virtual fonts, so I'll forget about enabling expansion for ntxmi. – Russ Lyons Jan 09 '16 at 03:33
  • I have posted a new question for installing the fonts here: http://tex.stackexchange.com/questions/286838/how-can-i-install-newly-created-fonts – Russ Lyons Jan 09 '16 at 21:04
  • 1
    What does <ntx-ot1-tlf.enc <[ntx-ot1-tlf.enc do? I mean the doubling here. Why not just <[ntx-ot1-tlf.enc? – cfr Jan 10 '16 at 03:45
  • @Robert Does "doubling" have any effect? The two phrases are slightly different, as one has a [ and one does not. I do not see any difference in output if I change the map file (and I still have the problem of distortions when the expanded font is not the only font for output produced via dvipdfmx). – Russ Lyons Jan 11 '16 at 19:32
  • @Robert I tested your instructions for cmr. They work, except that the output pdf has lighter glyphs for the expanded fonts; the dvi is the same color for both, while dvips gives lighter color for the unexpanded glyphs (same with dvipdf or ps2pdf). What's going on? – Russ Lyons Jan 11 '16 at 20:31
  • I added detail to the cmr problem here: http://tex.stackexchange.com/q/287337/58928 – Russ Lyons Jan 12 '16 at 22:16