Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\addfontfeature relaxes font faces when NFSSfamily was used #417

Open
3 of 4 tasks
mrpiggi opened this issue Feb 29, 2020 · 0 comments
Open
3 of 4 tasks

\addfontfeature relaxes font faces when NFSSfamily was used #417

mrpiggi opened this issue Feb 29, 2020 · 0 comments

Comments

@mrpiggi
Copy link

mrpiggi commented Feb 29, 2020

Description

When a font family is defined with NFSSfamily and several FontFace, using \addfontfeature relaxes all defined font shapes except that one currently used.

I came across this because of an error with package microtype due to this behavior. The package stores all used font shapes in \MT@font@list by hooking into \pickup@font but can not execute a specific \font@name as it is undefined after using \addfontfeature.

Check/indicate

  • Relevant for XeTeX
  • Relevant for LuaTeX
  • Issue tracker has been searched for similar issues?
  • Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}

\usepackage{microtype}
\newcommand*\printMTlist{microtype not loaded\par}
\makeatletter
\@ifpackageloaded{microtype}{%
  \renewcommand*\printMTlist{
    \begingroup
      \string\MT@font@list:\par\smallskip
      \@for\@tempa:={\MT@font@list}\do{%
        \detokenize\expandafter{\@tempa}\par
      }%
    \endgroup
  }
}{}
\makeatother

\newif\ifnfss
% TODO toggle me :)
\nfsstrue

\ifnfss
\def\testfamily{nfsstest}
\else
\def\testfamily{LinLibertine(0)}
\fi
\newcommand*\usetestfont[3]{%
  {\usefont{TU}{\testfamily}{#1}{#2}TU/\testfamily/#1/#2 (#3)}\par%
}
\setmainfont[%
  \ifnfss NFSSFamily=\testfamily,\fi
  Extension      = .otf,
  UprightFont    = *_R,
  ItalicFont     = *_RI,
  BoldFont       = *_RB, 
  BoldItalicFont = *_RBI,
  FontFace={m}{n}{*_R},%
  FontFace={m}{it}{*_RI},%
  FontFace={sb}{n}{*_RZ},%
  FontFace={sb}{it}{*_RZI},%
  FontFace={b}{n}{*_RB},%
  FontFace={b}{it}{*_RBI},%
]{LinLibertine}

\begin{document}
\usefont{TU}{\testfamily}{sb}{n}
\makeatletter
\meaning\font@name\bigskip
\makeatother

\usetestfont{m}{n}{Regular}
\usetestfont{sb}{n}{Semi-Bold}
\usetestfont{b}{n}{Bold}
\bigskip

\expandafter\meaning\csname TU/\testfamily/m/n/10\endcsname\par
\expandafter\meaning\csname TU/\testfamily/sb/n/10\endcsname\par
\expandafter\meaning\csname TU/\testfamily/b/n/10\endcsname\par
\bigskip

%\oldstylenums{0123456789}
\addfontfeature{Color=0000FF99}

\printMTlist\bigskip

\expandafter\meaning\csname TU/\testfamily/m/n/10\endcsname\par
\expandafter\meaning\csname TU/\testfamily/sb/n/10\endcsname\par
\expandafter\meaning\csname TU/\testfamily/b/n/10\endcsname\par
\end{document}

Further details

 *File List*
 article.cls    2019/12/20 v1.4l Standard LaTeX document class
  size10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
fontspec.sty    2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
  xparse.sty    2020-02-25 L3 Experimental document command parser
   expl3.sty    2020-02-25 L3 programming layer (loader) 
l3backend-pdfmode.def    2020-02-23 L3 backend support: PDF mode
fontspec-luatex.sty    2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty
fontspec.cfg
microtype.sty    2019/11/18 v2.7d Micro-typographical refinements (RS)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
microtype-luatex.def    2019/11/18 v2.7d Definitions specific to luatex (RS)
microtype.cfg    2019/11/18 v2.7d microtype main configuration file (RS)
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
 ***********
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant