Bug Hunting Session
Bug 103038 - Math Formula are rendered in system font (Segoe UI) on win8 or 10 when OpenGL is disabled, not the module default OpenSymbol
Summary: Math Formula are rendered in system font (Segoe UI) on win8 or 10 when OpenGL...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
5.2.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks: Font-Rendering Fonts
  Show dependency treegraph
 
Reported: 2016-10-06 15:45 UTC by Andy
Modified: 2019-07-31 08:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
above , the correct display under win7; beneath the bad one under win8 (60.16 KB, image/jpeg)
2016-10-06 15:46 UTC, Andy
Details
test document for zooming in and out (4.35 KB, application/vnd.oasis.opendocument.formula)
2016-10-23 18:27 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy 2016-10-06 15:45:51 UTC
Description:
On win 8 and 10, the formulas written with the equation editor show some symbols with a bad and out of size font, inappropriate for the context.
This holds in particular for the summation and integral symbols, but I have not done a full check and other may behave in the same bad way.
Please notice that under win7 the SAME file with the SAME LO release does NOT display the problem. 
See attached image comparing the two cases, which are clearly indicated

Steps to Reproduce:
1.write a formula with the equation editor including a summation or integral symbol in a PC with win8 or 10
2.save the file and open it on a pc with win7
3. the formula show perfectly under win7 but sum and integrals are bad in win8-10

Actual Results:  
1.write a formula with the equation editor including a summation or integral symbol in a PC with win8 or 10
2.save the file and open it on a pc with win7
3. the formula show perfectly under win7 but sum and integrals are bad in win8-10

Expected Results:
The formula should display as in win7 under all OS


Reproducible: Always

User Profile Reset: The formula should display as in win7 under all OS

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Comment 1 Andy 2016-10-06 15:46:50 UTC
Created attachment 127841 [details]
above , the correct display under win7; beneath the bad one under win8
Comment 2 V Stuart Foote 2016-10-06 17:04:32 UTC
In your Windows 7 rendering that is Open Symbol, your Windows 8/10 rendering is Segoe UI Symbol.

Default font for the Math Formula remains Open Symbol which should installed with LibreOffice. Check it is present--if not, your use of Segoe UI Symbol is a fallback.

Also, check that you do not have a font substitution replacement table in place.

And if you'd like to force use of a font other than OpenSymbol--Cambria Math for example use Tools -> Options -> Fonts and select the Apply Replacement Table check box. Then in the dropdowns for fonts, left is the font to be replaced and right is the font it will be replaced with.  Be sure to check when to apply, and check/OK it to apply.
Comment 3 Andy 2016-10-07 10:27:02 UTC
Thank you for help.
On the win 8 and win10 machines displaying the problem, opensymbol is installed ad I checked right now. 
Please notice that installations of the package LO 5.2.2 on the 3 PCs - win7, ein8 and win10 - were conducted in exactly the same way and resulted in a fullysuccessful install in all of three cases.

Also, the font substitution table in LO settings is totally empty.

So, I applied a substitution rule saying that segoe symbol should be replaced with opensymbol (always), but alas the formula displays just as before: sum and integral are still not opensymbol.
Please note also that in the LO font list in the formatting toolbar, opensymbol is correctly present.

Then I changed the font substitution to Segoe symbol >>>> cambria math, but nothing changed anyway.

Finally I changed the substitution rule so that opensymbol was converted in Cambria Math, and this worked: now I do not see the damn Segoe Symbol anymore, even though Cambria math is not as good quality as Open symbol, since characters are a little bit too heavy (too black I mean) when compared to the rest of the formula in times new roman.

In the end, it seems the problem lies in some inability of opensymbol to be activated or displayed in the equations, even if it is correctly installed. Note that if I insert the summation symbol in the normal text from insert special character >> opensymbol (with no font substitution active) I get it correctly, no replacement with segoe takes place as instead happens in the formulas.

I hope to have stated things clearly.
Any further hints will be appreciated!!!
Comment 4 V Stuart Foote 2016-10-07 13:25:58 UTC
Tested on Windows 10 Pro 64-bit (1607) en-US with
Version: 5.2.2.2 (x64)
Build ID: 8f96e87c890bf8fa77463cd4b640a2312823f3ad
CPU Threads: 8; OS Version: Windows 6.19; UI Render: default; 
Locale: en-US (en_US); Calc: group

also on recent master

Version: 5.3.0.0.alpha0+
Build ID: 89a3f825559753d6600807342ca96c169cd58c87
CPU Threads: 8; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-09-29_23:19:33
Locale: en-US (en_US); Calc: group


Confirming there is a problem with OpenSymbol font use by Formula Editor on Windows builds.

Disabling OpenGL rendering results in the UI for Formula Editor using the system font Segoe UI and Segoe UI symbols on Windows 10. Will check Windows 8.1 in a bit.

STR:

1. Disable OpenGL rendering and restart LibreOffice

2. Open the Math Formula Editor

3. Select the Operators from the dropdown for the Elements pane

Expected: Symbols rendered with well formed OpenSymbol font
Actual: Operator symbols are rendered with block system Segoe UI Symbol font

4. Enter a simple formula, e.g. "int from{0} to{infinity} x ^{2}", note it is rendered with the Segoe UI font(s)

5. save the ODF formula as a document, close

6. Enable OpenGL Rendering and restart LibreOffice

7. Open the test document from step 5.

Expected: that the formula would be rendered in Segoe UI system font
Actual: enabling OpenGL rendering restores use of OpenSymbol


@Andy, do the GPU and drivers on your system(s) support OpenGL use in LibreOffice. If you are able to enable OpenGL rendering (Tools -> Options -> View) and restart, do you restore use of the default Open Symbol fonts to your OLE formulas in Writer?
Comment 5 V Stuart Foote 2016-10-07 23:09:22 UTC
Confirming this issue also impacts Windows 8.1 installs.

Version: 5.3.0.0.alpha0+
Build ID: 36efdec23b86fe28c79fe672bb6862fb57b6e09a
CPU Threads: 8; OS Version: Windows 6.29; UI Render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-05_02:20:01
Locale: en-US (en_US); Calc: group
Comment 6 Andy 2016-10-08 23:03:47 UTC
So If I understood it well this happens only when opengl is not active.... I'll go check what is the situation on my win8 and win10 machines let you know the results. 

Right now I may observe that on my win7 machine, onpegl has the active flag, but right below this in the options dialog window there a message that say that it is at present NOT active. it turns active only if I flag the "Blacklist" option, but i must say that visual rendering of the dialog windows is worse is this latter case...

So may we conclude that on win7 opengl activation is not an issue for this problem.
Comment 7 Andy 2016-10-11 17:17:09 UTC
Hello, I have checked the opengl option on windows 8, it was disabled; when enabled (with the forced -blacklist command, otherwise it will start disabled) the problem disappears and opensykbops is diplayed correctly.
The only problem remaining is that on both my win7 and win8 machines where I forced opengl, the visual rendering is better than when opengl is disabled... Text in dialog windows is less sharp, it feels as if the screen is a bit dirty when compared with the same display without opengl
Comment 8 V Stuart Foote 2016-10-23 17:49:08 UTC
@Khaled, * 

for the brief span while the Harfbuzz based common layout activated SAL_USE_COMMON_LAYOUT variable on Windows was using DirectWrite--this issue was resolved.  But now that we've reverted to using the GDI calls, this issue again is present.

https://gerrit.libreoffice.org/#/c/30156/ and 

https://cgit.freedesktop.org/libreoffice/core/commit/?id=2148c853b0d0deea92b97a810950f4d9f0cbb152

Was OK with...
Version: 5.3.0.0.alpha1+
Build ID: 36bafd3d4ad7fa75649eeab0c9cd1b3d6f53d8e8
CPU Threads: 8; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-21_18:49:50
Locale: en-US (en_US); Calc: CL

But is bad again with... 
On Windows 10 Pro 64-bit (1607) en-US with
Version: 5.3.0.0.alpha1+
Build ID: dc522a114d24ad7c550c072d4f29f50a62260b77
CPU Threads: 8; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-23_07:58:33
Locale: en-US (en_US); Calc: CL

Do we have to drop the DirectWrite?
Comment 9 V Stuart Foote 2016-10-23 18:27:31 UTC
Created attachment 128193 [details]
test document for zooming in and out

Simple test formula to see effect of the switch back to GDI, use with and without SAL Common Layout (Harfbuzz), and with and without OpenGL enabled.
Comment 10 Khaled Hosny 2016-10-23 20:52:51 UTC
(In reply to V Stuart Foote from comment #8)
> @Khaled, * 
> 
> for the brief span while the Harfbuzz based common layout activated
> SAL_USE_COMMON_LAYOUT variable on Windows was using DirectWrite--this issue
> was resolved.  But now that we've reverted to using the GDI calls, this
> issue again is present.
>
> Do we have to drop the DirectWrite?

You need to set SAL_DWRITE_COMMON_LAYOUT=1 to use the DirectWrite code. We want to always use it, but it does does not handle vertical layout correctly right now and this has to be fixed first.
Comment 11 Khaled Hosny 2016-11-16 05:34:56 UTC
Is this still an issue?
Comment 12 V Stuart Foote 2016-11-16 06:07:33 UTC
This is resolved, HarfBuzz layout with GDI based default rendering is handling fallback correctly and OpenSymbol is picked up for formulas. System Segoe is not being picked up in the new text layout engine.

Scaling of glyphs to fit bounding box of nodes with OpenGL rendering is broken, but has no font substitution issue.

On Windows 10 Pro 64-bit (1607) en-US with
Version: 5.3.0.0.alpha1+
Build ID: 84f644eee78106f01486098d446d9163b62927eb
CPU Threads: 8; OS Version: Windows 6.2; UI Render: default; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-15_23:52:44
Locale: en-US (en_US); Calc: CL


=-ref-= 

https://cgit.freedesktop.org/libreoffice/core/commit/?id=d436065bc1c68fc2d90e73253d8c00503c72dfd0
Comment 13 Kevin 2019-07-31 08:26:08 UTC Comment hidden (spam)