unicode-math icon indicating copy to clipboard operation
unicode-math copied to clipboard

Strange behavior with math kern

Open YuanshengZhao opened this issue 6 years ago • 2 comments

Description

  • The correction height calculated seems to be incorrect. I do not know the exact value it actually gets, but from its behavior, chances are that the two heights are both incorrect. XeTeX and LuaTeX have different behavior, but none is expected.
  • If one glyph (say, j) has top left math kern, then x_j will be kerned on XeTeX but not LuaTeX, and x_{jj} will be kerned by LuaTeX but not XeTeX. This is somewhat inconsistent. If the base glyph (say, V) has bottom right kern, then similar behaviors happens for V_x and V_{xy}: LuaTeX will not kern V_x.

Check/indicate

  • [x] Relevant for XeTeX
  • [x] Relevant for LuaTeX
  • [ ] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass[fleqn]{article}
\usepackage{unicode-math}
\begin{document}

//This illustrates the first point
\setmathfont{Cambria Math}
\[V_\symbol{9146}\]
\[V_\symbol{9147}\]

//This illustrates the second point
\setmathfont{foo}
//Some font with top left math kern, here I give j a positive kern, 
//meaning that if kerned, j will become farther away from the base glyph
\[x_j\]
\[x_{jj}\]

\end{document}

with XeTeX: image with LuaTeX: image

For the first point, the expected behavior should be: (MS Word) image

I do not know what behavior is desired for the second point.

Further details

For some old version, the behavior with math kern was different: https://tex.stackexchange.com/questions/24261/weird-font-spacing-issue-with-luatex-asana-math Another post that may be related: https://tex.stackexchange.com/questions/312098/luatex-0-95-incorrect-math-kerning This contains the explanation of correction height, by MS: https://docs.microsoft.com/en-us/typography/opentype/spec/math#mathitalicscorrectioninfo-table

YuanshengZhao avatar Dec 25 '18 18:12 YuanshengZhao

@khaledhosny @behdad

stone-zeng avatar Dec 26 '18 02:12 stone-zeng

Perhaps related, kerning (LuaLaTeX only) and vertical position of \bar are strange:

\documentclass{article}
\usepackage{unicode-math}
\begin{document}
$P\bar{4}2m$
\end{document}

xelatex False xelatex True lualatex False lualatex True

  • LuaHBTeX, Version 1.13.2 (TeX Live 2021)
  • XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021)
  • unicode-math 2020/01/31 v0.8q

e-kwsm avatar Nov 03 '21 14:11 e-kwsm