[luatex] bad \Umathfractiondelsize calculation

luigi scarso luigi.scarso at gmail.com
Sat Jun 6 17:18:20 CEST 2020


On Sat, Jun 6, 2020 at 9:44 AM Petr Olsak <petr at olsak.net> wrote:

> When I load Unicode math Latin Modern with LuaTeX and try:
>
>      $$ {n \atopwithdelims() k} $$ % i.e. {n \choose k}
>
> then the result looks ugly, the brackets are too big.
>
> The size of these brackets depend on the
> \Umathfractiondelsize\displaystyle prameter.
>
> This parameter is is set to 24.0pt by LuaTeX when the Unicode
> latinmodern-math font at 10pt is loaded. I tried to use fontforge:
>
> fontforge latinmodern-math.otf
>
> menu: Element / Font info, tab: TeX, select: TeX math symbol, click:
> "more params". We can see that fontforge suggests the Delim1 (this is
> the same parameter) as 2390, i.e. 23.9 pt when the font is loaded at10pt.
>
> If I correct it:
>
>       \Umathfractiondelsize\displaystyle=23.9pt
>
>       $$ {n \atopwithdelims() k} $$
>
> then the result looks OK.
>
> I know that this parameter is not present in Unicode MATH table (see
> fontforge menu: Element / Other info / Math info), but the calculation
> done by fontforge to the suggestion of this parameter for TeX is better
> than in LuaTeX. I don't know the internal algorithm in fontforge nor in
> LuaTeX for initializing this parameter, but it would be good idea to
> compare them and do correction in LuaTeX.
>
> Notice about Unicode math loading. I did the Unicode Math loading for
> this test in OpTeX:
>
>      \fontfam[lmfonts]
>
>     \the\Umathfractiondelsize\displaystyle
>     $$ {n \atopwithdelims() k} $$
>
>      \bye
>
> or in LuaLaTeX:
>
>     \documentclass{article}
>     \usepackage{unicode-math}
>     \begin{document}
>
>     \the\Umathfractiondelsize\displaystyle
>     $$ {n \atopwithdelims() k} $$
>
>     \end{document}
>
> or in ConTeXt:
>
>      \starttext
>
>      \the\Umathfractiondelsize\displaystyle
>
>      $${n\atopwithdelims() k}$$
>
>      \stoptext
>
> The last one shows the result 28.8pt and ugly combination number because
> the default size is 12pt here, 24.0*1.2 = 28.8pt.
>
>
\setupbodyfont[10pt]
\starttext
etc

optex and context gives 24.0pt, lualatex gives 23.99744pt

luatex.pdf says:
""
Note 9: FractionDelimiterDisplayStyleSize and FractionDelimiterSize do not
actually ex-
ist in the ‘standard’ OpenType math font Cambria, but were useful enough to
be added.
""
so I guess it's set at format level.

$ grep -r FractionDelimiterDisplayStyleSize
texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua:  if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua:
targetmathparameters.FractionDelimiterDisplayStyleSize=2.40*targetparameters.size
texmf-dist/tex/luatex/luaotfload/fontloader-reference.lua:  if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/luatex/luaotfload/fontloader-reference.lua:
targetmathparameters.FractionDelimiterDisplayStyleSize=2.40*targetparameters.size
texmf-dist/tex/luatex/luaotfload/fontloader-font-con.lua:        if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/luatex/luaotfload/fontloader-font-con.lua:
 targetmathparameters.FractionDelimiterDisplayStyleSize = 2.40 *
targetparameters.size
texmf-dist/tex/luatex/luaotfload/fontloader-2020-05-06.lua:  if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/luatex/luaotfload/fontloader-2020-05-06.lua:
targetmathparameters.FractionDelimiterDisplayStyleSize=2.40*targetparameters.size
texmf-dist/tex/context/base/mkiv/math-dim.lua:
 cramped_display_style       = { "FractionDelimiterDisplayStyleSize",
 "delim1" },
texmf-dist/tex/context/base/mkiv/math-dim.lua:
 display_style               = { "FractionDelimiterDisplayStyleSize",
 "delim1" }, },
texmf-dist/tex/context/base/mkiv/math-dim.lua:
 FractionDelimiterDisplayStyleSize           = t . fraction_del_size     .
display_style,
texmf-dist/tex/context/base/mkiv/font-con.lua:        if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/context/base/mkiv/font-con.lua:
 targetmathparameters.FractionDelimiterDisplayStyleSize = 2.40 *
targetparameters.size
texmf-dist/tex/context/base/mkiv/math-act.lua:                if not
mathparameters.FractionDelimiterDisplayStyleSize then
texmf-dist/tex/context/base/mkiv/math-act.lua:
 mathparameters.FractionDelimiterDisplayStyleSize = 2.40 * size


-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20200606/4eeb600f/attachment.html>


More information about the luatex mailing list.