\sin and \cos using CM font instead of chosen with unicode-math

That's expected, because the operators are typeset with the main document font, which is Latin Modern, if you don't set it otherwise.

\documentclass{article}

\usepackage{mathtools}

\usepackage{unicode-math}

\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}

\begin{document}

    \[
        \sin x
    \]

\end{document}

enter image description here

However, you can set the font used by \mathrm independently of the main text font:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\setmathfont{STIX Two Math}

\setmathrm{STIX Two Text}

\begin{document}

Text sin and math $\sin$

\end{document}

enter image description here


er well this works but can't be the documented interface, perhaps open an issue in the unicode-math github

enter image description here

\documentclass{article}

\usepackage{mathtools}

\usepackage{unicode-math}

\setmathfont{XITS-Math}
\showoutput
\makeatletter
\def\operator@font{\expandafter\expandafter\expandafter\zzz\iftrue\expandafter{\else}\fi}
\def\zzz#1{\symrm{#1}\iffalse{\else}\fi}
\makeatother
\begin{document}

    \[
        \sin x
    \]

\end{document}