Bug 157569 - FILEOPEN: Incorrect formula font size ( fixed doubleclicking on the object )
Summary: FILEOPEN: Incorrect formula font size ( fixed doubleclicking on the object )
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.0.0.beta2
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2023-10-03 11:01 UTC by Xisco Faulí
Modified: 2024-02-24 07:37 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparsion MSO vs LibreOffice 24.2 master (8.57 KB, image/png)
2023-10-03 11:01 UTC, Xisco Faulí
Details
LibreOffice 7.6 vs LibreOffice 24.2 master (103.30 KB, image/png)
2023-10-05 11:03 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2023-10-03 11:01:36 UTC
Created attachment 189971 [details]
Comparsion MSO vs LibreOffice 24.2 master

Steps to reproduce:
1. Open attachment 41418 [details] from bug 32636

-> formulas are barely visible. See comparison

Reproduced in

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0c4913e03e8427a576138601958f2dbf13b8c37b
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2023-10-03 11:02:29 UTC
Regression introduced by:

author	Khaled Hosny <khaled@libreoffice.org>	2023-08-31 14:54:52 +0300
committer	خالد حسني <khaled@libreoffice.org>	2023-08-31 20:41:00 +0200
commit 626d17a8ec270937575e9684a325eb0669327a25 (patch)
tree 1a0a440d5bbe3a170bb8186bbbe8be98e010f467
parent 5b205d2b3946acd79dcb8f5abed88a0bd8afaef4 (diff)
tdf#143213: Fix reading math font settings from file

Bisected with: bibisect-linux64-24.2

Adding Cc: to Khaled Hosny
Comment 2 Xisco Faulí 2023-10-03 11:42:57 UTC
attachment 71096 [details] from bug 57886 is also affected by this issue
Comment 3 Xisco Faulí 2023-10-03 11:56:17 UTC
I see many files affected by this issue. Increasing importance
Comment 4 ⁨خالد حسني⁩ 2023-10-05 10:16:37 UTC
I’m unlikely to be able to work on this for a while, so feel free to revert the problematic change if no one else is working on it.
Comment 5 Xisco Faulí 2023-10-05 10:48:02 UTC
(In reply to ⁨خالد حسني⁩ from comment #4)
> I’m unlikely to be able to work on this for a while, so feel free to revert
> the problematic change if no one else is working on it.

I just realized this is already fixed by 

author	Khaled Hosny <khaled@libreoffice.org>	2023-09-20 09:26:33 +0300
committer	خالد حسني <khaled@libreoffice.org>	2023-09-20 10:12:00 +0200
commit 8bf38cc394f96a1f1592a7bbd62e1f7db03f3db6 (patch)
tree a0cf2de1884445a61bdf3933144070dbe46dbea4
parent b20ca8d951e8205c8b963c6b7407f984053b4094 (diff)
starmath: Don’t set empty font name when reading font format from file

Closing as RESOLVED FIXED

I'll submit a unittest for this
Comment 6 Xisco Faulí 2023-10-05 10:58:56 UTC
Actually it's not completely fixed. After the commit mentioned in comment 5 the formulas are visible but if you double click on them, they increase in size, so the original size is still not correct
Comment 7 Xisco Faulí 2023-10-05 11:00:28 UTC
At least it doesn't look as bad as before. Decreasing importance
Comment 8 Xisco Faulí 2023-10-05 11:03:08 UTC
Created attachment 190040 [details]
LibreOffice 7.6 vs LibreOffice 24.2 master
Comment 9 Xisco Faulí 2023-12-13 15:12:15 UTC
if 626d17a8ec270937575e9684a325eb0669327a25 and 8bf38cc394f96a1f1592a7bbd62e1f7db03f3db6 are reverted, the issue is not fixed so another commit in between is also affecting this issue
Comment 10 Xisco Faulí 2023-12-14 13:19:22 UTC
(In reply to Xisco Faulí from comment #9)
> if 626d17a8ec270937575e9684a325eb0669327a25 and
> 8bf38cc394f96a1f1592a7bbd62e1f7db03f3db6 are reverted, the issue is not
> fixed so another commit in between is also affecting this issue

In master, the problem is fixed if the following patch is reverted:

author	Khaled Hosny <khaled@libreoffice.org>	2023-09-19 10:56:35 +0300
committer	خالد حسني <khaled@libreoffice.org>	2023-09-19 14:22:32 +0200
commit 9e92a17cb6e03beedeeca40bfc8524c2623d31eb (patch)
tree 0fce9772670f1699d511d9690b976b95578fcaaa
parent 37f91706e6efd36074187234530f8c8ee8a3edd8 (diff)
starmath: Improve glyph positioning
Comment 11 Xisco Faulí 2023-12-14 14:56:16 UTC
If https://opengrok.libreoffice.org/xref/core/starmath/source/cfgitem.cxx?r=c37022ff#1003 is changed like

-        pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, SmO3tlLengthUnit())));
+        pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, o3tl::Length::mm100)));


then the original size is correct
Comment 12 Xisco Faulí 2023-12-14 16:39:35 UTC
Hi Mike,
Since you fixed bug 157965 I thought you might be interested in this one which is caused by the same commit.  My knowledge it quite limited in this area
Comment 13 Mike Kaganski 2023-12-15 13:09:49 UTC
https://gerrit.libreoffice.org/c/core/+/160827
Comment 14 Mike Kaganski 2023-12-15 13:21:34 UTC
Xisco: could you please provide a unit test? Unfortunately I don't have cycles. It is enough to have *any* DOCX with an equation; it would import with incorrect size prior to the fix.

The test would need to check the size of the formula; but the check is not straightforward (or else I'd do it myself) - because the size would depend on the font used on import.

Or it could be a UITest, to compare sized before and after entering edit mode...
Comment 15 Commit Notification 2023-12-15 14:03:01 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/80b67e776ae26d60e0935fcc57a8ff6c983bdd15

tdf#157569: FormulaImExportBase::getFormulaSize should return mm/100

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Xisco Faulí 2023-12-15 15:21:30 UTC
(In reply to Mike Kaganski from comment #14)
> Xisco: could you please provide a unit test? 

Hi Mike,
Sure, I'll do it next week. Thanks for the quick fix. Much appreciated.
Comment 17 Commit Notification 2023-12-18 10:34:44 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/3d0a2278aca97370cb22d0d91f746116be2231b1

tdf#157569: FormulaImExportBase::getFormulaSize should return mm/100

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Xisco Faulí 2023-12-18 16:40:09 UTC
My attempt for the unittest is in https://gerrit.libreoffice.org/c/core/+/160917, unfortunately I couldn't find a way to leave the edit mode so the test fails with

- Expression: false
- Unexpected dialog: Error activating object Error: General OLE error.
Comment 19 Xisco Faulí 2024-02-21 12:05:10 UTC
(In reply to Xisco Faulí from comment #18)
> My attempt for the unittest is in
> https://gerrit.libreoffice.org/c/core/+/160917, unfortunately I couldn't
> find a way to leave the edit mode so the test fails with
> 
> - Expression: false
> - Unexpected dialog: Error activating object Error: General OLE error.

I added a UItest in https://cgit.freedesktop.org/libreoffice/core/commit/?id=582dbb28efb39d93b6f9197590a5c64b69dec393
Comment 20 ⁨خالد حسني⁩ 2024-02-24 07:23:35 UTC
Sorry about this and other math bugs, I apparently screwed things up with too confident changes (I naïvely assumed that something that presumably works for online would work for desktop version too)
Comment 21 Mike Kaganski 2024-02-24 07:37:45 UTC
(In reply to ⁨خالد حسني⁩ from comment #20)

No problem at all - just needs follow-us, which I feel easy enough to do myself. Thank you for the improvements!