bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

text shaping with AAT Myanmar fonts broken in Firefox 19

RESOLVED FIXED in Firefox 20

Status

()

Core
Layout: Text
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: arky, Assigned: jfkthame)

Tracking

({regression})

unspecified
mozilla22
All
Mac OS X
regression
Points:
---

Firefox Tracking Flags

(firefox20 verified, firefox21 verified)

Details

Attachments

(11 attachments)

(Reporter)

Description

5 years ago
Created attachment 719806 [details]
MM3 Font test with Firefox 19

Latest Firefox 19 does not render fonts correctly. Tested this webpage[1] with Firefox 18 and latest Firefox 19 on Ubuntu Linux. 

This problem can reproduced on Firefox Mobile nightly as well.




[1] http://mozillamyanmar.org/2013/02/05/%E1%80%99%E1%80%B1%E1%80%AC%E1%80%BA%E1%80%87%E1%80%AE%E1%80%9C%E1%80%AC-%E1%80%99%E1%80%BC%E1%80%94%E1%80%BA%E1%80%99%E1%80%AC/
(Reporter)

Comment 1

5 years ago
Created attachment 719807 [details]
MM3 Font test with Firefox 18
(Reporter)

Comment 2

5 years ago
Created attachment 719861 [details]
Testcase for negative letter-spacing issue

Andrew Cunningham suggested this might be caused by negative letter spacing. Created this testcase to reproduce this problem.
(Reporter)

Updated

5 years ago
Severity: major → normal
(Assignee)

Comment 3

5 years ago
Indeed - this is behaving as designed. When the author specifies non-default letterspacing, we disable the 'liga' and 'clig' features, because it doesn't really make sense to use ligatures with letterspaced text.

(The word "office" with letterspacing should look like "o f f i c e", not "o f fi c e" or even "o ffi c e".)

So don't use letterspacing if you want all ligatures to be applied.

The root of the problem here is that the Myanmar3 font is using the 'liga' and 'clig' features, which will only be used when the text is rendered with its "natural" spacing, to achieve "shaping" that actually needs to happen regardless of letterspacing modifications. If the font used the 'rlig' (required ligatures) feature instead, the ligatures would still be applied, as we do not disable 'rlig' even when letterspacing is present.

Comment 4

5 years ago
Jonathan, is there a bug for the change in 19 that we can reference?

arky, do you have contacts to the folks that created the font?
(Assignee)

Comment 5

5 years ago
The change in behavior is a result of bug 797398, where we switched from pango to harfbuzz for all text shaping on Linux. AFAICS, the pango backend didn't implement the feature of disabling non-required ligatures when letterspacing.

(Previously, only certain scripts such as "simple" Latin/Cyrillic/etc, Arabic, and Hebrew were shaped through harfbuzz; for Indic and SEAsian scripts, we'd fall back to pango.)
(Reporter)

Comment 6

5 years ago
(In reply to Axel Hecht [:Pike] from comment #4)
> arky, do you have contacts to the folks that created the font?

Yes, I do know them.

Comment 7

5 years ago
Can you reach out to them and get them to fix the font? harfbuzz not rendering it as intended sounds like a good argument, and a good way to confirm it's fixed.
(Reporter)

Comment 8

5 years ago
(In reply to Axel Hecht [:Pike] from comment #7)
> Can you reach out to them and get them to fix the font? harfbuzz not
> rendering it as intended sounds like a good argument, and a good way to
> confirm it's fixed.

Thanks, Will get on it. I believe there are whole bunch of fonts (including non-standard) in use for Burmese content. Will gather feedback and file bugs accordingly. 

AFAIK Tharlon font project (http://code.google.com/p/tharlon-font/) is more active development. So I filed an upstream bug there.

Comment 9

5 years ago
Hi Jonathan and Arky,

Please find my attachment about my finding of Tharlon rendering in Mac and Windows 8. I haven't try Windows 7 and Windows XP. I don't think it is an issue by opentype font tags. We can use it in other browser as well. Hope, It should be solved by Mozilla Rendering or any rendering engine. Do we need to take care of opentype tags in Browser Level. I don't think Myanmar3 or other font will be replaced with *rlig* so far.

I've faced with native AAT Burmese Font in Mac too. It needs to be fixed by Browser. It doesn't happen in Ver 18.0

Comment 10

5 years ago
Created attachment 720380 [details]
native AAT Font Myanmar Sangem MN in Firefox 19 at MAC.

Comment 11

5 years ago
Created attachment 720381 [details]
Tharlon font rendering well in Windows 8.

Comment 12

5 years ago
Created attachment 720383 [details]
broken test case html file with tharlon font rendering in chrome at MAC

Comment 13

5 years ago
Created attachment 720384 [details]
broken test case html file with AAT Myanmar Sangem MN font rendering in chrome at MAC
(Assignee)

Comment 14

5 years ago
There are a couple of distinct issues here:

(1) Myanmar fonts that rely on OpenType 'liga' and 'clig' features to produce all the "shaped" forms, reordered glyphs, etc., will NOT work when letterspacing is applied, as explained in comment #3. This is by design; setting non-default letterspacing disables the ligature features.

To make a ligature-based OpenType font work even when letterspacing is applied, you need to use the 'rlig' feature, as this is NOT switched off automatically when letterspacing is applied.

I don't know whether all other applications apply the 'rlig' feature, or if there are some that *only* apply 'liga' and 'clig'. If that's the case, a solution for font developers would be to include the same lookups in 'rlig' *and* in the 'liga'/'clig' features, so that whichever feature(s) the engine applies, the same lookups will be used.

(The better long-term solution is to follow the new 'mym2' script tag and shaping specification that MS has introduced with Windows 8. But that won't work with older shaping engines.)

(2) The native AAT Myanmar font "Myanmar Sangam MN" that ships with OS X is indeed broken in Firefox 19. This is because Myanmar is missing from the list of "complex" scripts for which we prefer Core Text shaping if AAT tables are present. We should fix this; I'll attach a patch.
(Assignee)

Comment 15

5 years ago
Created attachment 720415 [details] [diff] [review]
support AAT Myanmar fonts via Core Text shaping.
Attachment #720415 - Flags: review?(jdaggett)
(Assignee)

Updated

5 years ago
Assignee: nobody → jfkthame

Comment 16

5 years ago
Thanks Jonathan,

We will try to change *rlig* instead of *clig* and *liga*. It will not take time to change for font developer. It will not be easy to change or upgrade by end user. Can you ship that font file with mozilla firefox ver 19.1 or something. IT would be special case. But we really needed for the end user. Why It is not impact in other browser? And will it be problem in other software too?

Best

Ngwe Tun

Comment 17

5 years ago
Created attachment 720428 [details]
padauk font not rendered (not reordered) in mozilla firefox MAC

Comment 18

5 years ago
Dear Jonathan,

I found another issues in Mozilla Firefox 19.0 at MAC. Padauk font is not properly rendered in Firefox as well. So, Can you ask to change *rlig* opentype features to Martin Hosken?

Best

Ngwe Tun
(Assignee)

Comment 19

5 years ago
I see Padauk also uses the 'clig' feature; so yes, that will fail if letter-spacing is applied. Using 'rlig' instead (or in addition) would be better, I think, as "ligatures" used to implement reordering should not be considered optional. I'm cc-ing Martin on this bug so he'll see the discussion.

However, remember that all this applies *only* if non-zero letter-spacing is applied; otherwise, fonts like these should work as intended (right?). So it is not a universal problem; only authors who actually use the CSS letter-spacing property need to be concerned about this issue.

Also, note that if you add explicit OpenType feature tags to the style:

  -moz-font-feature-settings: 'liga', 'clig';

then the features *will* be applied even when letter-spacing is present. So for authors who insist on using letter-spacing, there is a workaround that will solve the problem even without updating the fonts.

Updated

5 years ago
Attachment #720415 - Flags: review?(jdaggett) → review+

Comment 20

5 years ago
Created attachment 720488 [details]
incorrect letter spacing ebtween grapheme clusters

Although there seems to be a bug in how letetr spacing is calculated between grapheme clusters.

I tried the following rules in a test page

font-family: TharLon;
letter-spacing: 20px;
-moz-font-feature-settings: 'clig', 'liga';
font-weight: normal;

spacing before a cluster containing a medial-ra is much greater than between other graphemes. I assume the width of the medial-ra is being included despite wrapping around other characters?
(Assignee)

Comment 22

5 years ago
I'm morphing the bug summary to reflect the actual bug we're fixing with the patch here (the regression for the AAT Myanmar font shipped with OS X).

The other issue described here - shaping failure for ligature-based Myanmar fonts when letterspacing is used - is not really a bug; the feature is working as designed, but the fonts are using a mechanism that's not appropriate for basic script shaping, as it's not required to be always enabled. Font developers and/or page authors should address this by using other OpenType feature tags ('rlig'), and/or by explicitly forcing 'liga' and 'clig' to be re-enabled when letterspacing is used, as discussed above.
Keywords: regression
Summary: Myanmar3 Fonts broken on Firefox 19 → text shaping with AAT Myanmar fonts broken in Firefox 19
(Assignee)

Comment 23

5 years ago
(In reply to lang.support from comment #20)
> Created attachment 720488 [details]
> incorrect letter spacing ebtween grapheme clusters
> 
> Although there seems to be a bug in how letetr spacing is calculated between
> grapheme clusters.
> 
> I tried the following rules in a test page
> 
> font-family: TharLon;
> letter-spacing: 20px;
> -moz-font-feature-settings: 'clig', 'liga';
> font-weight: normal;
> 
> spacing before a cluster containing a medial-ra is much greater than between
> other graphemes. I assume the width of the medial-ra is being included
> despite wrapping around other characters?

I'm not seeing this in my testing here. Are you sure there's not an extra space or something in your testcase? Which Firefox version (and platform)?

If there's a real issue here, please file a new bug about it, and attach the actual testcase you're using.
https://hg.mozilla.org/mozilla-central/rev/781d180f8a0f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Comment 25

5 years ago
Comment on attachment 720415 [details] [diff] [review]
support AAT Myanmar fonts via Core Text shaping.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 797402

User impact if declined: Myanmar (Burmese) script text will not display correctly when using the default OS X Myanmar font.

Testing completed (on m-c, etc.): Confirmed to fix the issue in local build and in current m-c Nightly.

Risk to taking this patch (and alternatives if risky): Minimal risk: simple change in Mac-only code that affects -only- the Myanmar Unicode codepoints. The alternative of reverting bug 797402 would adversely affect a much larger number of Indic OpenType fonts, for which harfbuzz shaping is better than Core Text.

String or UUID changes made by this patch: None
Attachment #720415 - Flags: approval-mozilla-beta?
Attachment #720415 - Flags: approval-mozilla-aurora?
(Assignee)

Updated

5 years ago
Blocks: 797402
Comment on attachment 720415 [details] [diff] [review]
support AAT Myanmar fonts via Core Text shaping.

Approving for uplift since this is a low risk fix for a small user group that got regressed in 19.
Attachment #720415 - Flags: approval-mozilla-beta?
Attachment #720415 - Flags: approval-mozilla-beta+
Attachment #720415 - Flags: approval-mozilla-aurora?
Attachment #720415 - Flags: approval-mozilla-aurora+

Comment 28

5 years ago
Is this ready for testing in the latest Aurora?
(Assignee)

Comment 29

5 years ago
As of now, the current Aurora build is dated 2013-03-06, but it will have been built earlier in the day, before the patch landed there. To confirm this, about:buildconfig says it was built from 357d21b20bf0, which the hg log confirms is an earlier changeset.

So you'll need to wait for an Aurora build dated at least 2013-03-07.

Comment 30

5 years ago
Created attachment 722766 [details]
Firefox 19 vs 20

Windows 7 32bit - Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Firefox/20.0 (20130307075451)

I've been trying to reproduce this bug in order to verify it, but the text on the web page in comment 0 looks the same on Fx 19.0 and Fx 20b4 - Please see the attachment.

Are there any steps for reproducing this bug not mentioned above?

I've also tried to work with the reduced test case in comment 2, but the chars there are displayed as simple squares for me. My Windows doesn't offer the option to set this language for it, nor can I find a Firefox locale for it. The mozillamyanmar.org page is displayed fine.
(Assignee)

Comment 31

5 years ago
The fix here relates only to AAT fonts, which are specific to Mac OS X. (I've just fixed the Platform field to reflect this.)

The original example given was not really a valid bug, it was expected behavior where letterspacing is applied, as discussed in comment 3; but there was genuine brokenness for AAT Myanmar fonts on OS X, as per comment 14. So that's what we have fixed here.

To verify, it's best if you set gfx.downloadable_fonts.enabled to FALSE in about:config, because many Myanmar sites provide custom downloadable fonts that will take precedence over the default OS X font, and thus hide the problem.

Then visit pages such as http://mozillamyanmar.org/ or http://www.bbc.co.uk/burmese/. In Firefox 19, the text is obviously broken (both in the page, and in the tab title of the BBC page); in latest Aurora (or in Nightly) it should render correctly.
OS: All → Mac OS X
Hardware: x86 → All

Comment 32

5 years ago
On Windows 7 32bit Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20130303 Firefox/22.0

http://mozillamyanmar.org/2013/02/05/%E1%80%99%E1%80%B1%E1%80%AC%E1%80%BA%E1%80%87%E1%80%AE%E1%80%9C%E1%80%AC-%E1%80%99%E1%80%BC%E1%80%94%E1%80%BA%E1%80%99%E1%80%AC/

text shaping is broken if gfx.font_rendering.harfbuzz.scripts set to -1
(Assignee)

Comment 33

5 years ago
See the earlier comments here.

The brokenness of the heading on that page happens because the page sets CSS letterspacing on the element. This is expected behavior, as described in comments 3 and 14.

It is not a Firefox bug, it needs to be fixed on the site - by removing the use of letterspacing, or by adding explicit OpenType feature tags to re-enable the ligatures, or by using a font that does not rely on "non-required" ligature features to achieve basic (required) shaping.
(Assignee)

Updated

5 years ago
Duplicate of this bug: 811163
Flagging for verification in Firefox 20, 21, and 22.
Keywords: verifyme
Verified fixed on a Mac OSX 10.7.5 machine, based on comment 31, with Firefox 20 beta 5, build ID: 20130313170052.
status-firefox20: fixed → verified
Verified as fixed on Mac OS X 10.8:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0 Build ID: 20130401192816
status-firefox21: fixed → verified
mass remove verifyme requests greater than 4 months old
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.