# create OML font encoding from a commercial font

I've bought the legacy sans and serif font package and I've inserted it into my TeX/LaTeX distribution, through pltotf, vptovf an similar utilities.

Then I've created a package that allows me to use that fonts in math mode, as I've shown. However, I need to increase the stretch of some glyph boxes, for example the "f"-italic one, as shown in the picture below

To get the second output, actually I need to add manually the \, instruction. So, how can I create the OML font encoding of legacy font, in order to adjust the skip between math glyphs?

In addition, is this the right way to get the results I mean? I must say that I wont create a command like \def\f{f\,}, because in my opinion it is a trivial resolution

-
TeX adds the italic correction after a "math italic" letter (if nonzero). – egreg Jun 18 '13 at 10:45
But I must insert the font as OT1, because it is the only encoding I have, and this encoding does not allow to add the italic correction, instead of OML – Lorenzo Jun 18 '13 at 10:49
What's the italic correction for f in the font? – egreg Jun 18 '13 at 10:55
I mean that in cmmi the width of some glyphs are wider than the same glyphs in cmri – Lorenzo Jun 18 '13 at 11:47
@egreg the interword space \fontdimen2 must be zero for TeX to automatically insert the italic correction. – jfbu Jun 18 '13 at 12:24

It's my first time with the tools I will describe below, but let me explain what I just tried (I am sure at least one crucial step is likely to be wrong and will have to be corrected.)

[edited below to make such a presumably necessary addition to the steps]

[of course in the .tex source below, this is just for testing, and I brutally reassigned the letters symbol font without caring at all for the Greek alphabet; naturally, some additional steps are missing here to separate the Greek letters from the Latin letters, and only re-assign the Latin letters to use the Times Italic font in the T1 encoding]

1. I created a temporary directory
2. I then did tftopl ptmri8r.tfm ptmmi8r.pl. In this way I obtained a human-readable form of the font metrics for the Times font, from psnfss.
3. In my text editor I opened ptmmi8r.pl and then replaced (SPACE R 0.25) with (SPACE R 0.0).

Near the top of the file ptmmi8r.pl created in step 2 there is:

(FONTDIMEN
(SLANT R 0.277)
(SPACE R 0.25)   <-- this is the 0.25 which I replace with 0.0
(STRETCH R 0.15)
(SHRINK R 0.0599985)
(XHEIGHT R 0.440991)
(EXTRASPACE R 0.0599985)
)


continued (sorry I don't know how to resume enumeration with 4, 5, 6...):

1. I saved the file and then did pltotf ptmmi8r.pl ptmmi8r.tfm. I now have this file ptmmi8r.tfm in my working directory.

2. I created a file ptmm.map with the single line: ptmmi8r NimbusRomNo9L-ReguItal "TeXBase1Encoding ReEncodeFont" <8r.enc <utmri8a.pfb This required a bit of research as I had to dig out the pdftex.map file from my installation to just copy the line with ptmri8r to the one above.

3. I then created the following test file, to be compiled with pdftex. And it works.

However: there seems to be a checksum in the tfm file, and I don't know if modifying the font dimension 2 parameter needs an update in the checksum.

However two: it seems that the standard psnfss use of the Times font is via a virtual font ptmri8t and there must be excellent reasons for it. I tried doing the same steps as above but with the vftovp and vptovf tools, but somehow never managed to understand what to do exactly.

Update: ok, so perhaps I now understand some additional steps necessary to get correctly the files for T1 encoding. Additionally to the above, I have done:

1. vftovp ptmri8t.vf ptmri8t.tfm ptmmi8t.vpl
2. I have edited the produced ptmmi8t.vpl in two places: first the fontdimen 2, and then a bit further down the FONTNAME entry: I changed it into (FONTNAME ptmmi8r)
3. after these two edits, I did vptovf ptmmi8t.vpl ptmmi8t.vf ptmmi8t.tfm
4. then \DeclareFontShape {T1}{ptmm}{m}{it} uses ptmmi8t and not ptmmi8r.

end of update

Again, my only knowledge in this area dates back to thirty minutes ago, from reading page 9 of the font installation guide, then typing man tftopl and man pltotf. I hope the font experts will come to correct my steps: the only goal was to get a copy of an existing font with its interword space set to zero, so that TeX would automatically insert italic corrections in math mode.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

% for pdf output only
\pdfmapfile{+ptmm.map}
% ptmmi8r NimbusRomNo9L-ReguItal "TeXBase1Encoding ReEncodeFont" <8r.enc <utmri8a.pfb

\DeclareFontFamily{T1}{ptmm}{}

% earlier versions had ptmmi8r, but certainly this was wrong

% now that files ptmmi8t.vf and ptmmi8t.tfm have also been prepared
% (see update above)
% additionally to ptmmi8r.tfm, the following presumably should be done:

% (does not matter for the Latin letters in math, but I guess does matter
% for accented letters or other symbols in text, with \usefont{t1}{ptmm}{m}{it}

\DeclareFontShape{T1}{ptmm}{m}{it}{
<-> ptmmi8t
}{}

\SetSymbolFont{letters}{normal}{T1}{ptmm}{m}{it}

\DeclareMathVersion {standardinterword}
\SetSymbolFont {letters}{standardinterword}{T1}{ptm}{m}{it}

\usepackage{times}

\begin{document}\thispagestyle{empty}

$f(x)$

% with the edit done for correctly generating also files for T1,
% we can compare the original with the font without interword space:

{\usefont{T1}{ptmm}{m}{it} àé ù}

{\usefont{T1}{ptm}{m}{it} àé ù}

$abcdefghijklmnopqrstuvwxyz$

\textit{abcdefghijklmnopqrstuvwxyz}

\mathversion{standardinterword}

$abcdefghijklmnopqrstuvwxyz$

\mathversion{normal}
$abcdefghijklmnopqrstuvwxyz$

\end{document}


-
what do you mean with "from psnfss"? – Lorenzo Jun 18 '13 at 17:07
is there also a ileki8r.vf file? – jfbu Jun 18 '13 at 17:11
I mean from the files considered as required part of any LaTeX distribution and dealing with the Times, Helvetica, etc..., fonts. – jfbu Jun 18 '13 at 17:12
Ok. In addition, yes: I've also ileki8r.vf. Following the instructions you suggest, my TeX distribution does not recognize ilem font family. – Lorenzo Jun 18 '13 at 17:26
Well if there is also a .vf file, then maybe you could try vftovp ileki8r.vf ileki8r.tfm tobeedited.vpl and then edit the tobeedited.vpl file, rename it, and do then vptovf renamed.vpl renamed.vf renamed.tfm. However I am at my wits ends here and you are going to need support by someone knowledgeable from then on... – jfbu Jun 18 '13 at 17:32