This is a follow-up to my previous question [How can I get an upright \hbar using unicode-math?](https://tex.stackexchange.com/q/612258/218142). I am experimenting with making a `d` with a bar through it like one would use in physics to denote an inexact differential (see also [How to enter symbol for inexact differential in xelatex?](https://tex.stackexchange.com/q/24037/218142) and [How can I call unicode characters in LaTeX or LyX?](https://tex.stackexchange.com/q/313006/218142) and [d with a little line through the top of it](https://tex.stackexchange.com/q/203508/218142)). I see the bar on the `d` glyph seems to shift relative to the letter whereas I don't see that behavior with the `h` character. Is this behavior real and, if so, what causes it? Does it vary with different fonts? Can it be overcome?

Experimenting with the values of `\mkern` did not make the shift go away.

Here is my MWE:

```
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{unicode-math}
\makeatletter
\AtBeginDocument{%
  \DeclareRobustCommand{\hbar}{{\mathpalette\hbar@\relax\symup{h}}}%
}
\newcommand*{\hbar@}[2]{%
  \makebox[0pt][l]{\raisebox{-0.07\height}{\(\m@th#1\mkern-2mu\mathchar"AF\)}}%
}
\makeatother
% Let's try a \dbar glyph for inexact differentials.
\makeatletter
\AtBeginDocument{%
  \DeclareRobustCommand{\dbar}{{\mathpalette\dbar@{\relax}{\symsfup{d}}}}%
}
\newcommand*{\dbar@}[2]{%
  \makebox[0pt][l]{\raisebox{-0.09\height}{\(\m@th#1\mkern+3mu\mathchar"AF\)}}%
}
\makeatother

\begin{document}
\( \hbar \scriptstyle\hbar \scriptscriptstyle\hbar \)

\( \dbar \scriptstyle\dbar \scriptscriptstyle\dbar \)
\end{document}

```

Here is the MWE output:

[![Output showing the difference between hbar and dbar](https://i.stack.imgur.com/S6IMD.png)](https://i.stack.imgur.com/S6IMD.png)

**UPDATE:** After much experimentation, the following seems to work but I can't completely explain why. If I change `[c]` to `[r]` I notice that the bar doesn't move regardless of what I provide for `\mkern`.

```
\makeatletter
\AtBeginDocument{%
  \DeclareRobustCommand{\dbar}{{\symsfup{d}\mathpalette\dbar@\relax\relax}}%
}
\newcommand*{\dbar@}[2]{%
  \makebox[0pt][c]{\raisebox{-0.07\height}{\(\m@th#1\mkern-6mu\mathchar"AF\)}}%
}
\makeatother

```