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

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.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/shaping/HarfBuzzShaper.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index ed89e06329adfd9b94d7685f474fb220a8e84868..74b829f191d7eab2e8b38b7957d90163d162a829 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -275,8 +275,7 @@ inline bool HarfBuzzShaper::shapeRange(hb_buffer_t* harfBuzzBuffer,
unsigned startIndex,
unsigned numCharacters,
const SimpleFontData* currentFont,
- unsigned currentFontRangeFrom,
- unsigned currentFontRangeTo,
+ PassRefPtr<UnicodeRangeSet> currentFontRangeSet,
UScriptCode currentRunScript,
hb_language_t language)
{
@@ -296,7 +295,7 @@ inline bool HarfBuzzShaper::shapeRange(hb_buffer_t* harfBuzzBuffer,
m_font->getFontDescription(), m_normalizedBuffer.get(), m_normalizedBufferLength,
startIndex, numCharacters);
- HarfBuzzScopedPtr<hb_font_t> harfBuzzFont(face->createFont(currentFontRangeFrom, currentFontRangeTo), hb_font_destroy);
+ HarfBuzzScopedPtr<hb_font_t> harfBuzzFont(face->createFont(currentFontRangeSet), hb_font_destroy);
hb_shape(harfBuzzFont.get(), harfBuzzBuffer, m_features.isEmpty() ? 0 : m_features.data(), m_features.size());
return true;
@@ -512,8 +511,7 @@ PassRefPtr<ShapeResult> HarfBuzzShaper::shapeResult()
appendToHolesQueue(HolesQueueRange, segmentRange.start, segmentRange.end - segmentRange.start);
const SimpleFontData* currentFont = nullptr;
- unsigned currentFontRangeFrom = 0;
- unsigned currentFontRangeTo = 0;
+ RefPtr<UnicodeRangeSet> currentFontRangeSet;
bool fontCycleQueued = false;
while (m_holesQueue.size()) {
@@ -533,10 +531,10 @@ PassRefPtr<ShapeResult> HarfBuzzShaper::shapeResult()
break;
}
- FontDataRange nextFontDataRange = fallbackIterator->next(fallbackCharsHint);
- currentFont = nextFontDataRange.fontData().get();
- currentFontRangeFrom = nextFontDataRange.from();
- currentFontRangeTo = nextFontDataRange.to();
+ FontDataForRangeSet nextFontDataForRangeSet = fallbackIterator->next(fallbackCharsHint);
+ currentFont = nextFontDataForRangeSet.fontData().get();
+ currentFontRangeSet = nextFontDataForRangeSet.ranges();
+
if (!currentFont) {
ASSERT(!m_holesQueue.size());
break;
@@ -564,8 +562,7 @@ PassRefPtr<ShapeResult> HarfBuzzShaper::shapeResult()
currentQueueItem.m_startIndex,
currentQueueItem.m_numCharacters,
directionAndSmallCapsAdjustedFont,
- currentFontRangeFrom,
- currentFontRangeTo,
+ currentFontRangeSet,
segmentRange.script,
language))
WTF_LOG_ERROR("Shaping range failed.");

Powered by Google App Engine
This is Rietveld 408576698