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

Unified Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 1241613006: Reland "Change fallback font collection in HarfBuzzShaper" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 5 years, 5 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: Source/platform/fonts/shaping/HarfBuzzShaper.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index 32ba8965eb210519c970550b0b83fa2b0e7b5bfa..d9be39f6aab7699ec011ae7ce34786fc6253947d 100644
--- a/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -481,6 +481,15 @@ int ShapeResult::offsetForPosition(float targetX)
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();
@@ -567,17 +576,13 @@ static void normalizeCharacters(const TextRun& run, unsigned length, UChar* dest
}
}
-HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run,
- HashSet<const SimpleFontData*>* fallbackFonts)
- : Shaper(font, run, nullptr, fallbackFonts)
+HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run)
+ : Shaper(font, run)
, 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());
@@ -939,8 +944,6 @@ void HarfBuzzShaper::addHarfBuzzRun(unsigned startCharacter,
{
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);
@@ -1102,7 +1105,6 @@ void HarfBuzzShaper::shapeResult(ShapeResult* result, unsigned index,
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)
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.h ('k') | Source/platform/fonts/shaping/HarfBuzzShaperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698