Index: Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
index d9be39f6aab7699ec011ae7ce34786fc6253947d..32ba8965eb210519c970550b0b83fa2b0e7b5bfa 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp |
@@ -481,15 +481,6 @@ |
return charactersSoFar; |
} |
-void ShapeResult::fallbackFonts(HashSet<const SimpleFontData*>* fallback) const |
-{ |
- ASSERT(fallback); |
- for (unsigned i = 0; i < m_runs.size(); ++i) { |
- if (m_runs[i] && m_runs[i]->m_fontData != m_primaryFont) |
- fallback->add(m_runs[i]->m_fontData); |
- } |
-} |
- |
unsigned ShapeResult::numberOfRunsForTesting() const |
{ |
return m_runs.size(); |
@@ -576,13 +567,17 @@ |
} |
} |
-HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run) |
- : Shaper(font, run) |
+HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, |
+ HashSet<const SimpleFontData*>* fallbackFonts) |
+ : Shaper(font, run, nullptr, fallbackFonts) |
, m_normalizedBufferLength(0) |
, m_wordSpacingAdjustment(font->fontDescription().wordSpacing()) |
, m_letterSpacing(font->fontDescription().letterSpacing()) |
, m_expansionOpportunityCount(0) |
{ |
+ // TODO(eae): Once SimpleShaper is gone the ownership of this should shift |
+ // to HarfBuzzShaper. |
+ ASSERT(fallbackFonts); |
m_normalizedBuffer = adoptArrayPtr(new UChar[m_textRun.length() + 1]); |
normalizeCharacters(m_textRun, m_textRun.length(), m_normalizedBuffer.get(), &m_normalizedBufferLength); |
setExpansion(m_textRun.expansion()); |
@@ -944,6 +939,8 @@ |
{ |
ASSERT(endCharacter > startCharacter); |
ASSERT(script != USCRIPT_INVALID_CODE); |
+ if (m_fallbackFonts) |
+ trackNonPrimaryFallbackFont(fontData); |
hb_direction_t direction = TextDirectionToHBDirection(m_textRun.direction(), |
m_font->fontDescription().orientation(), fontData); |
@@ -1105,6 +1102,7 @@ |
run->m_width = totalAdvance > 0.0 ? totalAdvance : 0.0; |
result->m_width += run->m_width; |
+ result->m_fallbackFonts = *m_fallbackFonts; |
} |
float HarfBuzzShaper::adjustSpacing(ShapeResult::RunInfo* run, size_t glyphIndex, unsigned currentCharacterIndex, float& offset, float& totalAdvance) |