# Setting font in OPmac or other Plain macros

The OPmac manual explains how to set the font size and discusses the style variations \bf, \it, \em etc. but I do not see a way to set the actual font in use. I'm using XeTeX and would like to access system fonts. If I set the font using, e.g. \font\0="Roboto Condensed" at 10pt\0 then the ensuing OPmac style variations give me variations on the default font, so it doesn't seem to be savvy to the change I've made. Is there a "trick" here I can use to inform OPmac of my changed font?

More generally, if there is a package for plain XeTeX that helps with managing font switches like this I'd like to know about it; my searches have come up mostly with packages that manage switching between fonts in the TeX installation.

• OPmac is intended to stick to the 'palin way': as much a model for your own code as anything else. A quick look suggests to me you are expected to do the same as unadorned plain: define \rm, \it, etc. individually yourself. – Joseph Wright Jul 2 '15 at 15:52
• I guess I'm not sure what I'm supposed to do in Plain... I have been just defining the dozen or so fonts I need directly with \font but there is nothing systematic about it. I'm starting to think this is just a rite of passage for students of TeX. – Daniel Lyons Jul 2 '15 at 15:53
• Unlike LaTeX or ConTeXt, fonts in plain TeX don't have any defined relationship. So \it or \rm are fixed fonts and you have to define them manually. I don't think OPmac alters that. – Joseph Wright Jul 2 '15 at 16:10
• OPmac uses the font selection scheme used in csplain and this is explained in detail in the article "New csplain of 2012" in TUGboat vol 34, petr.olsak.net/ftp/olsak/bulletin/tb106olsak-csplain.pdf see sections Font handling, Math fonts and Unicode fonts. This is English documentation. – wipet Jul 3 '15 at 19:41
• ams-math.tex loads only AMS math fonts collection in the way that they can be simply resized to desired size. Another similar files exist: tx-math.tex loads TX math fonts, for example. The classical tfm fonts are used here. The OTF math fonts were not solved. But XeTeX user can combine classical math fonts with OTF text fonts. OTF text fonts work in csplain font resizing tools. Finally, font families of text fonts are collected to "fontfiles" in csplain where is directly written \font\tenrm, \font\tenit etc. This describes the "relationship" mentioned in the comment by Joseph Wright. – wipet Jul 4 '15 at 5:35

opmac defines its own font selection scheme in the ams-math.tex file with the \regtfm and auxiliary macros. Unfortunately, this fss works only for ordinary tfm fonts, afaik. Again, unfortunately, the macros are documented only in Czech; fortunately, they are simple yet somewhat terse.

• 1. No, the fss works with OTF fonts too. 2. No, macros are English documented in the article in TUGboat, see my comment above. – wipet Jul 3 '15 at 19:44
• Sorry, I don't want to be confrontational. But this way of communication (at tex.sx.com) is very frustrated for me because all communication must be public. I have my personal rules. I never touch to the somebody else's text. Normally, I would sent you a personal email where the misunderstanding can be explained. But I am unable to do it, because users don't show their email addresses here. – wipet Jul 4 '15 at 5:43
• @wipet \relax. this is more like wikipedia. – jarnosz Jul 7 '15 at 3:12

I just found out that you can trick XeTeX into using system wide fonts for text using plnfss's ability to read ordinary fd files from the LaTeX fss. As an example, we shall use Computer Modern Unicode. Copy the following code into eu1cmr.fd.

\ProvidesFile{EU1cmr.fd}
[2015/07/06 font definitions for EU1/cmr.]

\DeclareFontFamily{EU1}{cmr}{}

\DeclareFontShape{EU1}{cmr}{m}{n}{
<-> "[cmunrm]:mapping=tex-text"
}{}

\DeclareFontShape{EU1}{cmr}{m}{it}{
<-> "[cmunti]:mapping=tex-text"
}{}

\DeclareFontShape{EU1}{cmr}{b}{n}{
<-> "[cmunbx]:mapping=tex-text"
}{}

\DeclareFontShape{EU1}{cmr}{b}{it}{
<-> "[cmunbi]:mapping=tex-text"
}{}

% Fake Oblique

\DeclareFontShape{EU1}{cmr}{m}{sl}{
<-> "[cmunsl]:mapping=tex-text"
}{}

\DeclareFontShape{EU1}{cmr}{b}{sl}{
<-> "[cmunbl]:mapping=tex-text"
}{}

\DeclareFontShape{EU1}{cmr}{bx}{n}{<->ssub * cmr/b/n}{}
\DeclareFontShape{EU1}{cmr}{bx}{sl}{<->ssub * cmr/b/sl}{}
\DeclareFontShape{EU1}{cmr}{bx}{it}{<->ssub * cmr/b/it}{}

\endinput


Then you can use the unicode fonts to typeset the following example.

\input plnfss
\input eu1cmr.fd
\usefont{EU1}{cmr}{m}{n}
\obeylines\parindent0pt
De nuevo, ¡oh Salamanca!,
estoy aquí, de la prisión salido.
La frente toda blanca,
el cuerpo envejecido.
¡Si las canas me hiciesen más temido!
\bye


Then LaTeX's commands \textit, \textbf, etc. are available.

You may add other font attributes according to XeTeX's specification.