1

I am in the early stages of experimenting with accents in XeTeX/Unicode. This began because I wanted to be able to use MathTime Pro 2's bold and heavy accents without necessarily making the symbol they accent bold or heavy. As I have been trying to move as much as possible to OpenType fonts, I have been trying to use unicode commands wherever applicable. I am not and do not plan to load unicode-math, even if that means I have to reinvent the wheel in places, because of its interference with mtpro2. I solved the original problem using \Umathaccent, but in the process discovered a strange problem that I have not yet been able to solve. If I use a standard Type 1 font (.pfb), the method works. If I use an .otf font, it gives me a vague XeTeX error and refers me to log files, where I have yet to find anything helpful. The following code...

\documentclass{article}

\usepackage{fontspec}

\newfontfamily\stixupper{STIXTwoMath-Regular.otf}[NFSSFamily=stixupper,Script=Math,Scale=MatchUppercase]
\DeclareSymbolFont{sxup}{TU}{stixupper}{m}{n}

\def\nuhat{\Umathaccent 7 \symsxup "002C6}

\begin{document}
    
    \[
    \nuhat{H}
    \]
    
\end{document}

... gives the error

Process started: xelatex.exe -synctex=1 -interaction=nonstopmode "texstudio_BJdEUf".tex

! Internal error: bad native font flag in `map_char_to_glyph'
Process exited with error(s)

This answer is probably relevant: https://tex.stackexchange.com/a/63249/224317

8
  • I get ! Internal error: bad native font flag in `map_char_to_glyph from xetex texlive 2023 Aug 30, 2023 at 14:36
  • it works in lualatex Aug 30, 2023 at 14:39
  • @DavidCarlisle I found this based on your error: tex.stackexchange.com/questions/63244/…. I changed the command to \nuhat{\symsxup H} and it worked, albeit horribly aligned. Is it possible that there is still a bug that crops up when you mix OpenType and Type 1 fonts in a symbol/accent pair?
    – Mike Pugh
    Aug 30, 2023 at 14:46
  • You presumably got the same error? yes (xetex is only partially supported so it's quite like likely bugs reported are still not fixed) Aug 30, 2023 at 14:48
  • 3
    @MikePugh If you do decide to migrate to LuaLaTeX, you might want to look at github.com/zauguin/mtpro2-lua. There I made a proof of concept of using a Lua based font wrapper to allow MathTime Pro 2 Lite to be loaded with unicode-math as if it were an Opentype font. Aug 30, 2023 at 16:53

1 Answer 1

4

xetex doesn't support placing opentype accents on a classic tfm base. If you really need to, if you make the base not a single character, it uses its generic rules to stick the accent on a box, but you may need to fine tune the positioning as the font metrics can not help.

\documentclass{article}

\usepackage{fontspec}

\newfontfamily\stixupper{STIXTwoMath-Regular.otf}[NFSSFamily=stixupper,Script=Math,Scale=MatchUppercase]
\DeclareSymbolFont{sxup}{TU}{stixupper}{m}{n}


\def\nuhat{\Umathaccent 7 \symsxup "002C6}

\begin{document}

\[
\nuhat{H{}}
\]

\end{document}

produces

enter image description here

in xelatex.

Without the {} you get this from lualatex

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .