Closed Bug 481948 Opened 16 years ago Closed 16 years ago

Indic scripts: consonant clusters with REPHA have glyphs disappearing

Categories

(Core :: Graphics, defect, P1)

All
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: shreevatsa.public, Assigned: jfkthame)

References

(Depends on 1 open bug)

Details

(Keywords: fixed1.9.1, Whiteboard: [fixed1.9.1b99])

Attachments

(4 files, 3 obsolete files)

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7 In several Indic scripts including Devanagari, consonant clusters that start with a RA must be displayed with a "repha" over the last consonant in the cluster. On Firefox on Mac OS X (which uses ATSUI), intermediate consonants disappear when this happens. This is handled correctly by Safari, and by Firefox on Windows and Linux. A Devanagari example ("irkkkkkkkkkka"): इर्क्क्क्क्क्क्क्क्क्क ("RA VIRAMA KA VIRAMA KA VIRAMA...") This contains 10 "k"s, but only 2 are displayed. (Copy-paste it into Textedit to see that all 10 are present.) I'm not actually sure how corresponding text must be displayed for other Indic scripts; e.g. it appears to me that for the Kannada "irkkkkkkkkkka": ಇರ್ಕ್ಕ್ಕ್ಕ್ಕ್ಕ್ಕ್ಕ್ಕ್ಕ , Safari's rendering is wrong as well. In fact, in Kannada it seems acceptable to avoid the repha entirely (see "Issue 2" at http://www.baraha.com/help/kb/unicode_issues.htm) but for Devanagari it is true that the repha must follow the syllable (all consonants, and possibly a vowel sign: http://rishida.net/scripts/indic-overview/ ) Reproducible: Always Steps to Reproduce: 1. Look at the text इर्क्क्क्क्क्क्क्क्क्क in Firefox Actual Results: Two 'k's are visible Expected Results: Ten 'k's must be visible Generalization of Bug 428317 and Bug 429064
Component: General → GFX: Thebes
Product: Firefox → Core
Version: unspecified → Trunk
QA Contact: general → thebes
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: wanted1.9.1?
Note that this bug is specific to the ATSUI font backend. The CoreText backend for OS X 10.5 (see bug 389074) displays the Devanagari example (and similar testcases) correctly, with all 10 'k' glyphs visible. However, we still need to fix this for the ATSUI backend for 1.9.1 (and 1.9.2 if we don't drop 10.4 support), as it is a pretty serious case of incorrect rendering.
This bug arises because of how PostLayoutCallback in the ATSUI backend tries to find character and glyph "clumps"; it does not handle Indic-rearrangement cases where a glyph crosses over an arbitrarily long run of others. When the REPHA glyph is eventually encountered, it gets clumped with the visually-adjacent consonant, but the underlying character range is much larger and should include all the logically-intermediate characters (visually preceding glyphs). This patch resolves the problem by reimplementing the character/glyph clumping algorithm; it is essentially a copy of gfxCoreTextFontGroup::SetGlyphsFromRun, adapted to work with the ATSUI glyph information records. With this patch, arbitrarily long Indic syllables with glyph rearrangement are rendered properly without dropping glyphs. If this works well in practice (it reftests fine; just sent to tryserver for further testing), it would strengthen the case for refactoring/merging the ATSUI and CoreText backends, as it harmonizes a major piece of the code that was formerly quite different.
Assignee: nobody → jfkthame
Comment on attachment 370172 [details] [diff] [review] rewrite of char/glyph clustering algorithm for ATSUI backend John, requesting review on this (you'll recognize the code!) as it fixes a serious issue for Indic text; I think we should consider whether we can take it on 1.9.1. It passes reftests locally and also the various try-server tests. For 1.9.2, we should either drop the ATSUI path (if we decide to drop 10.4 support) or merge the ATSUI and CoreText backends; I'd be happy to do that in a followup patch for trunk.
Attachment #370172 - Flags: review?(jdaggett)
Shreevatsa, if you'd like to try this, you can download a build from https://build.mozilla.org/tryserver-builds/2009-03-31_03:39-jkew@mozilla.com-atsui-clusters/ I'd appreciate any testing we can get.
Yes, it appears to be fixed in that build. (I tried the Mac build.) Thanks,
Attachment #370172 - Flags: review?(jdaggett) → review?(roc)
Comment on attachment 370172 [details] [diff] [review] rewrite of char/glyph clustering algorithm for ATSUI backend Roc, could you review this, as I guess John hasn't had time to look at it yet? Would be nice to be able to consider taking this on 1.9.1 if possible.
I'm too zonked to grapple with this now, but I'll do it ASAP.
+ if (charEnd == (PRInt32)glyphRecords[glyphStart].originalOffset/2) + firstGlyphFound = PR_TRUE; Instead of doing this, can't we just find the correct end character by starting at glyphRecords[glyphStart].originalOffset/2 and finding the next character that has a charToGlyph entry? And then do another loop over those characters to compute glyphEnd? (In fact, maybe that can be fused with the following code "// We also need to check if there are any following glyphs"...) It seems to me that would be a little clearer. + g.SetComplex(glyphsInClump > 1 ? + PR_FALSE : aTextRun->IsClusterStart(baseCharIndex), glyphsInClump == 1 && aTextRun->IsClusterStart(baseCharIndex) ?
Revised the code in the light of your comment; I think this is now clearer, and it also works better (the previous version did not always avoid "holes" in the glyph clump, which leads to an inferior selection behavior when drag-selecting across Indic text, for example). This is looking good on reftests (and general browsing of int'l sites); was also going well on mochitest until it crashed somewhere deep in a JavaScript test, which I think is unrelated to this patch. Awaiting tryserver results to check that performance is still ok there.
Attachment #370172 - Attachment is obsolete: true
Attachment #372489 - Flags: review?(roc)
Attachment #370172 - Flags: review?(roc)
Keywords: checkin-needed
Whiteboard: [needs landing]
New tryserver build is available at https://build.mozilla.org/tryserver-builds/2009-04-13_14:05-jkew@mozilla.com-atsui-rev/ This passed tests ok, and seems to work well for me locally. Roc, WDYT about considering this for 1.9.1? Given that it fixes an issue where text display is not just a bit sub-optimal, but actually misses out glyphs entirely, I think it's serious.
Flags: blocking1.9.1?
I think we should probably take it, but Vlad should be the one to approve it.
Flags: wanted1.9.1?
Flags: wanted1.9.1+
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Priority: -- → P1
Let's let this bake on the trunk for a bit, and then let's get it into 1.9.1 -- I'm a little worried due to the area of code the patch is touching, but I agree that the bug is bad enough that we should try to fix it.
After further testing (in particular, see bug 488364), here is a further revision to the clustering and character/glyph association behavior. This now reproduces the prior ATSUI-based behavior for character clustering in the presence of Indic reordering, and provides the same partial-ligature behavior. There are now no known deviations from the previous behavior even in the bizarre colored-span/reordered-glyphs cases; the only user-visible change is that the disappearing glyph problem is resolved. It is possible to make this code behave more like the Pango backend, rendering Indic clusters in sections just like ligatures, by simply disabling the test of /inOrder/ near the end of PostLayoutCallback. This is a behavior change we might like to consider in the course of re-examining shaping backends. As the previous patch hadn't actually landed on trunk, we should take this version instead.
Attachment #372489 - Attachment is obsolete: true
Attachment #372976 - Flags: review?(roc)
Keywords: checkin-needed
Whiteboard: [needs landing]
Comment on attachment 372976 [details] [diff] [review] further update to the clustering behavior [Checkin: Comment 18] Have you got some tests we should add here?
The first reftest tests the specific Indic display bug here; the subsequent tests check other cluster-related display issues that showed up in the course of working on this (see also bug 488364).
Attachment #373073 - Flags: review?(roc)
BTW, the test 481948-3 will currently fail on the CoreText path, so I guess it should be marked random on OS X. I'm working on a fix for this and will post that on this bug as well, as it is also an Indic clustering-related issue.
This patch updates the CoreText backend based on the improvements in the new ATSUI algorithm. With this patch, all the reftests pass under CoreText as well.
Attachment #373385 - Flags: review?(roc)
Keywords: checkin-needed
Whiteboard: [needs landing]
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [needs landing]
Depends on: 490777
Comment on attachment 372976 [details] [diff] [review] further update to the clustering behavior [Checkin: Comment 18] a191=beltzner
Attachment #372976 - Flags: approval1.9.1? → approval1.9.1+
Attachment #373073 - Flags: approval1.9.1? → approval1.9.1+
Comment on attachment 373073 [details] [diff] [review] add reftests for Indic cluster and ligature display issues [Checkin: Comment 18] a191=beltzner
The ATSUI clustering update turned out to have a regression, see bug 490777. So we need to take that fix on 1.9.1 as well, to avoid regressing there. This version of the patch is updated for the 1.9.1 tree and incorporates the tests and the fix from 490777. Requesting review on the combined patch just to double-check that it's all in order; this should now apply cleanly and be ready for check-in on 1.9.1.
Attachment #376170 - Flags: review?(roc)
Comment on attachment 376170 [details] [diff] [review] combined ATSUI patch for 1.9.1, including tests and regression fix from bug 490777 This is fine but unless you've changed something here I think it's probably better to just check in the patch for this bug and the patch for the regression as separate changesets (but in the same push). That way I think it's more clear how what lands on branch is related to what landed on trunk.
Attachment #376170 - Flags: review?(roc) → review+
The actual code patches are unchanged from trunk (just offset by a few lines), but the test list patches needed to be updated for 1.9.1. So this patch is now ready to land on branch, and the corresponding patch from bug 490777 should land at the same time.
Attachment #376170 - Attachment is obsolete: true
Keywords: checkin-needed
Whiteboard: [needs 191 landing]
Whiteboard: [needs 191 landing] → [needs 1.9.1 landing: see comment 23]
Target Milestone: --- → mozilla1.9.2a1
Comment on attachment 376483 [details] [diff] [review] ATSUI clustering patch for 1.9.1, ready for landing [Checkin: Comment 24] http://hg.mozilla.org/releases/mozilla-1.9.1/rev/c03c2a41f0a0
Attachment #376483 - Attachment description: ATSUI clustering patch for 1.9.1, ready for landing → ATSUI clustering patch for 1.9.1, ready for landing [Checkin: Comment 24]
Attachment #373073 - Attachment description: add reftests for Indic cluster and ligature display issues → add reftests for Indic cluster and ligature display issues [Checkin: Comment 18]
Attachment #372976 - Attachment description: further update to the clustering behavior → further update to the clustering behavior [Checkin: Comment 18]
Attachment #373385 - Attachment description: update CoreText clustering to behave similarly to ATSUI → update CoreText clustering to behave similarly to ATSUI [Checkin: Comment 18]
Whiteboard: [needs 1.9.1 landing: see comment 23] → [fixed1.9.1b5]
Depends on: 488364
Depends on: 493561
Whiteboard: [fixed1.9.1b5] → [fixed1.9.1b99]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: