Bug 143213 - Font formating in Formula not applying
Summary: Font formating in Formula not applying
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL: https://ask.libreoffice.org/en/questi...
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Fonts
  Show dependency treegraph
 
Reported: 2021-07-06 12:01 UTC by RGarudan
Modified: 2023-10-03 11:02 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Font formating in Formula not applying (13.99 KB, image/png)
2021-07-06 12:05 UTC, RGarudan
Details
Screen cast of the problem (1.26 MB, image/gif)
2021-07-06 14:38 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RGarudan 2021-07-06 12:01:31 UTC
Description:
If you change the font of Functions to Bold in Libre Writer, its keep resetting to regular font every time we reopen the file. Is this a bug, or Functions are not allowed to set in bold formatting. If functions can't be set to bold, why is the option for bold given in formatting of Functions in formula. I'm using Windows version 7.0.6
Also, please add a tool to give highlighting to formula.

Actual Results:
Functions in regular font.

Expected Results:
Functions in bold font.
Please see the link to Libre Ask


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Please refer to this question for more details of the issue.

https://ask.libreoffice.org/en/question/317023/font-formating-in-formula-not-applying/
Comment 1 RGarudan 2021-07-06 12:05:57 UTC
Created attachment 173385 [details]
Font formating in Formula not applying

If you change the font of Functions to Bold in Libre Writer, its keep resetting to regular font every time we reopen the file. Is this a bug, or Functions are not allowed to set in bold formatting. If Functions can't be set to bold, why is the option for bold given in formatting of Functions in formula. Im using windows version 7.0.6
Comment 2 V Stuart Foote 2021-07-06 13:25:16 UTC
Can not confirm.

There are no StarMath 'Functions' in the example {{ %pi } over {2} } file.

"Functions" are as found on the the Math formula editor Element's 'Functions' panel.

Currently, only these strings in a sm function will take the assigned 'Function' formatting (the font--including a bold or italic styling, and size):

e
ln
exp
log
sin
cos
tan
cot
sinh
cosh
tanh
coth
arcsin
arccos
arctan
arccot
arcsinh
arcosh
artanh
arcoth
func

They all take the font and size formatting applied via the Format -> Fonts... and Format -> Font Size... dialogs.
Comment 3 RGarudan 2021-07-06 13:55:07 UTC
Im a bit confused its not a bug then Why is the Pi not getting bold. I had turned on bold for everyfont in the font format menu.
see the link to ask. bold for functions are automatically unticking after saving and reopening. 
and also their is no option for highlighting formula
Comment 4 Mike Kaganski 2021-07-06 14:38:15 UTC
Created attachment 173389 [details]
Screen cast of the problem

Pi not getting bold is unrelated to the problem. The real problem is that the bold setting applied to the functions in Math gets reset upon save and reload.
Comment 5 V Stuart Foote 2021-07-06 15:29:52 UTC
(In reply to Mike Kaganski from comment #4)
> Created attachment 173389 [details]
> Screen cast of the problem
> 
> Pi not getting bold is unrelated to the problem. The real problem is that
> the bold setting applied to the functions in Math gets reset upon save and
> reload.


After making some changes from the Format -> Fonts... dialog, when written to ODF Formula (.odf) archive--the stanza is intact

<config:config-item config:name="FontFunctionsIsBold" config:type="boolean">true</config:config-item><config:config-item config:name="FontFunctionsIsItalic" config:type="boolean">false</config:config-item><config:config-item config:name="FontNameFunctions" config:type="string">Libertinus Sans</config:config-item>

But on reopening, while the font name is picked up its isBold status is not.

So, that is confirmed for the filter import.
Comment 6 V Stuart Foote 2021-07-06 15:38:58 UTC
(In reply to RGarudan from comment #3)
> Im a bit confused its not a bug then Why is the Pi not getting bold. I had
> turned on bold for everyfont in the font format menu.
> see the link to ask. bold for functions are automatically unticking after
> saving and reopening. 
> and also their is no option for highlighting formula

Basically, the sm markup uses its own catalog of symbols (glyphs drawn from OpenSymbol font though for bug 101174 we hope to be able to use alternate) and renders those directly as a sm formula "node" based on other metrics of the formula. To make those formula nodes render bold in sm you must prepend bold--e.g. 'bold %pi'

See the Greek characters and Special characters (pg 76 - 79 of Appendix A) in https://documentation.libreoffice.org/assets/Uploads/Documentation/en/MG7.0/MG70-MathGuide.pdf
Comment 7 V Stuart Foote 2021-07-06 15:54:50 UTC
(In reply to V Stuart Foote from comment #5)

> 
> But on reopening, while the font name is picked up its isBold status is not.
> 
> So, that is confirmed for the filter import.

Should note, if changes in the Format font & size dialogs are assigned as new defaults. When the ODF is reopened it honors those defaults (bold or italic are restored).

It is only when the ODF is used as source for a new OLE Formula object, that the filter import does not honor the archives bold or italic value--but does pick up the font assignment.
Comment 8 RGarudan 2021-07-06 16:33:05 UTC Comment hidden (off-topic)
Comment 9 V Stuart Foote 2021-07-06 17:15:18 UTC Comment hidden (off-topic)
Comment 10 fmgtack+libreoffice 2023-03-15 11:21:48 UTC
Indeed, I was just about to file this issue as well. To me, however, it appears as if the issue only occurs when *editing* a formula in a *reopened* document.

When opening the document, any attributes to fonts for Variables, Functions, Numbers, Text are preserved. It is only when the formula is opened for editing that the attributes are lost, and then only when  the formula font settings differ from the default font settings for a newformula. This is LO 7.4.5.1 on Fedora 37.

Steps to reproduce the issue

* Create Formula 1. Set the Italic attribute to any of the font categories.
* Create Formula 2. Set different fonts on that formula, then click "Save" to save the new settngs as default.
* Save the document
* Open it again: attributes of Formula 1 are preserved.
* Double-click Formula 1 and exit formula editor again: attributes are lost
* Double-click Formula 2 and exit formula editor: attributes are preserved (that formula is formatted according to the current Default
Comment 11 Mike Kaganski 2023-03-15 11:30:50 UTC
(In reply to fmgtack+libreoffice from comment #10)
> the issue only occurs when *editing* a formula in a *reopened* document.
> 
> When opening the document, any attributes to fonts for Variables, Functions,
> Numbers, Text are preserved. It is only when the formula is opened for
> editing that the attributes are lost

Indeed, you see this, because your document shows you the *cached image* of your formula, until you enter the formula for editing. The formula data is already not what you expect, but the image still shows what was there in the previous editing session.

See also bug 66463 (dealing with the cached images of formulas).
Comment 12 fmgtack+libreoffice 2023-03-19 13:02:32 UTC
I see. This bug is thus more severe than I expected at first. I just came on to a document today where I recently painstakingly changed fonts in formulae, to see that today, the italics attributes of the equations were reset. That would mean that these formula's all must have been redrawn - I wonder what, besides editing the equation, triggers a redraw. Adding to how painstaking it is to have to change properties for each individual equation, this makes things hardly manageable.
Comment 13 Commit Notification 2023-08-31 18:41:13 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/626d17a8ec270937575e9684a325eb0669327a25

tdf#143213: Fix reading math font settings from file

It will be available in 24.2.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.