Bug 52225 - Greek symbols default to non-italic, need additional control of the GreekCharStyle property
Summary: Greek symbols default to non-italic, need additional control of the GreekChar...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0, target:5.2.0
Keywords:
: 101009 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-18 08:46 UTC by john
Modified: 2023-08-05 16:30 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
sample from Math w/OpenSymbol replaced by Asana Math (24.43 KB, image/png)
2016-07-20 00:09 UTC, V Stuart Foote
Details
showing bad font alignment for default OpenSymbol font (there is no way to change font for all Greek letters at once) (68.23 KB, image/png)
2016-07-27 04:40 UTC, john
Details

Note You need to log in before you can comment on or make changes to this bug.
Description john 2012-07-18 08:46:24 UTC
I have a large document, about six years old, that I continue to work on using LibreOffice. It is a technical document with many formulae/formulas.

As of LibreOffice 3.5.4.2 on Ubuntu 10.04 LTS, I have experienced a problem with the greek symbols in my equations. Whereas they previously rendered nicely with a good baseline, font and italic style, they now render in a font (OpenSymbol) which on my system appears to have messed-up metrics and in non-italic style. This looks bad, in my eyes, and represents an incompatibility since previous versions render the same equation in different styles.

Two things are now required:
(1) a method for changing my symbol catalog to use the symbol and typestyle that I prefer en-masse, for all the greek symbols at once.
(2) permanent changes to restore the correct historical behaviour, to ensure that old documents render as previously implemented.

If there was a deliberate reason for the change to the math symbol catalog then this needs to be explained somewhere, and a script or somesuch needs to be provide to change all old formula eg from "%alpha" to "%ialpha" or whatever the 'new standard' is going to be.

I note that in all high-quality textbooks, the default for greek symbols in math formulae is italics, and also this is the default in Latex rendering. The non-italic style is very non-standard.

An example of the wrong metrics in the default math symbol catalog can be seen (at least on my system) in the formula "1 over %alpha + 1 over a" -- the alpha and the 'a' are not aligned on a common baseline.
Comment 1 Christina Rossmanith 2012-08-06 20:27:47 UTC
The baseline problem seems to be similar to bug 48965: 

1 over {2 %alpha} + 1 over a  

is rendered correctly wrt the baseline (due to the added 2)
Comment 2 john 2013-07-14 08:49:34 UTC
The non-italic style appears to have been introduced as a result of a misguided poll of users (in my view), in bug 113276. This breaks with good typographical practices (you will never see a professional textbook rendered with non-italic greek letters) and broke the rendering of pre-existing documents. And it broke the rendering of pre-existing documents, without providing anything other than a very onerous manual workaround. And, the Symbol Catalog asks you to specify the font style for a symbol (italic, normal, bold italic, bold) but then in the case of greek letters it GOES AHEAD AND IGNORES YOU!

The situation is made worse by the fact that the Symbol Catalog is hard-wired to a terrible font, OpenSymbol that lacks font metric information, as mentioned in bug 48965 (see the attached image there). There is no easy way to change the font of all greek letters en-masse, short of laboriously changing each one manually (and the GUI is very buggy for this -- just try to change the %alpha from OpenSymbol to Liberation Sans and you will see what I mean).

LO needs 
* a document-level preference/switch to allow the greek letter rendering to be selectable, 
* a way to change the font used for rendering greek symbols, for more consistent and high-quality publications.
* a way to reapply font preferences to all formulae in a document, via the GUI.
* italic/not italic should not be part of the symbol catalog. it should be part of the formula styling set-up, and manually-forceable for those who need it via "ital %alpha" and "nital %alpha".
* a thorough overhaul of the symbol catalog GUI, which is very unintuitive to use (and how can I copy my symbol catalog from one computer to another, assuming I *do* manage to get it into a form that works for me?)
Comment 3 QA Administrators 2015-04-01 14:40:55 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2015-04-22 14:30:28 UTC
(In reply to Christina Rossmanith from comment #1)
> The baseline problem seems to be similar to bug 48965: 
> 
> 1 over {2 %alpha} + 1 over a  
> 
> is rendered correctly wrt the baseline (due to the added 2)

Confirmed that if the 2 is taken away, alpha hits its head to the line.

Win 7 Pro 64-bit Version: 5.0.0.0.alpha0+ (x64)
Build ID: 211c12b9c64facd1c12f637a5229bd6a6feb032a
TinderBox: Win-x86_64@42, Branch:master, Time: 2015-04-18_01:51:17
Locale: fi_FI
Comment 5 V Stuart Foote 2016-07-19 14:09:28 UTC
*** Bug 101009 has been marked as a duplicate of this bug. ***
Comment 6 V Stuart Foote 2016-07-19 15:03:35 UTC
OpenSymbol font metric issues aside (confirming the node shift as in example when other font sets the basline)--there is a legitimate issue in the quality of formulas produced when the discipline norm is for the Greek symbols to be set in italic.

I don't think though that making Greek symbols default to italic is the right solution. In fact it looks like OOo issue 113277 was left unfinished business of the work done for OOo issue 113276 that removed default italic.

Some users prefer alternative, and the workaround of setting StandardFormat "GreekCharStyle" property was provided. O is default and uses non-italic OpenSymbol, 1 can be set and will use the iGreek. 

The workaround remains intact, but must be accessed through Tools -> Options -> Advanced: Expert Configuration -- search for GreekCharStyle,  the stanza will then be written per user into their registrymodifications.xcu configuration. And once created, it can be toggled with text editor there.

Additional enhancement is needed to support common use of mixed capital Greek symbols are straight, and lowers are italic. 

=-ref-=
https://cgit.freedesktop.org/libreoffice/core/commit/?id=cdce29a326c834a269b33dff27e74ed34c82c7df

https://bz.apache.org/ooo/show_bug.cgi?id=113276

https://bz.apache.org/ooo/show_bug.cgi?id=113277
Comment 7 V Stuart Foote 2016-07-19 15:12:35 UTC
UX-advise -- need a decision on if default handling of Greek symbols in Formula Editor should be upright normal as currently implemented, or set italic.

The norm in most technical publications is actually a mix--for Greek symbols upper case are normal, lower case are italic.  We can't support that use case now and formulas must be adjusted. 

Supporting the mixed case norm would be the enhancement.
Comment 8 V Stuart Foote 2016-07-19 16:15:05 UTC
(In reply to V Stuart Foote from comment #7)
> Supporting the mixed case norm would be the enhancement.

And it seems that the mixed use case was already implemented. Setting GreekCharStyle property to "2" places lowers italic, and uppers normal.

Suggest this behavior (the norm for LaTex) should probably be set as default, rather than "0".

With the better default, the "%i" formatting would be the exception in composing formulas in Math.
Comment 9 RGB 2016-07-19 19:31:27 UTC
(In reply to V Stuart Foote from comment #8)
> (In reply to V Stuart Foote from comment #7)
> > Supporting the mixed case norm would be the enhancement.
> 
> And it seems that the mixed use case was already implemented. Setting
> GreekCharStyle property to "2" places lowers italic, and uppers normal.
> 

I tried setting GreekCharStyle on the expert configuration either to 1 and 2 in both, LibO 5.1 and 5.2rc (on Linux, 64 bits) but I cannot see any change: %beta gives non italic beta and %ibeta gives the italic version regardless the value of GreekCharStyle. Is this just an import thing?
Comment 10 Regina Henschel 2016-07-19 20:05:08 UTC
You need to restart LibreOffice after changes in the expert configuration. Have you done it?
Comment 11 RGB 2016-07-19 20:12:11 UTC
(In reply to Regina Henschel from comment #10)
> You need to restart LibreOffice after changes in the expert configuration.
> Have you done it?

Yes. I also checked that no LibO related process was still running.
Comment 12 V Stuart Foote 2016-07-19 20:37:05 UTC
(In reply to RGB from comment #9)

> I tried setting GreekCharStyle on the expert configuration either to 1 and 2
> in both, LibO 5.1 and 5.2rc (on Linux, 64 bits) but I cannot see any change:
> %beta gives non italic beta and %ibeta gives the italic version regardless
> the value of GreekCharStyle. Is this just an import thing?

Sorry about that! It is correct only on recent master.

Yes it looks like the logic for this control has been broken for some time--since early in the 3.6 release, and was only just fixed 8 July 2016 on master by Takeshi A. with https://gerrit.libreoffice.org/#/c/27033

@Takeshi -- assume some your recent work on the formula editor will be back ported?  Also, what are your thoughts on default behavior to be set with GreekCharStyle now that it seems to be functioning correctly?
Comment 13 V Stuart Foote 2016-07-20 00:09:11 UTC
Created attachment 126312 [details]
sample from Math w/OpenSymbol replaced by Asana Math

With current 5.3.0alpha0+ master, normal font substitution from Tools -> Options -> Fonts: Replacement Table seems to correctly by-pass hardcoded OpenSymbol font(FNT_MATH, FNTNAME_MATH, FONTNAME_MATH)

Styx or Asana math font seems to work well and GreekCharStyle mode 2 is rendered as desired with current master.

Clip as with default GDI and SimpleWinLayout

Windows 8.1 Ent 64-bit en-US with
Version: 5.3.0.0.alpha0+
Build ID: 7b86ff8c8a791ddf80d07be3f5309fb889c3f8be
CPU Threads: 8; OS Version: Windows 6.29; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-07-19_10:08:28
Locale: en-US (en_US); Calc: CL

When OpenGL is enabled get a few visual glitches from DirectWrite. I.e. closing the root with its bar, and length of the bar(s) in the exponent.
Comment 14 Takeshi Abe 2016-07-20 04:13:23 UTC
(In reply to V Stuart Foote from comment #12)
> @Takeshi -- assume some your recent work on the formula editor will be back
> ported?
It has been already cherry-picked for libreoffice-5-2 branch.
Running for libreoffice-5-2-0 now: <https://gerrit.libreoffice.org/#/c/27329/>, but is too late for RC3.

>  Also, what are your thoughts on default behavior to be set with
> GreekCharStyle now that it seems to be functioning correctly?
I think setting GreekCharStyle to 2 works again now and will be helpful as a workaround.
At the same time, I am afraid if changing the default value of GreekCharStyle may cause confusion for some users.
For example, given an .odf saved with the old setting, reopening it and changing GreekCharStyle via Expert Configuration cannot modify the value in the document.
Comment 15 V Stuart Foote 2016-07-20 07:31:35 UTC
(In reply to Takeshi Abe from comment #14)
> (In reply to V Stuart Foote from comment #12)
> > @Takeshi -- assume some your recent work on the formula editor will be back
> > ported?
> It has been already cherry-picked for libreoffice-5-2 branch.
> Running for libreoffice-5-2-0 now:
> <https://gerrit.libreoffice.org/#/c/27329/>, but is too late for RC3.
> 

Thanks, that will be helpful.

> >  Also, what are your thoughts on default behavior to be set with
> > GreekCharStyle now that it seems to be functioning correctly?
> I think setting GreekCharStyle to 2 works again now and will be helpful as a
> workaround.
> At the same time, I am afraid if changing the default value of
> GreekCharStyle may cause confusion for some users.
> For example, given an .odf saved with the old setting, reopening it and
> changing GreekCharStyle via Expert Configuration cannot modify the value in
> the document.

Seems like our mode "0" with the OpenSymbol rework at OOo 3.3. caused a lot of issues--encouraging direct entry of "%iSYMBOL" or {italic SYMBOL} formatting.

But then, the mode "1" alternative of all italics (for lower & upper case SYMBOLs) has continued to function, but also had issues of needing to use nitalic format.  

With return of  mode "2"--with lower case sybols to italic, and upper case nitalic--we could really offer the most generally appealing/appropriate default for handling Greek symbols in StarMath markup.

And if we were to set a mode "2" default, doing it now at the 5.2.0 release would be the perfect time. It has been missing since 3.5 releases, and would be reasonable as a reintroduced feature, coupled with a new default behavior for the Formula Editor.

For handling existing documents, it looks like in https://bz.apache.org/ooo/show_bug.cgi?id=113276#c12 Thomas Lange had provided a basic script for converting the StartMath in existing documents to match the selection made for GreekCharStyle mode. Expect it needs a little clean-up, but something similar could be provided for users to offer a reformat of the StarMath to match a change in mode of the GreekCharStyle property. Would avoid a lot of hand editing of the content.xml of the OLE formuals or ODF Formula documents.
Comment 16 Commit Notification 2016-07-24 13:00:31 UTC
Takeshi Abe committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=90517f4071c0a5950f88227c5ec345f4aa6ca0cd

starmath: Add unit test for tdf#52225

It will be available in 5.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 17 john 2016-07-27 03:51:43 UTC
YES YES, WONDERFUL! 

(1) Can I also request that we move from OpenSymbol to Liberation Serif for the font? The kerning and font metrics stuff (I don't know quite the right words) are all wrong for OpenSymbol and don't work properly.

To test/demonstrate this, observe the very poor formatting of the left most '%nu' in the following:
{ 1 over %nu } { %nu over {1 + %nu} }

(2) If we are changing the defaults for Formula behaviour, please also note that the default Formula settings add a large border/spacing around each equation. The result is that the formatting looks terrible for in-line equations/symbols.
Comment 18 john 2016-07-27 04:40:52 UTC
Created attachment 126424 [details]
showing bad font alignment for default OpenSymbol font (there is no way to change font for all Greek letters at once)

added a screenshot showing the font alignment problem. I am reporting it here because as with the Greek italic thing, there is no way to easily change the font for all Greek letters at once. It is a very tedious process using the buggy 'Symbol Catalog' dialog.
Comment 19 V Stuart Foote 2016-07-27 14:04:05 UTC
@john, *

> added a screenshot showing the font alignment problem. I am reporting it
> here because as with the Greek italic thing, there is no way to easily
> change the font for all Greek letters at once. It is a very tedious process
> using the buggy 'Symbol Catalog' dialog.

Correct, changing individual fonts via Specialized Symbols dialog in the Math module is tedious--best to only use that to add additional defined symbols. As is IIUC your edits are changing the font used Unicode codepoint assignments found in http://opengrok.libreoffice.org/xref/core/starmath/inc/types.hxx

Fortunately, substituting an entire font (as in comment 13 ) is trivial. Done from Tools -> Options -> Fonts: "Apply Replacement Table" checkbox and select OpenSymbol on left and a replacement font (Cambria Math, Asana, Stix, etc.) on right column--check button to add. Adjust the "Always" and "Screen" checkbox as preferred and then OK to apply. Reenter the dialog, select and edit to try a different substitute font (or remove to revert to default).

> (1) Can I also request that we move from OpenSymbol to Liberation Serif for
> the font? The kerning and font metrics stuff (I don't know quite the right
> words) are all wrong for OpenSymbol and don't work properly.
> 

> To test/demonstrate this, observe the very poor formatting of the left most
> '%nu' in the following:
> { 1 over %nu } { %nu over {1 + %nu} }

No this is an issue with positioning of nodes composed with OVER and the greek symbols--the baseline shifts. It is even worse on Windows builds with OpenGL rendering (bug 99351). But, it affects glyphs for any font family in use. Trying to fix this with a substituted glyph is the wrong approach, rather the positioning code for composing these types of nodes needs to be tweaked to compose correctly.

> 
> (2) If we are changing the defaults for Formula behaviour, please also note
> that the default Formula settings add a large border/spacing around each
> equation. The result is that the formatting looks terrible for in-line
> equations/symbols.

You can modify the spacing from Tools -> Options -> Advanced: Open Expert Configuration  and search for "StandardFormat", note you can make the font assignments (other than font used for the Greek Symbols) there as well.

=-=-=

@Takeshi -- couldn't we add a StandardFormat stanza to Expert Configuration to set the FNT_MATH, FNTNAME_MATH, FONTNAME_MATH variable there (default would still be OpenSymbol) and not have to depend on the Fonts -> Replacement Table mechanism?
Comment 20 Takeshi Abe 2016-07-28 04:35:26 UTC
(In reply to V Stuart Foote from comment #19)
> @Takeshi -- couldn't we add a StandardFormat stanza to Expert Configuration
> to set the FNT_MATH, FNTNAME_MATH, FONTNAME_MATH variable there (default
> would still be OpenSymbol) and not have to depend on the Fonts ->
> Replacement Table mechanism?
It would worth a separate feature request.
Comment 21 john 2016-07-28 11:56:08 UTC
(In reply to V Stuart Foote from comment #19)
> @john, *
> 
> > added a screenshot showing the font alignment problem. I am reporting it
> > here because as with the Greek italic thing, there is no way to easily
> > change the font for all Greek letters at once. It is a very tedious process
> > using the buggy 'Symbol Catalog' dialog.
> 
> Correct, changing individual fonts via Specialized Symbols dialog in the
> Math module is tedious--best to only use that to add additional defined
> symbols. As is IIUC your edits are changing the font used Unicode codepoint
> assignments found in
> http://opengrok.libreoffice.org/xref/core/starmath/inc/types.hxx

No, as noted at the top of that file, that file doesn't contain the greek letters ('%alpha ... %gamma for example')

> 
> Fortunately, substituting an entire font (as in comment 13 ) is trivial.
> Done from Tools -> Options -> Fonts: "Apply Replacement Table" checkbox and
> select OpenSymbol on left and a replacement font (Cambria Math, Asana, Stix,
> etc.) on right column--check button to add. Adjust the "Always" and "Screen"
> checkbox as preferred and then OK to apply. Reenter the dialog, select and
> edit to try a different substitute font (or remove to revert to default).

But this won't be portable... if I send my file to someone else, they'll see the same broken OpenSymbol font again, right? Especially if they make any changes to a formula. That would be rather puzzling for them, I think.

> 
> > (1) Can I also request that we move from OpenSymbol to Liberation Serif for
> > the font? The kerning and font metrics stuff (I don't know quite the right
> > words) are all wrong for OpenSymbol and don't work properly.
> > 
> 
> > To test/demonstrate this, observe the very poor formatting of the left most
> > '%nu' in the following:
> > { 1 over %nu } { %nu over {1 + %nu} }
> 
> No this is an issue with positioning of nodes composed with OVER and the
> greek symbols--the baseline shifts. It is even worse on Windows builds with
> OpenGL rendering (bug 99351). But, it affects glyphs for any font family in
> use. Trying to fix this with a substituted glyph is the wrong approach,
> rather the positioning code for composing these types of nodes needs to be
> tweaked to compose correctly.

That doesn't sound right to me. When I use Liberation Serif, the %nu symbols in the denominator all line up perfectly. When I use OpenSymbol, the denominator is a  a mess. So, even though I don't quite understand the point you're making about baselines, you can look at my attached screenshot and see that the font family *does* affect this. (I can repeat the test with the same symbol in two different fonts, but I didn't want to be bothered battling the Symbol Catalog again -- please let me know if I need to do that and I will)

As I look at it, there seems to be extra information associated with the symbols in the Liberation Serif font, and the equation editor is making use of that extra information and the symbols look great. If I guessed, I would say that there is information about the capital 'X' height for the font, and even though the %nu' is smaller than the the 'X', the smarter Liberation Serif leave space, but the more stupid OpenSymbol has only got the size of the immediate symbol at hand to deal with, so it doesn't know to leave more space.

> 
> > 
> > (2) If we are changing the defaults for Formula behaviour, please also note
> > that the default Formula settings add a large border/spacing around each
> > equation. The result is that the formatting looks terrible for in-line
> > equations/symbols.
> 
> You can modify the spacing from Tools -> Options -> Advanced: Open Expert
> Configuration  and search for "StandardFormat", note you can make the font
> assignments (other than font used for the Greek Symbols) there as well.

Understood. The point is that the default setting is a bad default choice. I can't think why anyone would want space like this around formulas. Neither for in-line nor line-of-their-own nor "fn [F3]" numbered equations. My suspicion is that the space was added as a workaround for some previous bug to do with grabbing focus on objects with the mouse, or something like that.

> 
> =-=-=
> 
> @Takeshi -- couldn't we add a StandardFormat stanza to Expert Configuration
> to set the FNT_MATH, FNTNAME_MATH, FONTNAME_MATH variable there (default
> would still be OpenSymbol) and not have to depend on the Fonts ->
> Replacement Table mechanism?

That's right, the font replacement mechanism doesn't sound like a good option. But I think the right option is to simply adopt a better symbol font than the current default one (again, try the '%nu' thing above, so that you can see why OpenSymbol is broken).

Thanks so much for your help and attention!
Comment 22 john 2016-07-28 12:17:44 UTC
About changing the font for equations... perhaps in the Format-->Fonts menu there could be an extra setting where 'Greek' symbol font and style (bold/italic) could be selected? The strange 'iGreek' stuff could still sit there in the background, but the font options for '%rho' etc would then become sane and user-accessible. The default fonts would sit as settings in the local LibreOffice install, but any new formula would remember its particular font settings and font sizes so that the formula would stay the same if edited by another user on another machine...

I checked MS Eq Ed 3 -- that's how they used to do it too (https://people.richland.edu/james/misc/editor.pdf#page=3)

Another thing -- why are the Greek symbols even in the Symbol Catalog? Surely we already know where they live...? I think that this Symbol Catalog was a Big Stick that was used to address the Greek symbol thing, but it's overkill and not elegant.
Comment 23 V Stuart Foote 2016-07-28 13:20:50 UTC
(In reply to Takeshi Abe from comment #20)

done, see bug 101174
Comment 24 V Stuart Foote 2016-11-22 22:58:45 UTC
The corrected GreekCharStyle = [0,1,2] setting from Expert Configuration has been doing correct things when set to 2 since the 5.2.0.4 build. 

This should have been resolved fixed, sorry Takeshi. Doing so now.
And, any thoughts on going ahead now and setting a mode 2 default for 5.3.0?
Comment 25 john 2017-05-18 11:15:51 UTC
Yes please! Setting the default mode to '2' would be greatly preferred.
Comment 26 V Stuart Foote 2017-05-18 12:58:19 UTC
(In reply to john from comment #25)
> Yes please! Setting the default mode to '2' would be greatly preferred.

That was your bug 105483. Default setting changed to '2' at 5.4, rejected for 5.3

=-ref-=
master/5.4
https://gerrit.libreoffice.org/#/c/33480/

5.3 backport
https://gerrit.libreoffice.org/#/c/33598/