unicode-math
unicode-math copied to clipboard
Allow multiple extra fonts to be defined for missing characters.
Description
As stated here, there is no way to request an additional font to be used as fallback if glyphs are missing in the main math font.
The best that can be done is setting the main font for the latin,Latin,greek,Greek,num ranges, but the fallback now needs all glyphs, including, e.g., the decimal point and comma. This prevents using a symbol only font like MdSymbol.
Check/indicate
- [x] Relevant for XeTeX
- [x] Relevant for LuaTeX
- [x] Issue tracker has been searched for similar issues? -- Issue #45
- [ ] Links to <tex.stackexchange.com> discussion if appropriate
Minimal example demonstrating the issue
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{mdsymbol}
\setmathfont[ranges={up/{latin,Latin,greek,Greek,num}}]{Fira Math Light}
\begin{document}
\[
\sum_{a \in b} f_{a}(1,3) = 4.5
\]
\end{document}
Can you please update the example to use explicit filenames? This makes it much easier for me to replicate. Presumably MdSymbol-Regular.otf is the font you are referring to?
Here, and tested this time so I haven't misspelled range.
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{MdSymbol-Light.otf}
\setmathfont[range=up/{latin,Latin,greek,Greek,num}]{FiraMath-Light.otf}
\setmathfont[range=it/{latin,Latin,greek,Greek,num}]{FiraMath-Light.otf}
\begin{document}
\[
\sum_{a \in b} f_{a}(1,3) = 4.5
\]
\end{document}
(As a side note, if you're changing every alphabet range you should be able to just write range=up...)
Wouldn't that change everything?
I don't really see how. Maybe I am missing something, or maybe this feature doesn't quite work as I expect.
Actually in the next release of unicode-math this example won't work. Maybe I need to rethink the interface a little, but the idea is going to be that the first maths font chosen must be an OpenType math font to act as the fallback font and the font from which various dimensions are used.
I could then add a "slow" loading option which checked dynamically at load time which character slots have glyphs actually present in the font.
I don't really see how. Maybe I am missing something, or maybe this feature doesn't quite work as I expect.
No, it looks like I was mistaken, and range=up indeed only changes the alphabet ranges.
the idea is going to be that the first maths font chosen must be an OpenType math font to act as the fallback font and the font from which various dimensions are used.
I could then add a "slow" loading option which checked dynamically at load time which character slots have glyphs actually present in the font.
That's exactly what I was hoping for. Though perhaps it could be the other way around, with metrics taken from one font and a separate one being the fallback. For instance here, Fira Math is a proper math font with many symbols, it's just missing a few that I was trying to take from MdSymbol. Not being able to do this, I gave up and instead tried to use MdSymbol as the main math font with Fira Math as the fallback, but I would prefer to be able to use Fira Math symbols wherever they actually exist.