|
|
Created:
5 years, 2 months ago by drott Modified:
5 years, 2 months ago CC:
chromium-reviews, pdr+graphicswatchlist_chromium.org, drott+blinkwatch_chromium.org, Rik, blink-reviews-platform-graphics_chromium.org, dshwang, jbroman, Justin Novosad, danakj, krit, f(malita), blink-reviews, Stephen Chennney, rwlbuis Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionImprove shaping segmentation for grapheme cluster based font fallback
Previously our pre-shaping segmentation relied on GlyphPageTreeNode for
several different criteria of text segmentation: the font to be used,
upright orientation in vertical text, and small caps behavior. Also, the
pre-shaping stage of script run resolution did not handle braces and
created an extra vector of runs, instead of resolving script runs
incrementally.
As a preparation to this change, ScriptRunIterator, OrientationIterator,
SmallCapsIterator and a RunSegmenter have been introduced to isolate the
run segmentation.
Using RunSegmenter, we can now shape font by font, iterating over the
fonts using a newly introduced FontFallbackIterator.
FontFallbackIterator takes care of providing the shaper with the
available fonts, as specified by CSS, user preference and system
fallback.
The new approach is to let the shaper shape as much as possible of the
current segment, then identify the .notdef sequences. The sequences of
.notdef glyphs are added to a todo list, then shaped with the next
available font.
Bottom line, this fixes several issues we had with chosing base glyph
and combining mark from different fonts, placing them incorrectly,
etc. It also improves our script resolution to handle braces
correctly. It allows us to close a number of bugs related to this area
and should make using subsetted web fonts much more reliable.
It also allows us to finally remove GlyphPageTreeNode and friends, the
core parts of the simple font code path.
BUG=504745
TEST=inspector-protocol/layout-fonts/unicode-range-combining-chars-fallback.html
Committed: https://crrev.com/9f6a2b03ccb7091804f173b70b5facff7dffbd61
Cr-Commit-Position: refs/heads/master@{#355800}
Patch Set 1 #
Total comments: 19
Patch Set 2 : Review comments addressed #
Total comments: 2
Patch Set 3 : One more unsigned #Patch Set 4 : Requesting rebaselines #Patch Set 5 : TestExpectations adjustments #Patch Set 6 : rebaseline updates #Patch Set 7 : windows expectations updated #Patch Set 8 : rebased #Patch Set 9 : ImageOnlyFailure => Failure #Patch Set 10 : Another attempt #Patch Set 11 : rebased #Patch Set 12 : Fallback to next while loading, unicode-range restrictions #Patch Set 13 : Experimentally move non-AAT? font first #Patch Set 14 : Rebase on top of updated font-face-unicode-range test and moved FontDataRange #Patch Set 15 : fix additional fallback load triggers, contains harfbuzz compat decomp fix #Patch Set 16 : hopefully last round of TestExpectations tweaks #Patch Set 17 : a few more Win rebaselines #Patch Set 18 : Rebased on top of updated HarfBuzz #Patch Set 19 : merge TestExpectations with the HarfBuzz rebaselines #Messages
Total messages: 111 (50 generated)
drott@chromium.org changed reviewers: + behdad@chromium.org, eae@chromium.org
This is awesome! https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp (left): https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp:457: if (!m_combiningCharacterSequenceSupport) This also means we can remove m_combiningCharacterSequenceSupport from SimpleFontData.h, right? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp (right): https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:839: FontPlatformData* platformData = const_cast<FontPlatformData*>(&(currentFont->platformData())); Is this const_cast really needed? harfBuzzFace() is marked as const and that looks like the only method called on platformData. https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:854: hb_buffer_add_utf16(harfBuzzBuffer, &preContext, 1, 1, 0); We don't need this any more, right? (If you want to remove it in a subsequent change that's perfectly fine). https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:867: ShapeResult* shapeResult, const ShapeResult? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:885: int numGlyphs = hb_buffer_get_length(harfBuzzBuffer); unsigned? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:888: int lastChangePosition = 0; unsigned https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:895: for (int j = 0; j <= numGlyphs; ++j) { unsigned glyphIndex or i? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:908: currentClusterResult = currentClusterResult == Shaped ? Shaped : NotDef; When would currentClusterResult be anything but Shaped if codepoint is non-zero? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:922: } This logic is a little hard to follow. If the currentClusterResult is NotDef then it's set to Shaped, if it's Shaped it is set to NotDef. Did I get that right? If so wouldn't the following be easier: previousClusterResult = currentClusterResult; currentClusterResult = currentClusterResult == NotDef ? Shaped : NotDef; Also, this needs a better comment explaining why we flip it. https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:932: int numCharacters = 0; Can we use unsigned for these? Mixing signed and unsigned (or even using signed for offsets) makes me a bit nervous. https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:944: } else { // Direction Backwards https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:974: if ((currentClusterResult == NotDef && numCharacters != 0) || isLastResort) { && numCharacters will do. No need to have the explicit comparison as it cannot be negative. https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:989: static inline const SimpleFontData* mangleFontDirection(const SimpleFontData* originalFont, The name makes it sound like this operates on the direction and returns a mangled direction value. How about something like fontDataAdjustedForOrientation? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:1016: UTF16TextIterator iterator(m_normalizedBuffer.get() + it->m_startIndex, it->m_numCharacters); Could we add an assert ensuring that the index is less than the size of the normalizedBuffer? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:1039: RunSegmenter::RunSegmenterRange segmentRange = {0, 0, USCRIPT_INVALID_CODE, OrientationIterator::OrientationInvalid, SmallCapsIterator::SmallCapsSameCase }; These two lines are really long at > 150, would you mind breaking them? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:1049: m_holesQueue.append(HolesQueueItem(HolesQueueNextFont, 0, 0)); Having a static helper for appending might make this easer to read appendToHolesQueue(HolesQueueNextFont, 0, 0); appendToHolesQueue(HolesQueueRange, segmentRange.start, segmentRange.end - segmentRange.start); https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:1138: for (int i = 0; i < numGlyphs; ++i) { unsigned, pretty please? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h (right): https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h:144: inline bool shapeRange(hb_buffer_t* harfBuzzBuffer, int startIndex, int numCharacters, const SimpleFontData* currentFont, UScriptCode currentRunScript, hb_language_t); How about using unsigned for startIndex and numCharacters? https://codereview.chromium.org/1397423004/diff/1/third_party/WebKit/Source/p... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h:146: bool buildHint(Vector<UChar32>& hint, bool needsList); This could use a better name or a comment.
The CQ bit was checked by eae@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/1
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
Thanks for making the suggested changes and for adding detailed comments! https://codereview.chromium.org/1397423004/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp (right): https://codereview.chromium.org/1397423004/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp:910: // characters have been shaped, too. Got it, that makes sense. Thanks for adding the comment. https://codereview.chromium.org/1397423004/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h (right): https://codereview.chromium.org/1397423004/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h:237: bool collectFallbackHintChars(Vector<UChar32>& hint, bool needsList); Much clearer, thank you!
LGTM!
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps50001 (title: "Requesting rebaselines")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/50001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/50001
The CQ bit was unchecked by drott@chromium.org
The CQ bit was checked by drott@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/50001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/50001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps70001 (title: "TestExpectations adjustments")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/70001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/70001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
rebaseline updates
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps90001 (title: "rebaseline updates")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/90001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/90001
windows expectations updated
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps110001 (title: "windows expectations updated")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/110001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/110001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by drott@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/110001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/110001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by drott@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/110001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/110001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
rebased
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps130001 (title: "rebased")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/130001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/130001
ImageOnlyFailure => Failure
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps150001 (title: "ImageOnlyFailure => Failure")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/150001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/150001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps170001 (title: "Another attempt")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/170001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/170001
The CQ bit was unchecked by drott@chromium.org
rebased
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eae@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps190001 (title: "rebased")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/190001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
Fallback to next while loading, unicode-range restrictions
Patchset #12 (id:210001) has been deleted
Fallback to next while loading, unicode-range restrictions
lgtm
Rebase on top of updated font-face-unicode-range test and moved FontDataRange
Patchset #14 (id:270001) has been deleted
Rebase on top of updated font-face-unicode-range test and moved FontDataRange
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/290001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/290001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: CLs for remote refs other than refs/pending/heads/master must contain NOTRY=true and NOPRESUBMIT=true in order for the CQ to process them
Patchset #14 (id:290001) has been deleted
Rebase on top of updated font-face-unicode-range test and moved FontDataRange
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/310001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/310001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
fix additional fallback load triggers, contains harfbuzz compat decomp fix
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/330001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/330001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
hopefully last round of TestExpectations tweaks
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/350001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/350001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
a few more Win rebaselines
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/370001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/370001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
Okay, I think this is ready now, together with https://codereview.chromium.org/1418533006/ and https://codereview.chromium.org/1416013004/#. It would be great, Emil, if you have some time to review the most recent changes: a) Plumbing the unicode-range parameters through to HarfBuzzFace so that the given segmented font is only used for that range. b) Avoiding falling back and triggering load of another segmented web font when unicode-ranges overlap (change in FontFallbackIterator to have map of the loading ranges) c) Identified an issue with b) for AAT fonts, filed as crbug.com/545555 d) Identified an issue with HarfBuzz doing unicode compatibility decomposition, leading to suboptimal glyph substitutions, addressed in https://codereview.chromium.org/1416013004/# e) Fixed one more test in https://codereview.chromium.org/1418533006/ Given that the two other CLs would land, this can land, too, I believe. Thanks in advance!
Rebased on top of updated HarfBuzz
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/390001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/390001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
merge TestExpectations with the HarfBuzz rebaselines
The CQ bit was checked by drott@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/410001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/410001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM
The CQ bit was checked by drott@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from behdad@chromium.org Link to the patchset: https://codereview.chromium.org/1397423004/#ps410001 (title: "merge TestExpectations with the HarfBuzz rebaselines")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1397423004/410001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1397423004/410001
Message was sent while issue was closed.
Committed patchset #19 (id:410001)
Message was sent while issue was closed.
Hella Yout and Halleluja! \o/
Message was sent while issue was closed.
Patchset 19 (id:??) landed as https://crrev.com/9f6a2b03ccb7091804f173b70b5facff7dffbd61 Cr-Commit-Position: refs/heads/master@{#355800}
Message was sent while issue was closed.
I believe this caused some test failures. Filed https://code.google.com/p/chromium/issues/detail?id=547390 |