4

The STIX Two Math font leaves large gaps between some pairs of characters, such as 'dp' or 'df'. The Lua otf font handler is able to reduce these gaps for some pairs (e.g., 'ab' or 'ad'), but it seems unable to reduce the space following the letter d and the letter f (e.g., for 'dp' and 'fa').

My code is below, with a screenshot of the result. I have defined a math version with reduced kerns (version=changekern). For the ordered pairs in \teststringone, the kerning can be reduced using the kerntest font feature called by version=changekern. For the ordered pairs in \textstringtwo, the feature has no effect on the separation of characters. In particular, the space following d or f cannot be reduced. (The adjustments are set quite large to make them obvious.)

Is this a problem with the STIX Two Math font -- or something else?

I am using STIX Two Math Version 2.13 b171 (STIXTwoMath-Regular-3.otf).

% !TEX TS-program = Lualatex
\documentclass[10pt]{article}

\usepackage{luacode}
\begin{luacode}
    fonts.handlers.otf.addfeature {
    name = "kerntest",
    type = "kern",
        data = {
        [0x1d44e] = { [0x1d44f] = -100,  -- mathematical italic small a and b
                      [0x1d450] = -100,  -- mathematical italic small a and c
                      [0x1d451] = -100,  -- mathematical italic small a and d
                      [0x1d453] = -150,  -- mathematical italic small a and f
                      [0x1d45d] = -150}, -- mathematical italic small a and p
        [0x1d451] = { [0x1d44e] = -200,  -- mathematical italic small d and a
                      [0x1d44f] = -200,  -- mathematical italic small d and b
                      [0x1d453] = -250,  -- mathematical italic small d and f
                      [0x1d45d] = -250}, -- mathematical italic small d and p
        [0x1d453] = { [0x1d44e] = -250,  -- mathematical italic small f and a
                      [0x1d45d] = -250}, -- mathematical italic small f and p
        [0x1d45d] = { [0x1d451] = -50},  -- mathematical italic small p and d
        }
    }
\end{luacode}

\def\teststringone{$ab$ $ac$ $ad$ $af$ $ap$ $pd$}
\def\teststringtwo{$da$ $db$ $df$ $dp$ $fa$ $fd$}

\usepackage{unicode-math}
\setmainfont{STIX Two Text}[RawFeature={kerntest}] 
\setmathfont[Scale=MatchUppercase]{STIX Two Math}  
\setmathfont[version=changekern,Scale=MatchUppercase,RawFeature={kerntest}]{STIX Two Math}  

\begin{document}

\teststringone

\teststringtwo 

\mathversion{changekern}

\teststringone

\teststringtwo 

\end{document}

Shot of kerning changes or lack thereof

2
  • d has an italic correction and that takes precedence. Oct 4, 2021 at 7:04
  • @UlrikeFischer - Thanks. Is there a way to override this in Lua? (I eventually did the obvious d\mkern-1mu p, but am hoping to have a more general solution.) I assume that f is also italic corrected?
    – John
    Oct 4, 2021 at 11:31

0

You must log in to answer this question.

Browse other questions tagged .