In a quest for greater understanding of all thing LaTeX, I've been playing around with virtual fonts (eg. replacing a hyphenation character and How to create a virtual font?). However, I can't get LaTeX to recognize my new TFM file and I think the problem lies with my lack of understanding of the \pdfmapline command.

Here are the steps I took:

Copied a known working font from my tex directory:

cp /usr/share/texmf-texlive/fonts/tfm/public/cm/cmr10.tfm .

Created a human-readable format:

tftopl cmb10 cmb10

Edited cmb10.pl and saved the new file to foobar.vpl. In this case I've mapped the letter b->a just to see if what I've done had some effect (see sec. 6 here). Next I compiled the file to a binary format:

vptovf foobar.vpl

This creates foobar.tfm and foobar.vf. From reading around, it seems that the \pdfmapline looks in the local directory, so for the time being, I can leave the files where they are. Now my LaTeX document looks like:

\pdfmapline{=foorbar cmr10}

aaaa bbbb aaaa
\font\test=foobar aaaa bbbb aaaa \the\font

This compiles but it does not replace any of the b's with a's.

  • You don't switch to your test font, you just define it (just write \test after the \font .. foobar definition. And (I am not sure about that) your \pdfmapline should have a + instead of a =.
    – topskip
    Oct 7 '11 at 5:37

As Patrick observed, you aren't switching to the new font.

Indeed, after adding


to the generated pl file, changing the entry for b into

   (CHARWD R 0.555557)
   (CHARHT R 0.694445)
      (SELECTFONT D 0)
      (SETCHAR C a)

and saving as foobar.vpl, after vptovf foobar, the document

\pdfmapline{=foobar cmr10}

aaa bbb aaa

\font\test=foobar aaa bbb aaa

\test aaa bbb aaa


processed with pdftex will give

aaa bbb aaa
aaa bbb aaa
aaa aaa aaa

as expected (the precise alignment is not shown here).

The command \the\font does nothing: it just produces the appropriate declaration for choosing the current font. If you want to print the .tfm file name you have to say \fontname\font. If we add this instruction to the three aaa bbb aaa lines we get

aaa bbb aaa cmr10
aaa bbb aaa cmr10
aaa aaa aaa fooaar

(in the third line the b is changed into a at printing time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.