Bug 103725 - Font scaling does not work on Windows with the new layout engine
Summary: Font scaling does not work on Windows with the new layout engine
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha1+
Hardware: All Windows (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords:
: 103814 103827 103846 (view as bug list)
Depends on:
Blocks: Font-Rendering Regressions-HarfBuzz
  Show dependency treegraph
 
Reported: 2016-11-05 13:27 UTC by Roman Kuznetsov
Modified: 2021-03-10 18:57 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
file Writer for checking render of formula (18.09 KB, application/vnd.oasis.opendocument.text)
2016-11-05 13:28 UTC, Roman Kuznetsov
Details
screenshot with HarfBuzz (36.43 KB, image/png)
2016-11-05 13:29 UTC, Roman Kuznetsov
Details
screenshot without HarfBuzz (27.80 KB, image/png)
2016-11-05 13:30 UTC, Roman Kuznetsov
Details
screenshot with HurfBuzz from 13.11.2016 (71.91 KB, image/png)
2016-11-13 11:36 UTC, Roman Kuznetsov
Details
new HarfBuzz text layout with OpenGL and default rendering (281.82 KB, image/png)
2016-11-13 14:17 UTC, V Stuart Foote
Details
harfBuzz+OpenGL_17.11.2016 (where are my brackets?!) (4.84 KB, image/png)
2016-11-17 20:19 UTC, Roman Kuznetsov
Details
wOpenGL rendering and 2016-11-17 build (21.87 KB, image/png)
2016-11-17 21:01 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kuznetsov 2016-11-05 13:27:42 UTC
Description:
Activate HarfBuzz is bad for visible Math formula


Steps to Reproduce:
1. create a new Writer document
2. type formula from attach
3. select text of formula
4. select menu item Insert > Object > Formula
5. text wiil change on OLE-object (formula Math)

Actual Results:  
with HarfBuzz see attach "with HarfBuzz"

Expected Results:
without HarfBuzz see attach "without HarfBuzz"


Reproducible: Always

User Profile Reset: No

Additional Info:
Version: 5.3.0.0.alpha1+
Build ID: 32bdc5097013e7efd9c85e1b8df697880e66e925
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-04_23:30:30
Locale: ru-RU (ru_RU); Calc: CL


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Comment 1 Roman Kuznetsov 2016-11-05 13:28:48 UTC
Created attachment 128511 [details]
file Writer for checking render of formula

add file ODT with formula
Comment 2 Roman Kuznetsov 2016-11-05 13:29:47 UTC
Created attachment 128512 [details]
screenshot with HarfBuzz
Comment 3 Roman Kuznetsov 2016-11-05 13:30:41 UTC
Created attachment 128513 [details]
screenshot without HarfBuzz
Comment 4 V Stuart Foote 2016-11-05 14:47:51 UTC
Confirming with on Windows 10 Pro 64-bit (1607) with
Version: 5.3.0.0.alpha1+
Build ID: 32bdc5097013e7efd9c85e1b8df697880e66e925
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-04_23:30:30
Locale: en-US (en_US); Calc: CL

So with HarfBuzz layout fonts for both GDI based "default" and OpenGL based rendering are correct but scaling of the nodes for brackets differs--scaling with GDI is a bit oversize but scaling for the OpenGL is so large it extends the glyphs outside the bounding box of the node!
Comment 5 ⁨خالد حسني⁩ 2016-11-05 15:17:59 UTC
With HarfBuzz we always use DirectWrite if it is available independent on the use of OpenGL, so unless you are testing on Windows XP you should be always getting DirectWrite.

Indeed, our DirectWrite renderer does not do text scaling, which also explains the HarfBuzz part of bug 99351.
Comment 6 Jean-Baptiste Faure 2016-11-05 20:08:06 UTC
Not reproducible under Linux / Ubuntu:
Version: 5.3.0.0.alpha1+
Build ID: a04cda96c6b70314546a8126783e573e16c78e1d
Threads CPU : 4; Version de l'OS :Linux 4.8; UI Render : par défaut; VCL: gtk3; Layout Engine: new; 
Ubuntu_16.10_x86-64
Locale : fr-FR (fr_FR.UTF-8); Calc: group

Not reproducible with GTK2 backend.

Bes regards. JBF
Comment 7 Takeshi Abe 2016-11-08 01:24:32 UTC
(In reply to Khaled Hosny from comment #5)
> Indeed, our DirectWrite renderer does not do text scaling, which also
> explains the HarfBuzz part of bug 99351.
Is it by design to ignore the scaling under new HarfBuzz layout, or due to a transient state and to be fixed?
Comment 8 ⁨خالد حسني⁩ 2016-11-08 12:12:11 UTC
(In reply to Takeshi Abe from comment #7)
> (In reply to Khaled Hosny from comment #5)
> > Indeed, our DirectWrite renderer does not do text scaling, which also
> > explains the HarfBuzz part of bug 99351.
> Is it by design to ignore the scaling under new HarfBuzz layout, or due to a
> transient state and to be fixed?

On Windows we are reusing a DirectWrite-based renderer that was originally used only to render Graphite fonts, it turns out this renderer was incoplete and is missing at at least a couple of features (scaling and rotation), the new layout engine itself supports both just fine.
Comment 9 ⁨خالد حسني⁩ 2016-11-08 15:13:50 UTC
*** Bug 103745 has been marked as a duplicate of this bug. ***
Comment 10 V Stuart Foote 2016-11-10 15:09:51 UTC
Tim, Martin, *

While you take a look at work needed on the DirectWrite renderer implementation for rotation (bug 100986) should we hope that scaling could also be tweaked?

As here and in bug 99351 handling the glyphs in the sm Math Formula editor is very dependent on correct scaling--and since it is now all DirectWrite based with HarfBuzz we've got troubles in the module with composing the formula nodes.
Comment 11 ⁨خالد حسني⁩ 2016-11-10 21:45:35 UTC
*** Bug 103831 has been marked as a duplicate of this bug. ***
Comment 12 ⁨خالد حسني⁩ 2016-11-10 21:45:58 UTC
*** Bug 103827 has been marked as a duplicate of this bug. ***
Comment 13 ⁨خالد حسني⁩ 2016-11-10 21:46:20 UTC
*** Bug 103814 has been marked as a duplicate of this bug. ***
Comment 14 Xisco Faulí 2016-11-11 00:43:40 UTC
*** Bug 103846 has been marked as a duplicate of this bug. ***
Comment 15 Commit Notification 2016-11-11 12:09:45 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=30fefcf71417f8c8644f5c0d3cb28c8c7f92a6c7

tdf#103725: Fix horizontal scaling on Windows

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 16 ⁨خالد حسني⁩ 2016-11-11 12:20:51 UTC
This should be fixed now, please verify all the duplicates are fixed, if any is not then it should be reopened as it is not a duplicate in this case.
Comment 17 V Stuart Foote 2016-11-11 16:13:53 UTC
*** Bug 100746 has been marked as a duplicate of this bug. ***
Comment 18 V Stuart Foote 2016-11-12 06:45:55 UTC
@Khaled, issues of duplicate bugs bug 100746 and bug 103745 are not appreciably corrected by commits closing this issue. Should they individually be reopened, or will you take another whack at this?

Scaling issues can be seen in attachment 126046 [details] from tdf#100746, and the sample Starmath formula from tdf#103745:

widevec {P_0 P_1}
widehat {P_0 P_1}
{x+y+z} overbrace {}
{x+y+z} underbrace {}


or the issues in scaling glyphs for formula node composition as in this Starmath:

nroot{3}{27 over 2} cdot sqrt{9}

although that is admittedly equally an issue with node composition in sm math module.
Comment 19 ⁨خالد حسني⁩ 2016-11-12 09:08:00 UTC
(In reply to V Stuart Foote from comment #18)
> @Khaled, issues of duplicate bugs bug 100746 and bug 103745 are not
> appreciably corrected by commits closing this issue. Should they
> individually be reopened, or will you take another whack at this?

I tested both before closing this and AFAICT they were fixed, but re-open if they are not fixed for you and attach screenshots.
Comment 20 Roman Kuznetsov 2016-11-13 11:36:48 UTC
Created attachment 128714 [details]
screenshot with HurfBuzz from 13.11.2016

IMHO, bug not fixed (see attach)...
Comment 21 V Stuart Foote 2016-11-13 14:17:03 UTC
Created attachment 128722 [details]
new HarfBuzz text layout with OpenGL and default rendering

Yes still issues with scaling, and differences between default GDI+ rendering and OpenGL rendering. But the most annoying are with the scaling for nodes of the formula editor as can be seen in this clip. Will reopen bug 100746 and bug 103745
Comment 22 ⁨خالد حسني⁩ 2016-11-13 14:33:37 UTC
It looks fine on my machine, I can’t test OpenGL rendering on Windows though, my setup does not support it.
Comment 23 Buovjaga 2016-11-14 10:25:57 UTC
Bug 103827 is fixed for me.

Win 7 Pro 64-bit Version: 5.3.0.0.alpha1+
Build ID: c5f5b3e5334c52502c1de28828a44ad469c68850
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: new; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-11-14_06:24:21
Locale: fi-FI (fi_FI); Calc: group
Comment 24 Commit Notification 2016-11-14 14:23:31 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

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

Revert "tdf#103725: Fix horizontal scaling on Windows"

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 25 Commit Notification 2016-11-15 11:31:48 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

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

tdf#103725: Fix horizontal scaling on Windows

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 26 Commit Notification 2016-11-15 15:38:28 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

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

tdf#103725: Default to GDI even with the new layout engine

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 27 ⁨خالد حسني⁩ 2016-11-15 15:43:33 UTC
This is now “fixed” by using GDI when OpenGL is disabled, so we should be in parity with the old layout engine. OpenGL issues should be tackled separately. People might need to retest any issue that was fixed by the use of DirectWrite and re-open them.
Comment 28 Roman Kuznetsov 2016-11-17 20:19:02 UTC
Created attachment 128830 [details]
harfBuzz+OpenGL_17.11.2016 (where are my brackets?!)

in
Version: 5.3.0.0.alpha1+
Build ID: b223028d65d24ffcd8e27974c29c2744a5df6227
CPU Threads: 4; OS Version: Windows 6.1; UI Render: GL; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-16_22:50:22
Locale: ru-RU (ru_RU); Calc: group

TextEngine - new
all rendering OpenGL - enable

in Math formula disappeared all brackets
Comment 29 Buovjaga 2016-11-17 21:00:38 UTC
(In reply to kompilainenn from comment #28)
> Created attachment 128830 [details]
> harfBuzz+OpenGL_17.11.2016 (where are my brackets?!)
> 
> in
> Version: 5.3.0.0.alpha1+
> Build ID: b223028d65d24ffcd8e27974c29c2744a5df6227
> CPU Threads: 4; OS Version: Windows 6.1; UI Render: GL; Layout Engine: new; 
> TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-16_22:50:22
> Locale: ru-RU (ru_RU); Calc: group
> 
> TextEngine - new
> all rendering OpenGL - enable
> 
> in Math formula disappeared all brackets

You have OpenGL enabled.
Khaled said: "OpenGL issues should be tackled separately"
Comment 30 V Stuart Foote 2016-11-17 21:01:23 UTC
Created attachment 128832 [details]
wOpenGL rendering and 2016-11-17 build

(In reply to kompilainenn from comment #28)

on Windows 8.1 Pro 64-bit en-US with
Version: 5.3.0.0.alpha1+
Build ID: b223028d65d24ffcd8e27974c29c2744a5df6227
CPU Threads: 8; OS Version: Windows 6.2; UI Render: GL; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-16_22:50:22
Locale: en-US (en_US); Calc: CL

Don't know, why the brackets are not showing for you.

With DirectWrite based OpenGL rendering I still see the badly scaled OpenSymbol glyphs clipped to the bounding box of the node.  With reworked default GDI rendering the glyphs are scaled to their bounding boxes.

Deselect OpenGL and retest as the default rendering alone is intended to provide correct rendering with the new HarfBuzz layout. OpenGL rendering needs some work. Additional comments in bug 100746