latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
243 stars 28 forks source link

Suboptimal size features for math font #389

Closed sgolovan closed 6 years ago

sgolovan commented 7 years ago

When unicode-math loads new math font (for size 10 main font for example) it uses the following size features:

SizeFeatures={{Size=10-},{Size=7-10,Style=MathScript},{Size=-7,Style=MathScriptScript}}

This means that if a font has mathscript variant which looks differently than the main font then starting from \small size and smaller text and math will look differently. As an example, STIX2 Math looks suboptimal for \small or \footnotesize text sizes.

If I use the following size features:

SizeFeatures={{Size=7.01-},{Size=5.01-7.01,Style=MathScript},{Size=-5.01,Style=MathScriptScript}}

then small text/math become better.

May be it'd be better to switch MathScript and MathScriptScript on starting with smaller sizes than it's now? Is it really a good idea that 9.99 size font uses MathScript style?

The two files attached to show the issue: fsize1.pdf fsize2.pdf

Note the inconsistent size for zeros in fsize1.pdf for small size and brlow. fsize2.pdf exhibits any notable differences only for scriptsize and below, which is fine, I think.

The code is the following (fsize1.tex):

\documentclass[a4paper,10pt]{book}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{STIX Two Math}
\setmainfont{STIX Two Text}
\begin{document}
\large
Some \textit{text} 0 $0x+y_x$. (large)

\normalsize
Some \textit{text} 0 $0x+y_x$. (normalsize)

\small
Some \textit{text} 0 $0x+y_x$. (small)

\footnotesize
Some \textit{text} 0 $0x+y_x$. (footnotesize)

\scriptsize
Some \textit{text} 0 $0x+y_x$. (scriptsize)

\tiny
Some \textit{text} 0 $0x+y_x$. (tiny)
\end{document}

and fsize2.tex:

\documentclass[a4paper,10pt]{book}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{STIX Two Math}[
    SizeFeatures={{Size=7.01-},
                  {Size=5.01-7.01,Style=MathScript},
                  {Size=-5.01,Style=MathScriptScript}}]
\setmainfont{STIX Two Text}
\begin{document}
\large
Some \textit{text} 0 $0x+y_x$. (large)

\normalsize
Some \textit{text} 0 $0x+y_x$. (normalsize)

\small
Some \textit{text} 0 $0x+y_x$. (small)

\footnotesize
Some \textit{text} 0 $0x+y_x$. (footnotesize)

\scriptsize
Some \textit{text} 0 $0x+y_x$. (scriptsize)

\tiny
Some \textit{text} 0 $0x+y_x$. (tiny)
\end{document}
wspr commented 7 years ago

Thanks for the detailed suggestions. I thought I’d written some code to improve this behaviour already, but I must have been imagining it!

What should more realistically happen is that if the three sizes are

sf@size = 5 tf@size = 7 f@size = 10

then the transitions happen at 6 and 8.5 (i.e., the average between each nominal size).

I definitely can’t promise a quick update on this but it’s now on my radar. Thanks again.