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

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: review comments Created 5 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
« no previous file with comments | « Source/platform/fonts/shaping/SimpleShaper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a5210fd635057d3216ffe01c88f686c5af4dc8b6 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,14 @@ 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 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;
« no previous file with comments | « Source/platform/fonts/shaping/SimpleShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698