[NTG-context] Font substitution for extensible symbols

Yaroslav Beltukov ybeltukov at gmail.com
Thu Feb 2 00:11:17 CET 2023

Good day everyone,

I'm trying to replace the math radical symbol (with all its variants) in
one font with another one. Some fonts have too few radical symbols of
different sizes, which results in enormous spacing in radicals.

However, there is a bug in the new font replacement mechanism. Here is MWE:

% 0x221A is the radical symbol
\definefallbackfamily [MainFace] [mm] [TeX Gyre Pagella Math] [force=yes,
\definefontfamily     [MainFace] [tf] [Cambria] % or [XITS]
\definefontfamily     [MainFace] [mm] [Cambria Math] % or [XITS Math]
\setupbodyfont [MainFace]


It works in MKIV but it gives the following error in the latest LMTX:

...mkxl/math-vfu.lmt:675: attempt to get length of a nil value (global 'hp')

It is caused by the following loop in math-vfu.lmt:

        local pv = olddata.parts
        if pv then
            pv = fastcopy(pv)
            newdata.parts = pv
            for i=1,#hp do
                local pvi = pv[i]

One can see that #hp should be #pv. After this correction, the error
disappears and we get different sizes of radicals from the new font.
However, now the extended version of the radical does not work. Actually,
this loop is devoted to copying the parts of the extended symbol, and it
does not work as expected. Obviously, there is something deeper than the
correction of the typo. The same behaviour is for other extensible symbols
(e.g. parentheses).

I hope this issue can be resolved. A more deeper understanding is required

Best regards,

P.S. sometimes I get the following output. Maybe it is related:
otf reader      > cff >     unknown local call ?, case 1 : [] n=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20230202/45e327a6/attachment.htm>

More information about the ntg-context mailing list