I would like to have an upright \hbar glyph in my documents and I'm using unicode-math. The example in https://tex.stackexchange.com/a/527104/218142 doesn't seem to work when I load unicode-math. The bar obviously moves relative to the h. Why does this happen, and how can I get the upright \hbar when loading unicode-math?
My MWE:
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
\renewcommand{\hbar}{{\mathpalette\hbaraux\relax\symup{h}}}
\newcommand{\hbaraux}[2]{\sbox0{\mathsurround=0pt$#1\mathchar"AF$}\mkern-1mu\lower.07\ht0\box0\mkern-8mu}
( \hbar \scriptstyle\hbar \scriptscriptstyle\hbar )
\end{document}
This MWE produces the following output:



\mathrmto\symup. Why is that? – LaTeXereXeTaL Aug 27 '21 at 19:47