Bug 137553 - Devanagari CTL script layout corruption with Annapurna SIL Graphite font
Summary: Devanagari CTL script layout corruption with Annapurna SIL Graphite font
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.1 rc
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:24.2.0 target:7.6.0.2
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2020-10-17 09:20 UTC by Andrey
Modified: 2023-07-08 20:38 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of what the collision look like (210.21 KB, image/png)
2020-10-17 09:28 UTC, Andrey
Details
LibreOffice version (154.89 KB, image/png)
2020-10-19 16:39 UTC, Andrey
Details
Here is an example of a file with colliision (4.42 KB, application/octet-stream)
2020-10-21 16:31 UTC, Andrey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey 2020-10-17 09:20:07 UTC
Description:
FORMATTING  In some cases, devanagari text in Annapurna SIL font collides. I.e. neighboring words overlaps or spaces overlaps with words.
The same document with the same text looks fine in OpenOffice and in MSOffice.


Steps to Reproduce:
1. Create a new empty document in Writer
2. Toggle formatting marks
3. Put this text
युञ्जन् एवं सदा आत्मानं योगी नियत–मानसः ।
शान्तिं निर्वाण–परमां मद्–संस्थाम् अधिगच्छति ॥६-१५॥
4. Change the font of the text to Annpurna SIL

Actual Results:
निर्वाण–परमां collides
॥६-१५॥ collides
spaces between word collide
You may see other collisions.

Expected Results:
निर्वाण–परमां looks separated by "-"


Reproducible: Always


User Profile Reset: No



Additional Info:
I'm using Ubuntu 18.04.
The same behavior is in Windows version of the Writer.
Comment 1 Andrey 2020-10-17 09:28:50 UTC
Created attachment 166458 [details]
Example of what the collision look like

With red lines the collided text is highlighted.
Comment 2 V Stuart Foote 2020-10-19 14:48:17 UTC
@Martin, any cycles to review? Out of my comfort zone...
Comment 3 V Stuart Foote 2020-10-19 16:06:57 UTC
@Andrey,

Could you please post details of the build of LibreOffice you have tested.

Found in the Help -> About LibreOffice panel.

Also, some recent updates of the Graphite2 libs, now available in current LO master, 7.0.2 (1 Oct) and 6.4.7 (9 Oct) builds. Please update if possible, or otherwise run an AppImage or install in parallel (easily removed later) [1].

Installers are linked here: 

http://downloadarchive.documentfoundation.org/libreoffice/old/

Available via the LibreOffice archive for the builds--but the "details" link will list any nearby mirrors with the build, and a hash value to verify after a speedy download.

=-ref-=
[1] https://wiki.documentfoundation.org/Installing_in_parallel
Comment 4 Andrey 2020-10-19 16:39:37 UTC
Created attachment 166518 [details]
LibreOffice version

Hello,

Here is the build hash 8349ace3c3162073abd90d81fd06dcfb6b36b994
See the screenshot.
Comment 5 Andrey 2020-10-19 16:42:09 UTC
Hello,

Have attached a screenshot with version info.
Will try to update Graphite and notify you on results later on.
Comment 6 Andrey 2020-10-19 16:43:59 UTC
Please be noted, 
I had this problem with 7.0.0.1 and have upgraded to 7.0.2.2 before submitting the bug report.
Comment 7 QA Administrators 2020-10-20 04:20:53 UTC Comment hidden (obsolete)
Comment 8 Andrey 2020-10-21 16:31:47 UTC
Created attachment 166595 [details]
Here is an example of a file with colliision

Extract .zip.
Open .doc.
See "Collided text" markers.
Comment 9 Buovjaga 2021-07-27 10:22:25 UTC
https://software.sil.org/annapurna/download/

Confirmed with document and font.

NixOS
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 67e47070a7580a17804adce812cc2f98bfe7b51f
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: x11
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Comment 10 Sophie Sipasseuth 2023-07-05 08:19:17 UTC
No repro, the text "युञ्जन् एवं सदा आत्मानं योगी नियत–मानसः ।
शान्तिं निर्वाण–परमां मद्–संस्थाम् अधिगच्छति ॥६-१५॥" keep the "-" in the word "निर्वाण–परमां" with the Annpurna SIL font.
I don't see collusion.

Version: 7.4.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: c94961c6869c34b3874d21cfaa5ec1488609acfe
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: en-US
Calc: CL

Version: 7.5.0.1.0+ (X86_64) / LibreOffice Community
Build ID: ced8585bcb92aa58ca3e24197ff38fb82cc8a703
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: en-US
Calc: CL threaded

Version: 7.6.0.0.beta1+ (X86_64) / LibreOffice Community
Build ID: 1b5cee822e0bc15ddbdfc86926678ca35ab3e082
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: en-US
Calc: CL threaded
Comment 11 Buovjaga 2023-07-05 08:36:07 UTC
(In reply to Andrey from comment #0)
> Description:
> FORMATTING  In some cases, devanagari text in Annapurna SIL font collides.
> I.e. neighboring words overlaps or spaces overlaps with words.
> The same document with the same text looks fine in OpenOffice and in
> MSOffice.
> 
> 
> Steps to Reproduce:
> 1. Create a new empty document in Writer
> 2. Toggle formatting marks
> 3. Put this text
> युञ्जन् एवं सदा आत्मानं योगी नियत–मानसः ।
> शान्तिं निर्वाण–परमां मद्–संस्थाम् अधिगच्छति ॥६-१५॥
> 4. Change the font of the text to Annpurna SIL

॥६-१५॥ still looks strange, but otherwise I don't see problems.

The rendering of the document also has less problems, but still some that are pointed out in the screenshot.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e4e5fb4b2935e395c7e4b3a794d544a6f44709ce
CPU threads: 2; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-US (en_FI); UI: en-US
Calc: threaded
Comment 12 ⁨خالد حسني⁩ 2023-07-05 15:27:03 UTC
I think this is related to the graphite tables in the font. The way Graphite handles glyph advances (at least in this font) seems to peculiar and is tripping our code maps glyph advances back to individual characters.

If I remove the Graphite tables from the font, all the reported issues go away.
Comment 13 ⁨خالد حسني⁩ 2023-07-05 15:45:07 UTC
It seems that some glyphs return negative advance width, I don’t think this is something we are prepared to handle.
Comment 14 ⁨خالد حسني⁩ 2023-07-05 16:39:05 UTC
(In reply to ⁨خالد حسني⁩ from comment #13)
> It seems that some glyphs return negative advance width, I don’t think this
> is something we are prepared to handle.

Scratch that. There are no negative advance widths, but the glyph advances are still wrong (less than they should be). I believe this is either a bug in the font, Graphite or HarfBuzz.
Comment 15 ⁨خالد حسني⁩ 2023-07-06 05:11:21 UTC
I’m working on a HarfBuzz fix.
Comment 16 Commit Notification 2023-07-08 17:00:03 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f1998c01bf0a85481201589ffbd8b0df400491ee

tdf137553: Fix advance width for text using Graphite fonts

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 17 Commit Notification 2023-07-08 20:38:23 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/8aab239b105bcd365358719ccd112516f4b60834

tdf137553: Fix advance width for text using Graphite fonts

It will be available in 7.6.0.2.

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.