Page 1 of 1

Problem with STIX Math font

Posted: Fri Jan 27, 2023 3:09 pm
by Vitalii
Hi, I have a problem with the "STIXTwoMath-Regular" math font. It is a very common and functional font. But when I try to use it (just select from ComboBox in the Equation Editor), I get AV.

I can't attach the font to this post, it's 819 kB. But you can download it freely here:
https://github.com/stipub/stixfonts/tre ... static_otf

Re: Problem with STIX Math font

Posted: Fri Jan 27, 2023 5:33 pm
by Sergey Tkachenko
I cannot reproduce this problem.

Do you use the newest version of TRichView?

Can you send a call stack at the moment of exception?

(Compile your application with stack frames and without optimization (Project | Options, Building | Delphi Compiler | Compiling page).
When an AV happens, open call stack window ( View | Debug Windows | Call stack), select all (Ctrl+A), copy (Ctrl+C))

Re: Problem with STIX Math font

Posted: Sat Jan 28, 2023 10:20 am
by Vitalii
Yes, I am attaching the ZIP. The archive contains a test application and screenshots.
I use the latest version of RV.
And here I recorded the sequence of my actions on video:
https://dystlab.store/download/gftruiw/ ... 120859.wmv

Re: Problem with STIX Math font

Posted: Sat Jan 28, 2023 8:02 pm
by Sergey Tkachenko
Sorry, I still cannot reproduce error, even in your project.
Since AV happens in Adit Math Engine code, I forwarded this question to its developer.

As I can see, this error happens on memory allocation. Do you have some custom memory manager installed in Delphi?

Re: Problem with STIX Math font

Posted: Sat Jan 28, 2023 10:49 pm
by Vitalii
Sergey Tkachenko wrote: Sat Jan 28, 2023 8:02 pm Do you have some custom memory manager installed in Delphi?
I don't use custom memory managers, but If we need a more detailed analysis, I am ready.

Re: Problem with STIX Math font

Posted: Sat Jan 28, 2023 11:23 pm
by Vitalii
I experimented a bit and this is what I found. The STIX font set includes several math fonts:
- STIXTwoMath-Regular.otf (from the "fonts > static_otf" subfolder, 819 KB)
- STIXTwoMath-Regular.ttf (from the "fonts > static_ttf" subfolder, 1483 KB)

Both of these fonts result in an error (AV). But this font worked fine:
- STIXTwoMath-Regular.input.ttf (from the "source" subfolder, 1099 KB).

Maybe you used this last version of font (STIXTwoMath-Regular.input.ttf) and that's why you didn't get AV?

Re: Problem with STIX Math font

Posted: Sun Jan 29, 2023 6:16 pm
by Sergey Tkachenko
AME developer suggested to comment the following code in RVMathTable:

Code: Select all

      if GlyphInfo.MathKernInfo > 0 then
        begin
          KernInfo := PMathKernInfoRec(NativeUInt(GlyphInfo) + GlyphInfo.MathKernInfo);
          KernInfo.SwapTable;
          KernInfo.CopyTo(FGlyphInfo.KernInfo);
        end;
(He said that free version of AME has a bug in processing MathKernInfo, and it is not used in it anyway)

Re: Problem with STIX Math font

Posted: Sun Jan 29, 2023 9:29 pm
by Vitalii
I commented the code and tested AME's solution. The fonts "STIXTwoMath-Regular.otf" and "STIXTwoMath-Regular.ttf" failed anyway (now the AV appears in a different place). It seems to me that the engine does not work properly with some characters, because the font "STIXTwoMath-Regular.input.ttf" works correctly. I will use it for now.

And what does "free version of AME has a bug" mean? Doesn't the paid version have this bug?

Re: Problem with STIX Math font

Posted: Tue Jan 31, 2023 12:29 pm
by Sergey Tkachenko
Sorry, I do not know, I even cannot reproduce this bug: for me, the free version (included in TRichView) works with all math fonts that I have installed.
You can contact AME developer, Denis Sletcov,
math (at) aditmath.com