Bug 156234

Summary: Subtle glyph misalignment with several fonts
Product: LibreOffice Reporter: ⁨خالد حسني⁩ <khaled>
Component: graphics stackAssignee: ⁨خالد حسني⁩ <khaled>
Status: VERIFIED FIXED    
Severity: normal CC: aron.budea, stephane.guillou, telesto
Priority: medium Keywords: bibisected, bisected
Version: 7.3.0.0 alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=152422
https://bugs.documentfoundation.org/show_bug.cgi?id=130010
https://bugs.documentfoundation.org/show_bug.cgi?id=99584
https://bugs.documentfoundation.org/show_bug.cgi?id=160786
https://bugs.documentfoundation.org/show_bug.cgi?id=160921
Whiteboard: target:24.2.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 71732    
Attachments: Document using Duployan
Test document (with embedded fonts)
screenshot of first paragraph at different zoom levels in LO 7.5.4

Description ⁨خالد حسني⁩ 2023-07-11 09:55:56 UTC
With some fonts where glyphs are attached together, rendering in LibreOffice at small sizes shows subtle misalignment of the attached glyphs i.e. they don’t perfectly attach.

This is likely caused by our early rounding of glyph coordinates, so even when map mode is used which should provide high fidelity positioning, we round the glyph coordinates before map mode conversion from font units to logical units takes place.
Comment 1 ⁨خالد حسني⁩ 2023-07-11 09:58:15 UTC
Created attachment 188309 [details]
Document using Duployan

This uses https://github.com/dscorbett/duployan-test/blob/gh-pages/assets/fonts/Duployan-Regular.otf

Even in highdpi displays, the glyphs are not attached together correctly.
Comment 2 ⁨خالد حسني⁩ 2023-07-11 11:53:49 UTC
Created attachment 188311 [details]
Test document (with embedded fonts)

Here is a test document with a texts in three different fonts (fonts are embedded in the document).

Zooming in and out can show subtle glyph alignment issues.
Comment 3 Stéphane Guillou (stragu) 2023-07-11 14:52:31 UTC
Created attachment 188315 [details]
screenshot of first paragraph at different zoom levels in LO 7.5.4

Khaled, is this part of the issue you are describing?
Comment 4 ⁨خالد حسني⁩ 2023-07-11 16:28:59 UTC
(In reply to Stéphane Guillou (stragu) from comment #3)
> Created attachment 188315 [details]
> screenshot of first paragraph at different zoom levels in LO 7.5.4
> 
> Khaled, is this part of the issue you are describing?

Yes. You can see more examples in the Arabic text as well if you look closely (I should take some screenshots).
Comment 5 Stéphane Guillou (stragu) 2023-07-11 17:00:36 UTC
Looking at the first Duployan paragraph, glyphs were all over the place before 7.3.

Since Julien's update to harfbuzz 2.8.2 in ed29da546754d0d11aa0cffd4dfe649cc95df722, situation improved but the reported subtle misalignment remained.

Bibisected with linux-64-7.3 repo, but not marking as a regression.
Comment 6 ⁨خالد حسني⁩ 2023-07-11 20:12:44 UTC
Yes, I don’t think there is a regression here. In 7.4x the on screen rendering has improved greatly. This issue is tracking the last bits of these positioning issues.

I’m working on a patch already: https://gerrit.libreoffice.org/c/core/+/154292
Comment 7 Commit Notification 2023-07-23 04:02:33 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4b743de97fc133623e46827869c4ea3eb845ad47

tdf#156234: Don’t round glyph coordinates when doing subpixel positioning

It will be available in 24.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 8 Stéphane Guillou (stragu) 2023-07-26 09:59:03 UTC
I still see very subtle misalignments but it is greatly improved compared to 7.5.5 and barely noticeable.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 24d0a62bd75b9a895c419aa165da648ab18f134d
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Marking as verified. Thanks!