Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDetect adjoining text fragments with no line break opportunity between them #19688
Conversation
highfive
commented
Jan 4, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jan 4, 2018
|
I'm very unfamiliar with the code here, and I figured that instead of trying to get a million questions answered over a 12 hour time difference, it would make more sense to try a simple attempt at a solution and be told what's wrong with it feedback? @mbrubeck |
|
Testing for whitespace alone will not suffice, since we also want to break on characters like hyphens, in cases like Currently we run UAX 14 in TextRun::break_and_shape, when constructing each TextRun. The text run is split on line-break opportunities, and the segments are stored as a (A text run is used in shaping and must be a contiguous slice of text with the same shaping options, so in the general case we can't simply combine all the text of a "word" into a single TextRun. The overview has some additional high-level description.) At a conceptual level, we need to run UAX 14 on the entire inline flow as a single string of text. Maybe we could do that by moving line-break scanning out of TextRun construction, to some other place that can process all the fragments together. An alternative would be to keep the current code for finding intra-run breaks, and do a separate check to determine whether to allow breaks between runs (similar to the approach in this PR). This would be less intrusive, but I don't know how feasible or efficient it could be. xi-unicode has a |
|
I guess we wouldn't need to scan the entire flow for line breaks all at once, as long as we can store and re-use the same |
|
So it seems like the problem is not actually stuff between textruns? For the testcase at hand the entire thing is a single textrun. I can make it into two text runs if I do |
|
Ah. So, in the original test case there is a single TextRun, but it is split into multiple Fragments, each pointing to a separate range of the TextRun. We use For a fragment that starts in the middle of a TextRun we can check whether it starts within a GlyphRun, or between GlyphRuns. For the first fragment in a TextRun, we hit the case that I mentioned previously, and we'll need to use LineBreakLeafIter during TextRun construction to record whether a break opportunity exists between this TextRun and the previous one. |
I'm not clear on where we'd do this. During fragment construction? Or in |
|
I think we'll want to add a "can break before" flag to |
Right, that's the solution for the Maybe I've misunderstood your point. |
|
Oh, wait, i see your point. Yeah, we can use the same flag for both. |
|
Though, last I checked the creation of the fragment break in |
|
Updated code. r? @mbrubeck Going to try some edge cases with mixed scripts, including Arabic ZWJ-ing (e.g. |
|
@bors-servo try |
Detect adjoining text fragments with no whitespace between them and avoid linebreaking there First attempt at #874 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19688) <!-- Reviewable:end -->
| finished = true; | ||
| } | ||
| if idx == 0 { | ||
| break_at_zero = false; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
|
@bors-servo retry try |
Detect adjoining text fragments with no whitespace between them and avoid linebreaking there First attempt at #874 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19688) <!-- Reviewable:end -->
|
Hm, even after fixing that it doesn't seem to want to line break anymore |
Detect adjoining text fragments with no line break opportunity between them First attempt at #874 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19688) <!-- Reviewable:end -->
|
|
|
Nothing changed between this and the try, so it's an intermittent. Had a quick look and doesn't seem related, but might investigate further if it keeps cropping up. @bors-servo retry |
Detect adjoining text fragments with no line break opportunity between them First attempt at #874 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19688) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
|
|
|
|
|
arm64 is permafail on
for both this PR and another. Trying to ssh and fix |
|
@bors-servo retry try- (rehighstated the builder, cleaned up processes) |
Detect adjoining text fragments with no line break opportunity between them First attempt at #874 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19688) <!-- Reviewable:end -->
|
|
Manishearth commentedJan 4, 2018
•
edited
First attempt at #874
This change is