Bug 105913 - Calculating character widths is broken for ligatures in 5.3
Summary: Calculating character widths is broken for ligatures in 5.3
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: high major
Assignee: Khaled Hosny (inactive)
URL:
Whiteboard: target:6.1.0
Keywords: bibisected, bisected, regression
: 105798 105914 105934 106567 107167 109999 112093 114510 115854 (view as bug list)
Depends on:
Blocks: Font-Rendering HarfBuzz-regressions
  Show dependency treegraph
 
Reported: 2017-02-10 08:21 UTC by Shriramana Sharma
Modified: 2019-02-27 16:51 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample files to demonstrate bug (113.63 KB, application/gzip)
2017-02-10 08:21 UTC, Shriramana Sharma
Details
Sample files to understand word breaking with Zero Width Joiner (287.22 KB, application/x-zip-compressed)
2018-04-28 09:50 UTC, Ramesh K
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shriramana Sharma 2017-02-10 08:21:05 UTC
Created attachment 131066 [details]
Sample files to demonstrate bug

Hello. Justification of Tamil text is broken upon upgrading to LibO 5.3. Please see attached documents demonstrating this.

I am using latest download release on Kubuntu Trusty 64 bit and latest Lohit Tamil font from https://fedorahosted.org/lohit/. (Note that Lohit Tamil is one of the most common Tamil fonts found on Linux distributions.)
Comment 1 Khaled Hosny (inactive) 2017-02-11 00:07:17 UTC
I can reproduce this with Lohit Tamil but not Noto Sans Tamil, so looks like something in Lohit Tamil is triggering this bug. I notice also that the text selection is off, looks like there is some disassociation between calculated glyph positions and the actual rendering.
Comment 2 Khaled Hosny (inactive) 2017-02-11 00:35:34 UTC
*** Bug 105914 has been marked as a duplicate of this bug. ***
Comment 3 Shriramana Sharma 2017-02-11 06:54:34 UTC
Hi Khaled. If you're going to unify a Devanagari and Tamil issue shouldn't you change the title and summary accordingly?

Also I hope cursor placement is also implied in your mention of selection because that's off as well.
Comment 4 Khaled Hosny (inactive) 2017-02-28 15:07:44 UTC
*** Bug 105934 has been marked as a duplicate of this bug. ***
Comment 5 Khaled Hosny (inactive) 2017-02-28 15:11:51 UTC
I think this is might be related to the changes I did to how character widths are calculated in the new layout engine. I suggest people affected by this switch back to the old layout engine until this is fixed.

If someone is bisecting this, please make sure the new layout engine is always enable by setting SAL_USE_COMMON_LAYOUT=1 environment variable since it was not always enabled during 5.3 cycle.
Comment 6 Xisco Faulí 2017-03-03 11:38:35 UTC
I bisected it using SAL_USE_COMMON_LAYOUT=1 and it pointed me to this commit:

author	Khaled Hosny <khaledhosny@eglug.org>	2016-09-11 08:25:46 (GMT)
committer	Khaled Hosny <khaledhosny@eglug.org>	2016-10-18 18:41:31 (GMT)
commit	15f6a97d9f23124c19471b9d8dd38f14f53829b3 (patch)
tree	cbcb1cdf11821749d465b726ce2d4957a06fca05
parent	66104ff9856ff1c81ec8c776a0467796f85efc01 (diff)
Fix applying DX adjustments in CommonSalLayout
By overriding GetCharWidths() and ApplyDXArray() with a simpler and
saner implementation.

This fixes rendering of Awami Nastaliq, as well as subtending marks in
Amiri and potentially other bugs.

Breaks Kashida justification, will need to rewrite that one as well.

I hope it helps
Comment 7 Khaled Hosny (inactive) 2017-03-03 12:13:42 UTC
Thanks Xisco, I suspected it would be this commit.
Comment 8 Xisco Faulí 2017-03-16 09:21:27 UTC
*** Bug 106567 has been marked as a duplicate of this bug. ***
Comment 9 Khaled Hosny (inactive) 2017-06-02 01:39:43 UTC
*** Bug 105934 has been marked as a duplicate of this bug. ***
Comment 10 Volga 2017-08-24 08:27:31 UTC
Still reproducable in LODev 6.0

Version: 6.0.0.0.alpha0+ (x64)
Build ID: 311be7d70146e4963e4dfd1f39d6c71d45d241ca
CPU threads: 4; OS: Windows 6.19; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2017-08-24_00:29:42
Locale: zh-CN (zh_CN); Calc: group
Comment 11 Khaled Hosny (inactive) 2017-10-30 07:49:25 UTC
*** Bug 109999 has been marked as a duplicate of this bug. ***
Comment 12 Khaled Hosny (inactive) 2018-04-27 03:19:51 UTC
*** Bug 114510 has been marked as a duplicate of this bug. ***
Comment 13 Khaled Hosny (inactive) 2018-04-27 03:37:29 UTC
*** Bug 107167 has been marked as a duplicate of this bug. ***
Comment 14 Khaled Hosny (inactive) 2018-04-27 04:17:45 UTC
*** Bug 105798 has been marked as a duplicate of this bug. ***
Comment 15 Commit Notification 2018-04-27 11:21: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=2815499d7c0b32fa05fcd697e7b2c2d897f78dfb

tdf#105913: Fix applying DX array to ligatures

It will be available in 6.1.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 Ramesh K 2018-04-28 09:50:35 UTC
Created attachment 141735 [details]
Sample files to understand word breaking with Zero Width Joiner

Tested using malayalam fonts previously affected with this issue and found solved. But another issue related with this mentioned in https://bugs.documentfoundation.org/show_bug.cgi?id=109999 is still pending.

The pending issue related with libre office writer is :-

"last word in a line containing 'Zero Width Joiner' breaking with Zero Width Joiner unicode character to next line in a paragraph which contain malayalam Unicode characters"

Reproducable in Version: 6.1.0.0.alpha1+ (x64)
Build ID: a6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f
CPU threads: 4; OS: Windows 10.0; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-04-28_01:58:12
Locale: en-IN (en_IN); Calc: group
Comment 17 Khaled Hosny (inactive) 2018-04-29 07:56:48 UTC
(In reply to Ramesh K from comment #16)
> Created attachment 141735 [details]
> Sample files to understand word breaking with Zero Width Joiner
> 
> Tested using malayalam fonts previously affected with this issue and found
> solved. But another issue related with this mentioned in
> https://bugs.documentfoundation.org/show_bug.cgi?id=109999 is still pending.
> 
> The pending issue related with libre office writer is :-
> 
> "last word in a line containing 'Zero Width Joiner' breaking with Zero Width
> Joiner unicode character to next line in a paragraph which contain malayalam
> Unicode characters"
> 
> Reproducable in Version: 6.1.0.0.alpha1+ (x64)
> Build ID: a6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f
> CPU threads: 4; OS: Windows 10.0; UI render: default; 
> TinderBox: Win-x86_64@42, Branch:master, Time: 2018-04-28_01:58:12
> Locale: en-IN (en_IN); Calc: group

Please open a new issue and attach a document that shows the issue, as well as screenshot showing the expected result.
Comment 18 Xisco Faulí 2018-05-02 10:43:58 UTC
Verified in

Version: 6.1.0.0.alpha1+
Build ID: 43af818557904450b13839350c65ad865b9ee9d2
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

@Khaled, should it be backported to LibreOffice 6 ?
Comment 19 Khaled Hosny (inactive) 2018-05-02 13:58:42 UTC
(In reply to Xisco Faulí from comment #18)
> Verified in
> 
> Version: 6.1.0.0.alpha1+
> Build ID: 43af818557904450b13839350c65ad865b9ee9d2
> CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
> Locale: ca-ES (ca_ES.UTF-8); Calc: group
> 
> @Khaled, should it be backported to LibreOffice 6 ?

I don’t think it can be easily backported, it depends on several other changes.
Comment 20 Xisco Faulí 2018-06-15 14:17:44 UTC
*** Bug 112093 has been marked as a duplicate of this bug. ***
Comment 21 Schlomo Schapiro 2018-06-17 11:31:46 UTC
It seems to me that latin ligatures are still somewhat problematic. To help with debugging this issue I created a GitHub project with a sample file and some tools to quickly check against a new LOO version: https://github.com/schlomo/libreoffice-bug-rtl-justified-regression

There is also the word "different" in this document and the ligature "ff" is not showing correctly on LOO after 5.2.7.2.

Can this also be related to this bug? Is this a different issue?
Comment 22 Xisco Faulí 2018-06-17 11:34:50 UTC
(In reply to Schlomo Schapiro from comment #21)
> It seems to me that latin ligatures are still somewhat problematic. To help
> with debugging this issue I created a GitHub project with a sample file and
> some tools to quickly check against a new LOO version:
> https://github.com/schlomo/libreoffice-bug-rtl-justified-regression
> 
> There is also the word "different" in this document and the ligature "ff" is
> not showing correctly on LOO after 5.2.7.2.
> 
> Can this also be related to this bug? Is this a different issue?

Hi Schlomo Schapiro,
Please create a follow-up bug for this as the original problem of this issue is fixed.
Comment 23 Schlomo Schapiro 2018-06-17 12:08:04 UTC
OK, sure. I did some checks and ligatures seem fine. Sorry for the false alarm.

The Liberation Sans font seems to be quite bad with regard to ligatures, with other fonts it looks much better.
Comment 24 Khaled Hosny (inactive) 2019-02-27 16:51:14 UTC
*** Bug 115854 has been marked as a duplicate of this bug. ***