Closed Bug 1140264 Opened 9 years ago Closed 9 years ago

Line is incorrectly broken between ruby and previous open bracket

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: xidorn, Assigned: xidorn)

References

(Blocks 1 open bug)

Details

Attachments

(6 files, 1 obsolete file)

I see this bug in tweet [1]. This bug seems to happen in some condition.

[1] https://twitter.com/Takenspc/status/573652668582776832
Attached file testcase
This is a testcase simplified from that page. This bug can be reproduced when the window is resized to a certain width.
Attached image screenshot
The patch 2 actually fixes this bug, but causes regression when ruby is the the first element in a line. This patch fixes this problem by making rbc not inline descendant of ruby, which allows line layout to record NeedsBackup for <rb>s in CanPlaceFrame instead of skip them because of NoWrap.
Attachment #8574465 - Flags: review?(dbaron)
Attachment #8574464 - Flags: review?(dbaron)
Comment on attachment 8574464 [details] [diff] [review]
patch 3 - exclude rbc from inline descendant of ruby

Maybe the flag should be renamed to IsNonbreakableDescendantOfRuby / IS_NONBREAKABLE_DESCENDANT_OF_RUBY or similar, since its meaning is now more subtle?

r=dbaron with that or similar
Attachment #8574464 - Flags: review?(dbaron) → review+
Comment on attachment 8574465 [details] [diff] [review]
patch 4 - reftest

If this test relies on particular font size ratios between the ruby bases and ruby annotations, I think it should specify font sizes explicitly.

r=dbaron with that
Attachment #8574465 - Flags: review?(dbaron) → review+
(In reply to David Baron [:dbaron] (UTC-8) from comment #8)
> Comment on attachment 8574465 [details] [diff] [review]
> patch 4 - reftest
> 
> If this test relies on particular font size ratios between the ruby bases
> and ruby annotations, I think it should specify font sizes explicitly.

I don't think it relies on that, because I use the unit rem in the annotation.
Ah, right.  It does rely on the font providing a square glyph for 咲.  I'm not sure how likely that is to break...
Is there any test font which guarantees to generate a square for any cjk ideographic character? It seems Ahem doesn't include those characters.
(In reply to Xidorn Quan [:xidorn] (UTC+11) from comment #11)
> Is there any test font which guarantees to generate a square for any cjk
> ideographic character? It seems Ahem doesn't include those characters.

http://blogs.adobe.com/CCJKType/2013/05/css-orientation-test-opentype-fonts.html sounds like what you're looking for (I haven't yet tried to use it myself).
Comment on attachment 8575038 [details] [diff] [review]
patch 3 - rename the style context bit and exclude rbc/rtc from it

>Bug 1140264 part 3 - Rename IsInlineDescendantOfRuby to ShouldSUppressLineBreak and exclude rbc/rtc from it.

"SUppress" -> "Suppress"

>+  // the level containers themselvs are breakable. We have to check

themselvs -> themselves

>+  // because any of the ruby box could be anonymous.

box -> boxes


r=dbaron with that
Attachment #8575038 - Flags: review?(dbaron) → review+
(In reply to Simon Montagu :smontagu from comment #15)
> (In reply to Xidorn Quan [:xidorn] (UTC+11) from comment #11)
> > Is there any test font which guarantees to generate a square for any cjk
> > ideographic character? It seems Ahem doesn't include those characters.
> 
> http://blogs.adobe.com/CCJKType/2013/05/css-orientation-test-opentype-fonts.
> html sounds like what you're looking for (I haven't yet tried to use it
> myself).

Thanks. I guess I can just use a latin character here with Ahem font, since the line breaking behavior here should be identical for latin character and ideographic character.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: