# How to use mlmodern fonts with Plain TeX or OpTeX?

I would like to systematically use mlmodern fonts with Plain TeX and even OpTeX, but I am unable to convert the code of mlmodern.sty into a code which could be understood by the tex or optex compilers. Is this possible?

For plain TeX you have to essentially repeat all the “fonts” part in plain.tex.

\font\tenrm=rm-mlmr10 % roman text
\font\sevenrm=rm-mlmr7
\font\fiverm=rm-mlmr5
\font\teni=mlmmi10 % math italic
\font\seveni=mlmmi7
\font\fivei=mlmmi5
\font\tensy=mlmsy10 % math symbols
\font\sevensy=mlmsy7
\font\fivesy=mlmsy5
\font\tenex=mlmex10 % math extension
\font\preloaded=rm-mlmss10 % sans serif
\font\preloaded=rm-mlmsso10 % sans serif italic
\font\tenbf=rm-mlmbx10 % boldface extended
\font\sevenbf=rm-mlmbx7
\font\fivebf=rm-mlmbx5
\font\tentt=rm-mlmtt10 % typewriter
\font\preloaded=rm-mlmtto10 % slanted typewriter
\font\tensl=rm-mlmro10 % slanted roman
\font\tenit=rm-mlmri10 % text italic
\font\preloaded=rm-mlmu10 % unslanted text italic
\font\preloaded=mlmmib10 % bold math italic
\font\preloaded=mlmbsy10 % bold math symbols
\font\preloaded=rm-mlmcsc10 % caps and small caps
%\font\preloaded=rm-mlmssbx10 % sans serif bold extended
%\font\preloaded=rm-mlmdunh10 % Dunhill style
\font\preloaded=rm-mlmr7 scaled \magstep4 % for titles

\let\preloaded=\undefined % preloaded fonts must be declared anew later.

\skewchar\teni='177 \skewchar\seveni='177 \skewchar\fivei='177
\skewchar\tensy='60 \skewchar\sevensy='60 \skewchar\fivesy='60

\textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
\def\rm{\fam\z@\tenrm}
\textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
\def\mit{\fam\@ne} \def\oldstyle{\fam\@ne\teni}
\textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
\def\cal{\fam\tw@}
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\newfam\itfam \def\it{\fam\itfam\tenit} % \it is family 4
\textfont\itfam=\tenit
\newfam\slfam \def\sl{\fam\slfam\tensl} % \sl is family 5
\textfont\slfam=\tensl
\newfam\bffam \def\bf{\fam\bffam\tenbf} % \bf is family 6
\textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\newfam\ttfam \def\tt{\fam\ttfam\tentt} % \tt is family 7
\textfont\ttfam=\tentt

\tenrm

Abc {\it def\/} {\sl ghi\/} {\bf jkl}

$a+b+\alpha$

$$\sum+\int_\Gamma$$

\bye


I found the names by looking in the .fd files.

Running pdffonts on the PDF file shows

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
VAJVJL+MLMRoman10-Regular            Type 1            Custom           yes yes no       4  0
XAMRRZ+MLMRoman10-Italic             Type 1            Custom           yes yes no       5  0
QLCGIE+MLMRomanSlant10-Regular       Type 1            Custom           yes yes no       6  0
BUCLYS+MLMRoman10-Bold               Type 1            Custom           yes yes no       7  0
HJQQGN+MLMMathItalic10-Regular       Type 1            Custom           yes yes no       8  0
LGTMNF+MLMMathExtension10-Regular    Type 1            Custom           yes yes no       9  0
CMLUYB+MLMRoman7-Regular             Type 1            Custom           yes yes no      10  0

• The lines with \font\preloaded isn't needed in a macro file unused for generating format. And this trick is irrelevant at all today even if a format is generated. Time is hardly saved but the .fmt file is larger. May 6, 2022 at 19:45

For plain TeX. Copy commands \font (lines 400--467) from plain.tex, remove all commands \font\preloaded... and replace names cm* to corresponding existing names of files from the directory fonts/tfm/public/mlmodern/. You have to choose one of encoding for text fonts cs- or ec- or qx- etc. and use only these file names for text fonts. Math fonts mlm* correspond to original cm*. Save this to your macro file. Add lines 477--492 with \textfont... from plain.tex too.

For OpTeX. Key information is written in the mlmodern doc: "OpenType support is planned for future version". I recommend you to ask the authors if this plan in realized. If not then non ASCII languages cannot be simply used with this old mlmodern font implementation. Note that we have Unicode machine LuaTeX and we need Unicode fonts. Doing some very specific re-encodnig macro tricks are not good idea when we have hundreds OpenType fonts with high quality today.

If you have a "future version" from authors with OpenType fonts mentioned in the documentation then you can copy the file f-lmfonts.opm to f-mlmodern.opm and rename the names of the .otf files here to real .otf files in your computer. Then use \fontfam[mlmodern].

If you are using only ASCII language then you can copy files fonts-preload.opm and math-preload.opm and modify tfm names here to the existing names (similary like with plain.tex file). But this approach has no future: we need modern fonts when we are using modern TeX engine. No old fonts where modern is only in their names.

• I am totally satisfied with US-ASCII, and I actually want to read old-fashioned fonts. May 19, 2022 at 14:37