7

How can I check (using a conditional, preferably) whether an opentype math font is currently loaded (in use)? For example, using the following commands:

\usepackage{unicode-math}
\setmathfont{LucidaBrightMathOT}

I would like to check (afterwards) if that specific font was really loaded and is been used in math mode. Does fontspec, unicode-math (or luaotfload) provides such facility?

For the curious: I'm trying to correct what (I think) is a kerning problem with some accents in (some) opentype fonts with math support. For example, the picture below shows the output of $\hat\jmath$ in Lucida OpenType (available from TUG) using LuaLaTeX (or XeLaTeX):

jmath in Lucida Opentype

Which one could correct with $\skew{3}{\hat}{\jmath}$ but, unfortunately, every (problematic) font requires a different position adjustment parameter.

2
  • 3
    Too bad! This should be made known to the font developers.
    – egreg
    Aug 4, 2016 at 19:44
  • @egreg They were notified and indeed the latest Lucida OpenType font version (v1.802) from TUG corrected those kind of problems with accents above dotless j and i.
    – bgeneto
    Apr 10, 2017 at 20:34

1 Answer 1

2
  • Macro \l__um_fontname_tl holds the name of the math font. However, it is the name that was given to \setmathfont. Therefore, the same font can have several names.

  • Another way is to inspect one of the font name commands used for math. The command name also contains the font name.

Example file:

\documentclass{article}

\usepackage{unicode-math}
\setmathfont{Asana Math}

\begin{document}
  The math font is \csname l__um_fontname_tl\endcsname.

  $
    \makeatletter
    \edef\x{\the\textfont2}
    \edef\x{\expandafter\strip@prefix\meaning\x}
    \mbox{\ttfamily\x}
  $
\end{document}

Result

You must log in to answer this question.

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