Last Comment Bug 464168 - letter-spacing doesn't disable ligatures at larger point sizes
: letter-spacing doesn't disable ligatures at larger point sizes
Status: RESOLVED FIXED
: polish
Product: Core
Classification: Components
Component: Layout: Text (show other bugs)
: Trunk
: x86 Linux
: -- normal with 1 vote (vote)
: ---
Assigned To: Jonathan Kew (:jfkthame)
:
Mentors:
Depends on: 465393 465395 465396 569770
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-10 20:17 PST by Zack Weinberg (:zwol)
Modified: 2015-10-16 11:38 PDT (History)
5 users (show)
roc: wanted1.9.1+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case (538 bytes, text/html)
2008-11-10 20:17 PST, Zack Weinberg (:zwol)
no flags Details
screen shot illustrating problem (16.77 KB, image/png)
2008-11-11 18:05 PST, Zack Weinberg (:zwol)
no flags Details

Description Zack Weinberg (:zwol) 2008-11-10 20:17:58 PST
Created attachment 347447 [details]
test case

The attached test case repeats the same word over and over again at different font sizes, but always with the same letter-spacing.  At some intermediate size, the "ffi" ligature starts being used, despite the nonzero letter-spacing.

If anything, I would argue that the bigger the text is, the *more* important it is for letter-spacing to disable ligatures, because the visual glitch is more obvious.
Comment 1 Zack Weinberg (:zwol) 2008-11-10 20:19:00 PST
(Try changing the page zoom!)
Comment 2 Jesse Ruderman 2008-11-11 17:53:59 PST
WFM on Mac.
Comment 3 Zack Weinberg (:zwol) 2008-11-11 18:05:54 PST
Created attachment 347690 [details]
screen shot illustrating problem

Well, here's a screen shot, so you can see I'm not making this up.

It might be font-specific or Linux (Pango?) -specific.
Comment 4 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2008-11-16 19:54:26 PST
I see it as well on Linux.
Comment 5 Zack Weinberg (:zwol) 2008-11-17 13:29:56 PST
I've analysed this a bit; the problem is actually in per-platform gfx code.  Only the MacOS text renderer honors the TEXT_DISABLE_OPTIONAL_LIGATURES flag returned by nsLayoutUtils::GetTextRunFlagsForStyle.  We need to make all the other implementations of gfxFontGroup pay attention to it as well.

Per discussion on IRC, this is now a meta-bug which will shortly grow dependencies for each platform font backend; but it maybe makes sense to work out some reftests in this bug, since they would (hopefully) be platform-independent.
Comment 6 Zack Weinberg (:zwol) 2008-11-17 13:45:52 PST
The Mac code turns on ATSUI's "required" and "common" ligature categories by default, and if TEXT_DISABLE_OPTIONAL_LIGATURES is set, it turns "common" back off.  That seems like a good rule to copy for the Windows and Linux code, but it looks to me like the implementation won't be as simple as toggling a flag in the OS-provided rendering library, alas.

ATSUI ligature categories are defined here: http://developer.apple.com/documentation/Carbon/Conceptual/ATSUI_Concepts/atsui_app_features/chapter_9_section_15.html
Comment 7 Zack Weinberg (:zwol) 2008-11-18 20:14:37 PST
Per discussion in the dependent bugs, a proper fix doesn't seem doable anytime soon.

1) It occurred to me that an obvious workaround for page authors affected by this bug would be to insert a Unicode WORD JOINER or ZERO-WIDTH NO-BREAK SPACE character between the letters that shouldn't be ligatured.  But this introduces *extra* spacing (because the letter-spacing gap is inserted on either side of the invisible character) so that's no good.  How hard would it be to make those two characters not introduce extra space?  Can anyone suggest a workaround of similar invasiveness that actually does work?

2) I looked at the HarfBuzz mailing list and Git repo -- it doesn't seem to be a live project.  Hoping for that as the solution to all our font-shaping problems going forward doesn't seem like a good plan to me, unless we're going to devote our own engineering effort to it...
Comment 8 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2008-11-18 20:22:17 PST
(In reply to comment #7)
> Per discussion in the dependent bugs, a proper fix doesn't seem doable anytime
> soon.
> 
> 1) It occurred to me that an obvious workaround for page authors affected by
> this bug would be to insert a Unicode WORD JOINER or ZERO-WIDTH NO-BREAK SPACE
> character between the letters that shouldn't be ligatured.  But this introduces
> *extra* spacing (because the letter-spacing gap is inserted on either side of
> the invisible character) so that's no good.  How hard would it be to make those
> two characters not introduce extra space?

That would be easy.

> 2) I looked at the HarfBuzz mailing list and Git repo -- it doesn't seem to be
> a live project.  Hoping for that as the solution to all our font-shaping
> problems going forward doesn't seem like a good plan to me, unless we're going
> to devote our own engineering effort to it...

That is the plan.
Comment 9 Simon Montagu :smontagu 2008-11-18 20:36:04 PST
(In reply to comment #7)
 
> 1) It occurred to me that an obvious workaround for page authors affected by
> this bug would be to insert a Unicode WORD JOINER or ZERO-WIDTH NO-BREAK SPACE
> character between the letters that shouldn't be ligatured. 

ZERO WIDTH NON-JOINER would be the character to use for this, but this workaround doesn't scale well: I don't think we can expect page authors to insert extra characters between every pair of letters that might get ligated in some font somewhere.

> But this introduces
> *extra* spacing (because the letter-spacing gap is inserted on either side of
> the invisible character) so that's no good.  How hard would it be to make those
> two characters not introduce extra space? 

That (generalized to cover all invisible characters) seems like a bug that we should fix anyway.
Comment 10 Simon Montagu :smontagu 2008-11-18 20:43:14 PST
(In reply to comment #9)
> That (generalized to cover all invisible characters) seems like a bug that we
> should fix anyway.

Bug 253143?
Comment 11 Jonathan Kew (:jfkthame) 2011-01-12 14:10:46 PST
This should be fixed on trunk now - since Karl's patches in bug 569770 landed - for Latin and other  scripts that we shape with harfbuzz (which basically means most text except for Indic/SEAsian scripts).

Note You need to log in before you can comment on or make changes to this bug.