The result of \itshape or \textit{} is the italics of the main font in our document. If I have other fonts set for different environments, I could access their italics by the use of \fooitalics via a definition of \newfontfamily{\fooitalics}[Path]{someitalics.ttf}. But how can I use italic fonts in a new command which is designed to be workable in different environments with different environment specific fonts?
For example, I want a new command \qqit to use double quotes symbol and make text to be italic, if I define it as \newcommand{\qqit}[1]{{\itshape\qq{#1}}}, then it works in the environment which uses the main font, but doesn't work for other environments with other fonts.
\usepackage{xeCJK}
\usepackage[T1]{fontenc}
\usepackage{domitian} % for the main font
\newfontfamily{\notefont}[Path=./fonts/]{LinBiolinum.ttf} % for note environment
\newfontfamily{\notefontitalic}[Path=./fonts/]{LinBiolinum_Italic.ttf}
\usepackage[most, minted]{tcolorbox}
\usepackage{changepage}
\tcolorboxenvironment{note}{blanker, breakable, before skip=6pt,after skip=16pt, borderline west={1mm}{0pt}{myblue}}
\newenvironment{note}{\begin{adjustwidth}{3mm}{0mm}}{\end{adjustwidth}}
\usepackage{textcmds} % qq for double quotes
\newcommand{\qqit}[1]{{\itshape\qq{#1}}}
\begin{note}
In this note, the \qqit{notefont} is used.
\end{note}
In this paragraph, the \qqit{main font} is used.
The first "notefont" is not italics as the main font is not used in that environment.
If I change the command to \newcommand{\qqit}[1]{{\notefontitalic\qq{#1}}}, then it uses the 'notefont_italic.ttf' other than the main font italics for "main font":



\rmfamily\itshapegives a different result then\sffamily\itshape. – Ulrike Fischer Feb 25 '22 at 10:41\usepackage{domitian}with xelatex. – Ulrike Fischer Feb 25 '22 at 10:44