latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

`\newfontfamily` and `\newfontface` #435

Open eg9 opened 3 years ago

eg9 commented 3 years ago

Description

This is a feature request about defining text commands after \newfontfamily and \newfontface.

Check/indicate

Further details

It happens quite frequently that after \newfontfamily and \newfontface, users need a text command for choosing the appropriate font, say

\newfontfamily{\nfe}{Nicest Font Ever}
\DeclareTextFontCommand{\textnfe}{\nfe}

See https://tex.stackexchange.com/search?q=declaretextfontcommand+%2Bfontspec for hits.

My suggestion is to add a suitable command automatically or a different one if specified in the options, so

\newfontfamily{\nfe}{Nicest Font Ever}

would define \textnfe with \DeclareTextFontCommand{\textnfe}{\nfe} whereas

\newfontfamily{\nfe}{Nicest Font Ever}[textcommand=\iwantnfe]

would do \DeclareTextFontCommand{\iwantnfe}{\nfe} instead.

If the automatic addition is not felt appropriate (I can think to various arguments against it), the option would avoid users looking for not really famous commands such as \DeclareTextFontCommand and the interface would be neater.