Bug 103279 - Left brace in formula drawn distorted and displaced with OpenGL render
Summary: Left brace in formula drawn distorted and displaced with OpenGL render
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
(earliest affected)
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
: 102165 (view as bug list)
Depends on:
Blocks: Font-Rendering VCL-OpenGL
  Show dependency treegraph
Reported: 2016-10-17 13:57 UTC by Mike Kaganski
Modified: 2017-03-09 01:43 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:

FIle with problematic formula (108.55 KB, application/vnd.oasis.opendocument.text)
2016-10-17 13:57 UTC, Mike Kaganski

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2016-10-17 13:57:16 UTC
Created attachment 128044 [details]
FIle with problematic formula

Some symbols, e.g. left brace, are drawn incorrectly when OpenGL render is used.
Open the attached file to see the problem.

Bibisecting on bibisect-win32-5.2
git bisect start 'master' 'oldest'
# good: [fe49bc7ee9e094b6e3c03ef59034bf3dbe45ee30] source 87c011134031374cf9104ec2fc39ef121d8a6802
git bisect good fe49bc7ee9e094b6e3c03ef59034bf3dbe45ee30
# skip: [ce67f2fd1f2cd29d2284b612cf8fa8fbea299a2c] source 603a9ada2d8cea9191ca66892ca53fee10678d8a
git bisect skip ce67f2fd1f2cd29d2284b612cf8fa8fbea299a2c
# bad: [61b8ac924ad21329dc9c3ddf8bf4c42c3a861391] source 1b992e4b470af3e2492b520df93d362fe14b4b69
git bisect bad 61b8ac924ad21329dc9c3ddf8bf4c42c3a861391
# skip: [2f40ff456e0e70b2353cca6efb38aa63bb20219b] source c03a11b8f0c93b1c55d9abc9aa224aeb298d1976
git bisect skip 2f40ff456e0e70b2353cca6efb38aa63bb20219b
# bad: [2d089fd17f5af5287ca8759946c498907cb2d2ba] source 06895bd2c785d79dd00261ded31def10b5a7157e
git bisect bad 2d089fd17f5af5287ca8759946c498907cb2d2ba
# good: [745fed0f322582c608e2c847626d76f2d655bd09] source 2e0c1e03e85ef6a20ca362f263c60b141741f698
git bisect good 745fed0f322582c608e2c847626d76f2d655bd09
# bad: [965365d01d35eca67211f672786900799d305857] source e0df62ae59b84b48787fa21fe083a0454c82a914
git bisect bad 965365d01d35eca67211f672786900799d305857
# bad: [067b6c46bfac7a652288ebafb0a44c38da6adf72] source c23757066d914ac04a39abcd72279c7c3d8919d5
git bisect bad 067b6c46bfac7a652288ebafb0a44c38da6adf72
# bad: [7069db552ad62b92858701ba8fc4eb2d56f09472] source 7fdc29469d3d098c1b2d5b1cfc7ed907031eb932
git bisect bad 7069db552ad62b92858701ba8fc4eb2d56f09472
# good: [1c70727d1ddc5ef5684714c038660f8294703aeb] source 221144f9c995fe30adf577c02f756b3123fb2550
git bisect good 1c70727d1ddc5ef5684714c038660f8294703aeb
# good: [acfe7ce8d17dd1cf5912a7fb07ece0550a929eaa] source a4bd382c8a6cf5a79898c692752408477cd4cfc5
git bisect good acfe7ce8d17dd1cf5912a7fb07ece0550a929eaa
# good: [063f8396dbfd20f1c69d70e4d28229de8a008d8b] source 60286229fa54b71c67a5d25a7cce59e54b6b8680
git bisect good 063f8396dbfd20f1c69d70e4d28229de8a008d8b
# good: [2ff64f3b32d778d5631fa58dacd3744fb2548475] source 2a1b70c4b2d5debf235c088a1e3c71a3457c1af7
git bisect good 2ff64f3b32d778d5631fa58dacd3744fb2548475
# bad: [30a556d1c169cc1f86aaa97d9c5f6f0c8b537bf3] source 03637a75c1bebf8b35b520139b9ddfa3238ee53f
git bisect bad 30a556d1c169cc1f86aaa97d9c5f6f0c8b537bf3
# bad: [f6d00d870871adc9590658c20e080461b57f366a] source e45d80f20ff6a05888f92ae942abed67609d5b20
git bisect bad f6d00d870871adc9590658c20e080461b57f366a
# first bad commit: [f6d00d870871adc9590658c20e080461b57f366a]
  source e45d80f20ff6a05888f92ae942abed67609d5b20

author	Tim Eves <tim_eves@sil.org>	2016-02-23 16:45:21 (GMT)
committer	Tor Lillqvist <tml@collabora.com>	2016-03-14 10:50:59 (GMT)
commit e45d80f20ff6a05888f92ae942abed67609d5b20
tree fef594425e80e321d4b6466e228fb4a85c97cac7
parent 2a1b70c4b2d5debf235c088a1e3c71a3457c1af7
tdf#97171: Use DirectWrite for OpenGL glyph caching

Screenshots from last good, first bad (both OpenGL) and reference (without OpenGL) are included.
Comment 1 Aron Budea 2016-10-17 14:38:50 UTC
Comment 2 V Stuart Foote 2016-10-17 15:08:34 UTC
This is a manifestation of DirectWrite in OpenGL for WinLayout and DirectWrite in GDI for SimpleWinLayout, when we dropped MS Uniscribe as non-workable to resolve bug 97111

bug 32362
bug 97111

What is weird with our DirectWrite use in both OpenGL and GDI is bug 103038 and why with DirectWrite in OpenGL all use of OpenSymbol in the Math module is rendering in Segoe UI
Comment 3 V Stuart Foote 2016-10-17 15:14:40 UTC
(In reply to V Stuart Foote from comment #2)

> What is weird with our DirectWrite use in both OpenGL and GDI is bug 103038
> and why with DirectWrite in OpenGL all use of OpenSymbol in the Math module
> is rendering in Segoe UI

Sorry I wrote that wrong, with default rendering (non-OpenGL) GDI on Windows, all OpenGL in formulas is rendering with system font Segoe UI.

s/with DirectWrite OpenGL all/with DirectWrite in GDI all/
Comment 4 V Stuart Foote 2016-10-17 15:19:52 UTC
(In reply to V Stuart Foote from comment #3)

once more... need to connect fingers to brain more efficiently.

s/all OpenGL in formulas/all OpenSymbol font in formulas/
Comment 5 Mike Kaganski 2016-10-18 13:50:41 UTC
(In reply to V Stuart Foote from comment #2)
> See 
> bug 32362

As to the abovementioned bug, I had extended OpenSymbol to include Adobe Symbol's characters that are used to render brackets of all kinds correctly: see bug 101889. There are top, middle, bottom parts and vertical bars to draw the whole bracket. MathType used just that technique, that was discussed in bug 32362.

However, as mentioned there, that's not an easyhack.
Comment 6 V Stuart Foote 2016-10-18 20:27:00 UTC
*** Bug 102165 has been marked as a duplicate of this bug. ***
Comment 7 V Stuart Foote 2016-10-22 06:18:41 UTC
Got our first look at the Harfbuzz based common shapping for OpenGL, GPU hardware and CPU only rendering. The scaling and placment of brackets/braces/parens is much improved.

Some issues with antialiasing and sub-pixel rendering but it is a good start.

I think this layout issue can be closed resolved fixed with work on bug 89870

On Windows 10 Pro 64-bit (1607) en-US with
Build ID: 36bafd3d4ad7fa75649eeab0c9cd1b3d6f53d8e8
CPU Threads: 8; OS Version: Windows 6.19; UI Render: GL; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-21_18:49:50
Locale: en-US (en_US); Calc: CL
Comment 8 V Stuart Foote 2016-11-16 06:12:33 UTC
With the new HarfBuzz based layout:

this remains an issue with DirectWrite based OpenGL, but default rendering with the new layout has been reverted to use GDI and scales glyphs correctly to fit the bounding box of the sm node.

With the old layout--DirectWrite OpenGL also has scaling issues.

On Windows 10 Pro 64-bit (1607) en-US with
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


Comment 9 V Stuart Foote 2017-03-09 01:43:50 UTC
For bug 103831, the removal of DirectWrite Direct2D calls for scaling glyphs
with OpenGL and instead using GDI calls corrects this issue as well.

In the smath formula

left lbrace stack { 1/2 # int from {3} to {1} {2} # matrix {1 # 2 # 3 ## 4 # 5 # 6 ## 7 # 8 # 9} } right none 111

the lbrace is now scaling correctly.

On Windows 10 Pro 64-bit en-US with
Build ID: a990b46ccc788db45ff4d8f0d47b799782ecb2af
CPU Threads: 8; OS Version: Windows 6.2; UI Render: GL; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:libreoffice-5-3, Time:
Locale: en-US (en_US); Calc: CL