strange behaviour of \fontseries

Font attributes are changed in the order

\fontencoding
\fontfamily
\fontshape
\fontseries
\fontsize

So what happens with your input is that first the shape is changed to l, which Computer Modern hasn't, so it's substituted with the default m.

Using the proper order the output is as expected:

\documentclass{article}

\begin{document}

\fontfamily{NotoSans-TLF}\fontseries{l}\selectfont Lorem ipsum

\end{document}

Most important is to have the family declaration at the beginning, because this will cause LaTeX to read the font definition file (if not already done) so the possible other attributes are known.


The difference between the ul and the l series is that the LaTeX kernel has a rule for the m/l switch:

\DeclareFontSeriesChangeRule {m}{l}{l}{m}

This rule means that if m (first argument) is the current series, and l is requested (second argument) then l is tried (third argument) and if it doesn't exist the series falls back to m (fourth argument).

As egreg wrote, you are trying to change the series while cmr is still active, and so, as it has no l-series, m is forced.

You can get a similar effect for ul if you declare a rule for it too:

\documentclass{article}

\begin{document}

{ \fontseries{ul}\fontfamily{NotoSans-TLF}\selectfont Lorem ipsum }

\DeclareFontSeriesChangeRule {m}{ul}{ul}{m}

{ \fontseries{ul}\fontfamily{NotoSans-TLF}\selectfont Lorem ipsum }

\end{document}  

enter image description here

You can avoid the fallback to m by removing the fourth argument from the rule:

\documentclass{article}

\DeclareFontSeriesChangeRule {m}{l}{l}{}
\begin{document}

\fontseries{l}\fontfamily{NotoSans-TLF}\selectfont Lorem ipsum 

\end{document}

enter image description here

Tags:

Fonts