# Internal error: bad native font flag (XeLaTeX, fontspec, newtxmath, libertine, \dot)

I'm trying to use \dot{P} in a math environment.

MWE:

\documentclass{scrartcl}
\usepackage[no-math]{fontspec}
\usepackage{libertineotf}
\usepackage[libertine]{newtxmath}
\begin{document}
$$\dot{P}(t) + 1234567890$$
\end{document}


Without the command \dot everything works as aspected.
With it I get the error: Internal error: bad native font flag and no output is produced.

Without the option no-math or the entire fontspec package (whose functionality I don't even need at the moment) there is an output compiled that includes a correct "dotted" P.
But the paranthesis, the plus sign and the numbers are not set in the Libertine font but rather in CM. Also the spacing information from the newtxmath package seems to get lost (could be related to CM).

I already tried to change the package order. That resulted in an option clash error for fontspec and the same output as without the fontspec package at all.

Any suggestions?
I tried using the libertine package for pdflatex (without fontspec of course) which produced the same output as XeLaTeX without the fontspec package.

Versions/File List:

MikTeX                2.9 64bit, Win7
libertineotf.sty      2012/04/07 5.13-8
fontspec.sty          2012/05/06 v2.2b
newtxmath.sty         2012/06/25 v0.99

-

This a bug in XeTeX resulting from mixing the OpenType (AKA "native") font Libertine with accent from the TFM font newtxmath. It didn't show up in earlier versions because of a bug that prevented the proper utilisation of OpenType math accent positioning that has been recently fixed.

I tried to fix the new bug, but it seems to be a bit tricky. Anyway, I hope it will be fixed by the time of the next release.

-
Two years later, is this bug going to be fixed? –  marczellm Feb 22 '14 at 11:36
Mixing OpenType and TFM math fonts is not something I personally support, so it is a low priority issue, but feel free to open an issue in XeTeX bug tracker so it does not get forgotten again. –  Khaled Hosny Feb 24 '14 at 8:16
I posted sourceforge.net/p/xetex/bugs/89. (This is my first ever bug report on SF, so I hope I didn't get something wrong.) –  marczellm Feb 24 '14 at 8:34
@marczellm: Thanks. –  Khaled Hosny Feb 24 '14 at 10:15

I (finally) found a solution with the help of Hendrik's answer to Dot Derivative Discrepancy.

\renewcommand*\dot[1]{%
\placeaccent{\acc@dot}{#1}%
}
\renewcommand*\ddot[1]{%
\placeaccent{\acc@dot\mkern1.4mu\acc@dot}{#1}%
}


to his code snippet.

This does not help for other accents, of course.
For the \hat{} command I found the following solution:

\renewcommand*\hat[1]{%
\placeaccent{\acc@hat}{#1}%
}


where \acc@hat is defined as:

\def\acc@hat{\mbox{\raisebox{-1.27ex}[0ex][0ex]{\^{}}}}

-