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

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

Issue 986493002: Simplify text emphasis painting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/SimpleShaper.cpp
diff --git a/Source/platform/fonts/shaping/SimpleShaper.cpp b/Source/platform/fonts/shaping/SimpleShaper.cpp
index 96ac427777721d85d21b509439a992c461529071..4566f130a94f6f8b8bd39a4485ac1fced8eb47e2 100644
--- a/Source/platform/fonts/shaping/SimpleShaper.cpp
+++ b/Source/platform/fonts/shaping/SimpleShaper.cpp
@@ -37,9 +37,9 @@ using namespace Unicode;
namespace blink {
-SimpleShaper::SimpleShaper(const Font* font, const TextRun& run,
- HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* bounds, bool forTextEmphasis)
- : Shaper(font, run, forTextEmphasis ? ForTextEmphasis : NotForTextEmphasis, fallbackFonts, bounds)
+SimpleShaper::SimpleShaper(const Font* font, const TextRun& run, const GlyphData* emphasisData,
+ HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* bounds)
+ : Shaper(font, run, emphasisData, fallbackFonts, bounds)
, m_currentCharacter(0)
, m_runWidthSoFar(0)
{
@@ -173,18 +173,15 @@ unsigned SimpleShaper::advanceInternal(TextIterator& textIterator, GlyphBuffer*
m_glyphBoundingBox->unite(glyphBounds);
}
- if (m_forTextEmphasis) {
- if (!Character::canReceiveTextEmphasis(charData.character))
- glyph = 0;
-
- // The emphasis code expects mid-glyph offsets.
- width /= 2;
- m_runWidthSoFar += width;
+ if (glyphBuffer) {
+ if (!forTextEmphasis()) {
+ glyphBuffer->add(glyph, fontData, m_runWidthSoFar);
+ } else {
jbroman 2015/03/07 18:50:25 nit: consider } else if (...) { to avoid the ext
f(malita) 2015/03/09 15:04:55 Done.
+ if (Character::canReceiveTextEmphasis(charData.character))
+ addEmphasisMark(glyphBuffer, m_runWidthSoFar + width / 2);
+ }
}
- if (glyphBuffer)
- glyphBuffer->add(glyph, fontData, m_runWidthSoFar);
-
// Advance past the character we just dealt with.
textIterator.advance(charData.clusterLength);
m_runWidthSoFar += width;
« Source/platform/fonts/Font.h ('K') | « Source/platform/fonts/shaping/SimpleShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698