Description: I have mainly tried this with Math fonts. In this case, Tex Gyre Termes fonts. For example, I can write A_x on LibreOffice Writer and it looks perfectly fine. However, if I type the same thing on LibreOffice Math, there is an unreasonably large gap between A and x. For most other standard fonts, it looks just fine. However, every other Math font that I tested (Tex Gyre Bonum/DeJaVu/Pagella/Schola/Termes Math, Noto Sans Math, Libertinus Math, Latin Modern Math) suffers from this issue. This happens when the fonts in question are italic. I am attaching an .odt file demonstrating this issue, as well as its screenshot. Steps to Reproduce: 1. Go to LibreOffice Math or any other module and insert a formula 2. Type something with regular characters adjacent to characters in subscript/superscript Actual Results: The resulting characters are unusually separated despite there being no space between them. Expected Results: It shouldn't add unnecessary space between character Reproducible: Always User Profile Reset: No Additional Info: Version: 24.8.4.2 (X86_64) Build ID: 480(Build:2) CPU threads: 16; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland) Locale: de-DE (en_GB.UTF-8); UI: en-US Calc: CL threaded
Created attachment 198268 [details] Demonstration of the bug
Created attachment 198269 [details] Screenshot from the attached document
In the case of "DejaVu Math Tex Gyre, Italic", an extra space seems to occur only after "A". (Personally, I feel like there is a little extra space after "b" and "k".) Bibisected with linux-64-24.2 commit dfe42e756b37642355356a6035081f4473609832 author Khaled Hosny <khaled@libreoffice.org> vcl: Use HarfBuzz to get glyph bounding rectangle For consistent cross-platform results that also matches our glyph advances since platform functions might be using hints which we don’t use.
TeX Gyre Termes Math and DejaVu Math Tex Gyre do not have an italic variant, so what you are getting is synthetic slanting of the upright glyph, and there appears to be a bug in calculating the bounding box of synthetically slanted glyphs. Synthetic italic is not really a good idea, and LibreOffice Math does no make use of the math italic glyphs in Unicode math fonts like these, so I suggest using the regular text font (e,g. TeX Gyre Termes) for all math font settings except Math font, or at least use the text font where you need italic or bold.
This is a HarfBuzz bug, reported upstream https://github.com/harfbuzz/harfbuzz/issues/5273.
This is now fixed in HarfBuzz 11.2.0 https://github.com/harfbuzz/harfbuzz/releases/tag/11.2.0
HarfBuzz have been updated and I confirmed that this issue is fixed using latest daily build. Note that when testing the attached document, one needs to double click on the formula to update the preview.