After some struggles I found a way to call a combo-font (which combines glyphs from two fonts) so that I can get various font sizes.
Has anyone an idea how one could inject this code (or other code with a similar behaviour) in a \DeclareFontShape
so that the font could be called through NFSS?
\documentclass[parskip=half-]{scrartcl}
\usepackage{fontspec,xfp}
\newcommand\requestmycombofont[1]{%
\ifcsname mycombofont.#1\endcsname
\else
\font \one = {file:lmmono10-regular.otf} at \fpeval{#1*10}pt
\font \two = {file:lmsans10-regular.otf} at \fpeval{#1*15}pt
\expandafter\font \csname mycombofont.#1\endcsname
= "combo: 1 -> \fontid \one ;
2 -> \fontid \two , 0x41-0x5A;"%
\fi
\csname mycombofont.#1\endcsname
}
\DeclareFontFamily{TU}{xxx}{}
%\DeclareFontShape{TU}{xxx}{m}{n}{<-> how to call the combo font here ??????? }{}
% simply defining \csname TU/xxx/m/n\endcsname is not enough ...
\begin{document}
\section{Direct call}
{
\requestmycombofont{1.1}%
Some Text with Capital Words
\requestmycombofont{1.3}%
Some Text with Capital Words
\requestmycombofont{0.5}%
Some Text with Capital Words
}
\section{Call through nfss?}
\normalsize
\fontfamily{xxx}\selectfont
% should do \makeatletter \requestmycombofont{\fpeval{\f@size/10}}
Some Text with Capital Words
\large
% should do \requestmycombofont{\fpeval{\f@size/10}}
Some Text with Capital Words
\end{document}