Bug 104749 - poor formatting of formula node using "over", "sqrt", "nroot" elements
Summary: poor formatting of formula node using "over", "sqrt", "nroot" elements
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2016-12-18 03:39 UTC by john
Modified: 2017-03-01 23:18 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description john 2016-12-18 03:39:29 UTC
Description:
The following formula renders very poorly in a standard installation of LibreOffice:

1 over {2 %sigma} + 1 over a + 1 over %sigma

This problem was reported previously in bug 52225, but that bug was closed due to one narrow part of the problem being solved, but not the whole problem.

The problem here consists of the default symbol font (FONTNAME_MATH) being set to OpenSymbol. This is a crappy font that lacks proper font metric information about the size of its symbols, and the result is that the %sigma in the last term of the above equation hits its head on the division line, rather than lining up with the denominators in the other equations.

Another problem here is the greek symbols still default to italics in all equations. This default behaviour needs to be changed. Use of non-italic Greek symbols is not consistent with other word processing programs (Latex, Word) nor with conventional publishing (textbooks, journal papers).

Another problem here is that there is not even any manual way to override the symbol font used in LibreOffice. It is hard-coded and can only be manually changed one symbol at a time (and even then, it seems that LibreOffice reverts the changes in some caseS).

In summary, these issues are quite a major barrier to the comfortable use of current versions of LibreOffice for mathematical/technical publishing, and I believe should be given quite high p


Steps to Reproduce:
Type the equation: 

1 over {2 %sigma} + 1 over a + 1 over %sigma

Actual Results:  
The '%sigma' from the last term is (1) not lined up with the other denominators and (2) is not in italics as it should be, to match the 'a' of the second term.

Expected Results:
(1) all denominators should line up and (2) the font of %sigma should be italic.

I should be able ot manually change the font/style of my greek symbols, but there is nowhere I can do that.


Reproducible: Always

User Profile Reset: I have seen this issue on multiple LO versions and on multiple machines. The crappy 'OpenSymbol' font is mostly to blame, as well as the default non-italic form of most symbols, and the hard-wired symbol catalog.

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 m.a.riosv 2016-12-18 13:20:31 UTC
Reproducible.
Version: 5.4.0.0.alpha0+
Build ID: 1427817a944f3cf1020b2f06a2ca934847b56ba8
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-12-17_10:04:15
Locale: es-ES (es_ES); Calc: CL
Comment 2 bruno.binet 2017-03-01 17:30:02 UTC
I can reproduce here on LibreOffice 5.1.4, but I have a workaround (not elegant, but...). If you add some empty superscripts, you get correctly aligned terms:

1 over {2 %sigma sup{}} + 1 over a sup{} + 1 over %sigma sup{}

By the way, it works also with italic symbol:

1 over {2 %isigma sup{}} + 1 over a sup{} + 1 over %isigma sup{}

I don't know if it is a font problem or not. I agree that this a a high priority issue (happens also in roots by the way). I also agree that the greek symbols should be italic by default in equations.
Comment 3 V Stuart Foote 2017-03-01 18:48:39 UTC
(In reply to bruno.binet from comment #2)
> I can reproduce here on LibreOffice 5.1.4, but I have a workaround (not
> elegant, but...). If you add some empty superscripts, you get correctly
> aligned terms:
> 
> 1 over {2 %sigma sup{}} + 1 over a sup{} + 1 over %sigma sup{}
> 
> By the way, it works also with italic symbol:
> 
> 1 over {2 %isigma sup{}} + 1 over a sup{} + 1 over %isigma sup{}
> 

No the better way to do this in not with the sup{} superscript syntax which inserts additional vertical space in all the nodes. Instead, add the spacer "`" to the %sigma. So formula becomes

1 over {2 %sigma} + 1 over a + 1 over {`%sigma}

This forces layout calculation of the %sigma node onto the same baseline as the other nodes when used with and over element.  And, actually find need for the spacer to be reasonable, and that this is a WORKSFORME or INVALID.

But I guess there is a case to be made that the logic for nodes using "over" element should account for baseline.

> I don't know if it is a font problem or not. I agree that this a a high
> priority issue (happens also in roots by the way). I also agree that the
> greek symbols should be italic by default in equations.

It is not a font issue, although there are nicer fonts with more consistent metrics than our OpenSymbol--personally I like both Styx Two Math and Asana Math are much cleaner/more complete fonts. Bug 

The 5.1, 5.2, and 5.3 builds have corrected handling of the GreekCharStyle stanza in Expert Configuration so setting that to mode 2 gives the more typical Greek capitals normal, with Greek lowers Italic.

And, for master/5.4.0 the Greek symbols have been set to mode 2 by default.
Comment 4 V Stuart Foote 2017-03-01 18:52:25 UTC
(In reply to V Stuart Foote from comment #3)
> 
> It is not a font issue, although there are nicer fonts with more consistent
> metrics than our OpenSymbol--personally I like both Styx Two Math and Asana
> Math are much cleaner/more complete fonts. Bug 

Sorry got distracted... should have finished that thought with

Bug 101174 -- Enable means to change Formula Editor default font from OpenSymbol via Expert Configuration, is open for enhancement.
Comment 5 bruno.binet 2017-03-01 20:11:50 UTC
(In reply to V Stuart Foote from comment #3)
 
> The 5.1, 5.2, and 5.3 builds have corrected handling of the GreekCharStyle
> stanza in Expert Configuration so setting that to mode 2 gives the more
> typical Greek capitals normal, with Greek lowers Italic.
> 
> And, for master/5.4.0 the Greek symbols have been set to mode 2 by default.

1) Is it possible to backport this new default setting to 5.2/5.3? 
2) In 5.1, if I put a 2 in org.openoffice.Office.Math/StandardFormat/GeekCharStyle, I still have the same behavior (no italic). However, if a put a 1, I get italic lower and capital greek. Do I miss something?
Comment 6 V Stuart Foote 2017-03-01 20:41:15 UTC
(In reply to bruno.binet from comment #5)
> (In reply to V Stuart Foote from comment #3)
>  
> > The 5.1, 5.2, and 5.3 builds have corrected handling of the GreekCharStyle
> > stanza in Expert Configuration so setting that to mode 2 gives the more
> > typical Greek capitals normal, with Greek lowers Italic.
> > 
> > And, for master/5.4.0 the Greek symbols have been set to mode 2 by default.
> 
> 1) Is it possible to backport this new default setting to 5.2/5.3? 

Probably not.

5.2 is essentially EOL with 5.2.6.1 already posted, and 5.3 is feature locked (so would be possible but need approval, but Takeshi preferred not to). 

Reasoning was that a lot of users are used to the %i italic syntax, and while the mode 2 has been cleaned up, it does nothing for existing formulas. Didn't want to confuse folks.

But it was deemed appropriate for 5.4 with enough lead time, so default has been set for master/5.4.

> 2) In 5.1, if I put a 2 in
> org.openoffice.Office.Math/StandardFormat/GeekCharStyle, I still have the
> same behavior (no italic). However, if a put a 1, I get italic lower and
> capital greek. Do I miss something?

Did you restart?

IIRC from bug 52225 -- GreekCharStyle of 0 (default) should be no Italic, 1 should be all italic. And 2 was not correctly implemented.  I've just checked a 5.1.6.2 build with clean user profile and setting GreekCharStyle to value "2" does render the Capitals normal and lowers Italic.  So YMMV with that at 5.1.6.

=-resting-=
Window 8.1 Ent 64-bit en-US
Version: 5.1.6.2 (x64)
Build ID: 07ac168c60a517dba0f0d7bc7540f5afa45f0909
CPU Threads: 8; OS Version: Windows 6.29; UI Render: GL; 
Locale: en-US (en_US); Calc: CL
Comment 7 bruno.binet 2017-03-01 21:19:57 UTC
(In reply to V Stuart Foote from comment #6)
> (In reply to bruno.binet from comment #5)
> > (In reply to V Stuart Foote from comment #3)
> >  
> > > The 5.1, 5.2, and 5.3 builds have corrected handling of the GreekCharStyle
> > > stanza in Expert Configuration so setting that to mode 2 gives the more
> > > typical Greek capitals normal, with Greek lowers Italic.
> > > 
> > > And, for master/5.4.0 the Greek symbols have been set to mode 2 by default.
> > 
> > 1) Is it possible to backport this new default setting to 5.2/5.3? 
> 
> Probably not.
> 
> 5.2 is essentially EOL with 5.2.6.1 already posted, and 5.3 is feature
> locked (so would be possible but need approval, but Takeshi preferred not
> to). 
> 
> Reasoning was that a lot of users are used to the %i italic syntax, and
> while the mode 2 has been cleaned up, it does nothing for existing formulas.
> Didn't want to confuse folks.
> 
> But it was deemed appropriate for 5.4 with enough lead time, so default has
> been set for master/5.4.
> 

I asked because we will adopt the 5.2 stable branch for our science students (4.3 now) and since we have custom documentations and workarounds we don't want to change version each year. Maybe I could push 5.3 even if not stable, but we will stick to that version for a while after. The default lower greek italic would had been a good feature for us. Also, if it does nothing for existing formulas, the change would not break anything. However, I don't have the full picture and will respect the decision. 


> > 2) In 5.1, if I put a 2 in
> > org.openoffice.Office.Math/StandardFormat/GeekCharStyle, I still have the
> > same behavior (no italic). However, if a put a 1, I get italic lower and
> > capital greek. Do I miss something?
> 
> Did you restart?

Yes, but I'm on 5.1.4.2 right now. I will upgrade to 5.2 and it should be ok.
 

> IIRC from bug 52225 -- GreekCharStyle of 0 (default) should be no Italic, 1
> should be all italic. And 2 was not correctly implemented.  I've just
> checked a 5.1.6.2 build with clean user profile and setting GreekCharStyle
> to value "2" does render the Capitals normal and lowers Italic.  So YMMV
> with that at 5.1.6.
> 
> =-resting-=
> Window 8.1 Ent 64-bit en-US
> Version: 5.1.6.2 (x64)
> Build ID: 07ac168c60a517dba0f0d7bc7540f5afa45f0909
> CPU Threads: 8; OS Version: Windows 6.29; UI Render: GL; 
> Locale: en-US (en_US); Calc: CL
Comment 8 bruno.binet 2017-03-01 21:23:59 UTC
BTW, the same spacer trick works for root also. Maybe we should change the bug title. For exemple, there is not enough space under the root here :

1 over sqrt{%mu}

and with the spacer, it is ok:

1 over sqrt{`%mu}
Comment 9 bruno.binet 2017-03-01 21:30:24 UTC
I mean: even without "over" element, sqrt{%mu} has the issue.
Comment 10 V Stuart Foote 2017-03-01 22:52:44 UTC
(In reply to bruno.binet from comment #9)
> I mean: even without "over" element, sqrt{%mu} has the issue.

Right, same issue as with nodes with sqrt and nroot. But it is a little cleaner with theses elements if the spacer is placed after the symbol.

So,

1 over sqrt {%mu`}

or 

1 over nroot {`%epsilon}{%mu`}

It still shifts the base line for the symbols glyph, but does not add too much space between radix and symbol.

Again this has little to do with the font metrics--and is mostly with the way nodes are composed.

But, we should not need to use the spacers to get correct base line format.
Comment 11 V Stuart Foote 2017-03-01 23:18:16 UTC
(In reply to bruno.binet from comment #7)
> I asked because we will adopt the 5.2 stable branch for our science students
> (4.3 now) and since we have custom documentations and workarounds we don't
> want to change version each year. Maybe I could push 5.3 even if not stable,
> but we will stick to that version for a while after. The default lower greek
> italic would had been a good feature for us. Also, if it does nothing for
> existing formulas, the change would not break anything. However, I don't
> have the full picture and will respect the decision. 
> 

If you have a few weeks or 5.3.2 or 5.3.3 [1] would be a good bet, but if your labs are on Windows systems, you should plan to use the "default" GDI/GDI+ rendering rather than OpenGL rendering. 

Say this because the new HarfBuzz based common layout has a number of issues with our DirectWrite/Direct2D implementation that are being worked through--some are quite annoying especially with the Formula editor and in-line formulas.  The GDI/GDI+ "default" rendering avoids many of these but then misses some of the other features that OpenGL rendering offers.  The 5.1 and 5.2 builds do not make use of HarfBuzz based layout on Windows and do not have the same improvements to font handling on Windows that were needed for the HarfBuzz common layout.

=-ref-=
[1] https://wiki.documentfoundation.org/ReleasePlan/5.3