add tag
UdiB
[This answer](https://tex.stackexchange.com/questions/180732/) demonstrates how to redefine the `\rm` family in plainTeX (with LuaTeX).

In a similar way, how can I define a new font family, say `\arial`, so that 

```
{%
\arial some regular text, {\bf some bold face text with Arial font}%
}
```
would select the `\bf` font of `\arial`?

MWE:
```
% !TEX TS-program = luatex
\synctex=0
\catcode`@=11
\input{luaotfload.sty} % tex.stackexchange.com/a/180734
\def\arial{\fam\z@\arialrm}
\catcode`@=12

\font\arialrm=Arial at 11pt
\font\arialbf=Arial-Bold at 11pt
\font\arialit=Arial-Italic at 11pt
\arial
some regular Arial text. {\bf Bold face Arial text.}

\vskip4pt
\rm
Text in Computer Modern, {\bf typed in bold (OK)}.
\bye
```

![untitled.png](/image?hash=f5467abc3a8bdd523897a3506e3d8133931209a3ee199d96ea0d075bbaf63cfb)

***Note***: Question has also been asked on [StackExchange](https://tex.stackexchange.com/questions/724005/).
Top Answer
Udi Fogiel
The following lets you define new font families, but it will override the original font switching macros of Knuth. 

The principle is that at each font switch, the font is selected according to the `\_fontnamegen` macro, at size `\_fsize`, with font features `\_fontfeatures`. The `\_fontnamegen` should be defined with the new font selection commands (`\arial` in your example) such that it will produce a file name of the font. You should use `\_currV` in `\_fontnamegen` so that the file name will be selected according to shape, or series you want (italic, bold etc). The `\_fvars` make sure that `\_currV` will have the correct value for the selected font. 

```
\input luaotfload.sty

\catcode`\_=11\catcode`\:=11

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\_famv{rm}

\protected\def \rm {\def\_famv{rm}\_fontsel }
\protected\def \bf {\def\_famv{bf}\_fontsel }
\protected\def \it {\def\_famv{it}\_fontsel }
\protected\def \bi {\def\_famv{bi}\_fontsel }

\def\_fsize{10pt}

\protected\def \_fontsel {%
  \expandafter\font \csname _ten\_famv\endcsname {\_fontnamegen} at \_fsize
  \csname _ten\_famv\endcsname
}

\def\_fvars #1 #2 #3 #4 {%
  \def\_fvar:rm{#1}%
  \def\_fvar:bf{#2}%
  \def\_fvar:it{#3}%
  \def\_fvar:bi{#4}%
}

\def\_currV{\begincsname _fvar:\_famv\endcsname }

\def\_fontfeatures{}

\def\fsize #1{%
  \def\_fsize{#1}\_fontsel
}

\def\selffeat #1{\def\_fontfeatures{#1}\_fontsel }

%%%%%%%%%%%%%%%%%%%%%%%%%%

\protected\def\lmr{%
  \_fvars regular bold italic bolditalic 
  \def\_fontnamegen {[lmroman10-\_currV]:\_fontfeatures }%
  \_fontsel
}

\protected\def\lms{%
  \_fvars regular bold oblique boldoblique 
  \def\_fontnamegen {[lmsans10-\_currV]:\_fontfeatures }%
  \_fontsel
}

\catcode`\_=8\catcode`\:=12

\lmr Test \bf Test \it Test \bi Test \rm Test

\lms Test \bf Test \it Test \bi Test \rm Test

\fsize{30pt} Test

\selffeat{color=FF0000FF;}\fsize{15pt}\it Test

\bye
```
![image.png](/image?hash=ce46aa49e1ba7f1490749b9c4a3b15929ed320c09bcf16e31119c93560aea80a)
Most of the ideas are taken from OpTeX, but with some changes, and major simplifications. In this example there is much less checking, and less features than what OpTeX provides. This example also does not define `\tt` or `\sf` modifiers, for that wyou will need a bit more work. 

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.