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, range=0x221A]
\definefontfamily     [MainFace] [tf] [Cambria] % or [XITS]
\definefontfamily     [MainFace] [mm] [Cambria Math] % or [XITS Math]
\setupbodyfont [MainFace]
\starttext
\startformula
  \sqrt{\frac{1}{2}}\dorecurse{15}{+\sqrt{\blackrule[width=10pt,height=#1pt,depth=#1pt,color=gray]}} \stopformula
\startformula
  \sqrt{\blackrule[width=10pt,height=100pt,depth=100pt,color=gray]}  
\stopformula
\stoptext

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 here.

Best regards,
Yaroslav

P.S. sometimes I get the following output. Maybe it is related:
otf reader      > cff >     unknown local call ?, case 1 : [] n=0