fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

FontFace only works for "new" NFSS series/shapes

Open u-fischer opened this issue 8 years ago • 5 comments

With the FontFace option one can easily add more NFSS series/shapes, but it doesn't work for standard combinations:


\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}%
 [
  FontFace={m}{it}{TeX Gyre Heros/I},
  FontFace={blub}{it}{TeX Gyre Heros/I},
 ] 
\begin{document}
Test
\fontseries{m}\fontshape{it}\selectfont Test %fails
\fontseries{blub}\fontshape{it}\selectfont Test %works

\end{document}

fontface

Would it be possible to either change FontFace or to add e.g. a FontFace* key that allows to overwrite the fonts choosen by fontspec? For large and complicated font declarations it is much easier to use FontFace (if one knows a bit about NFSS ;-)) than to nest ItalicFeatures, SmallCapsFont and the like.

(It would be quite okay if the overwriting could be done only in a second, separate command/step and involved a NFSSFamily-name).

u-fischer avatar Jun 20 '17 09:06 u-fischer

Hmm, that isn’t intentional. I agree you would expect to be able to make all definitions via FontFace. Will investigate...

wspr avatar Jun 21 '17 02:06 wspr

It is certainly what I expect (and want) but the manual speaks only about additional shapes so I couldn't claim that my expectation is documentated ;-).

u-fischer avatar Jun 21 '17 08:06 u-fischer

Strange, for me (still on TL2016 on this laptop), the following works okay for me:

\usepackage{fontspec}
\setmainfont{texgyretermes-regular.otf}%
 [
  FontFace={m}{it}{texgyreheros-italic.otf},
  FontFace={blub}{it}{texgyreheros-italic.otf},
 ] 
\begin{document}
Test
\fontseries{m}\fontshape{it}\selectfont Test %fails
\fontseries{blub}\fontshape{it}\selectfont Test %works
\end{document}

Something to do with the /I? I rarely invoke fonts like this any more so I'm a bit out of practice…

wspr avatar Jun 27 '17 11:06 wspr

The /I is not the problem. The problem seems to be the call by font name. It fails e.g. also if I use "Arial" or FontFace={m}{it}{TeX Gyre Heros}. So probably something leaks out while fontspec accesses the font.

Loading by file names seems to work in most cases. But e.g. not with ariali.ttf: lualatex can find and use the file but not in the FontFace={m}{it}, while xelatex doesn't find it at all.

(Regarding the use of the /I. I look this things up in the log-file. fontspec is so considerate to tell how it calls the fonts ;-)).

u-fischer avatar Jun 27 '17 13:06 u-fischer