# NFSS-like selection of font weights using fontspec and xelatex

OK, so I have mastered fontspec to the extent that I can say

`\setromanfont[Mapping=tex-text,Ligatures=Common,Numbers=OldStyle]{Sabon LT Std}`

and indeed, for effect, I can say stuff like

`\newfontfamily{\ultrablack}[UprightFont={Syntax LT Std Ultra Black}]{Syntax LT Std}`

and lo! and behold! I can relatively easily switch between fonts and weights. Relatively.

but say that I would like to be able to do the proper nfss thing:

`\fontfamily{pxt}\fontseries{c}\fontshape{n}\fontsize{12pt}{14.4pt}\selectfont`

There are selectors, indeed, to specify `UprightFont`, `Bold`, `BoldItalic` and `Italic`, but not to specify `SemiBold`, `UltraBlack` or `Light Condensed`. Unless I am missing something.

Any and all pointers or advice welcome.

Thank you.

• If you want to setup a family with more shapes/weights than you can get with the standard options of fontspec it is imho the best to write suitable `.fd` files. You can find examples (for the lmr/lmss/lmtt families) in the euenc package. For xelatex you should write `eu1XXX.fd` files. eu2 is for lualatex. Nov 24 '13 at 17:47

If you want to setup a family with more shapes/weights than you can get with the standard options of fontspec it is imho the best to write suitable .fd files. You can find examples (for the lmr/lmss/lmtt families) in the euenc package. For xelatex you should write eu1XXX.fd files. eu2 is for lualatex. –

## Edit 2017

`fontspec` has now an option `FontFace` to add more shapes and weights, so .fd-files are not really needed anymore.

But if one want to do it: In current texsystems the name of the standard encoding for lualatex and xelatex is now TU, so one should write TUxxx.fd-files.

Ulrike Fischer’s answer is good, but I’ll give an example with the GitHub version of EB Garamond.

``````\newfontfamily\ebgaramond{EBGaramond}[
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
ItalicFont = *-Italic ,
FontFace = {mb}{n}{*-Medium},
FontFace = {mb}{it}{*-MediumItalic},
FontFace = {sb}{n}{*-SemiBold},
FontFace = {sb}{it}{*-SemiBoldItalic},
FontFace = {eb}{n}{*-ExtraBold},
FontFace = {eb}{it}{*-ExtraBoldItalic},
Extension = .otf ]
``````

The abbreviations for the font series, such as `sb` and `eb`, are taken from The LaTeX Font Installation Guide. Note that `mb` and `db` are not present in many other lists (such as the one in The LaTeX Companion). Medium (`{mb}`) is between Regular and Semibold, and Demibold (`{db}`) is between Semibold and Bold. If there’s only one weight between Regular and Bold, I recommend making it `{sb}`, as for example Computer Modern Demi does.

You might also find it convenient to define commands such as:

``````\DeclareRobustCommand\sbseries{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}
``````

This declares `\textsb{...}` and `\sbseries` commands analogous to `\textbf{}` and `\bfseries`.