Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp

Issue 1806653002: Shape unicode-range: font faces in only one iteration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update UnicodeRangeSetTests to RefPtrtr, rm copy constructor and test Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
index cf118442ee69e638474576bda6b749d06b44fa31..b0d0cf276ffa22adbf12d29ebe2acbaa14eb9ecd 100644
--- a/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
+++ b/third_party/WebKit/Source/platform/fonts/GlyphPageTreeNode.cpp
@@ -245,27 +245,31 @@ void GlyphPageTreeNode::initializePurePage(const FontData* fontData, unsigned pa
haveGlyphs = false;
const SegmentedFontData* segmentedFontData = toSegmentedFontData(fontData);
- for (int i = segmentedFontData->numRanges() - 1; i >= 0; i--) {
- const FontDataRange& range = segmentedFontData->rangeAt(i);
- // all this casting is to ensure all the parameters to min and max have the same type,
- // to avoid ambiguous template parameter errors on Windows
- int from = max(0, static_cast<int>(range.from()) - static_cast<int>(start));
- int to = 1 + min(static_cast<int>(range.to()) - static_cast<int>(start), static_cast<int>(GlyphPage::size) - 1);
- if (from >= static_cast<int>(GlyphPage::size) || to <= 0)
- continue;
-
- // If this is a custom font needs to be loaded, do not fill
- // the page so that font fallback is used while loading.
- RefPtr<CustomFontData> customData = range.fontData()->customFontData();
- if (customData && customData->isLoadingFallback()) {
- for (int j = from; j < to; j++) {
- m_page->setCustomFontToLoad(j, customData.get());
- haveGlyphs = true;
+ for (int i = segmentedFontData->numFaces() - 1; i >= 0; i--) {
+ const FontDataForRangeSet& fontDataForRangeSet = segmentedFontData->faceAt(i);
+ RefPtr<UnicodeRangeSet> ranges = fontDataForRangeSet.ranges();
+ for (size_t i = 0; i < ranges->size(); ++i) {
+ const UnicodeRange& range = ranges->rangeAt(i);
+ // all this casting is to ensure all the parameters to min and max have the same type,
+ // to avoid ambiguous template parameter errors on Windows
+ int from = max(0, static_cast<int>(range.from()) - static_cast<int>(start));
+ int to = 1 + min(static_cast<int>(range.to()) - static_cast<int>(start), static_cast<int>(GlyphPage::size) - 1);
+ if (from >= static_cast<int>(GlyphPage::size) || to <= 0)
+ continue;
+
+ // If this is a custom font needs to be loaded, do not fill
+ // the page so that font fallback is used while loading.
+ RefPtr<CustomFontData> customData = fontDataForRangeSet.fontData()->customFontData();
+ if (customData && customData->isLoadingFallback()) {
+ for (int j = from; j < to; j++) {
+ m_page->setCustomFontToLoad(j, customData.get());
+ haveGlyphs = true;
+ }
+ continue;
}
- continue;
- }
- haveGlyphs |= fill(m_page.get(), from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData().get());
+ haveGlyphs |= fill(m_page.get(), from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), fontDataForRangeSet.fontData().get());
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698