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

Unified Diff: Source/platform/fonts/FontFastPath.cpp

Issue 130433006: Implement CSS Emphasis Marks for complex text (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New Approach, splitting hb-clusters into grapheme clusters, comment cleanup, rebaseline Created 6 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/FontFastPath.cpp
diff --git a/Source/platform/fonts/FontFastPath.cpp b/Source/platform/fonts/FontFastPath.cpp
index 93e9015e08b1d050895e21ce0ccbc98aa6a53925..e8d24a55cace16e55607e64bbc6c7c8746246c06 100644
--- a/Source/platform/fonts/FontFastPath.cpp
+++ b/Source/platform/fonts/FontFastPath.cpp
@@ -498,9 +498,9 @@ inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph
return fontData->widthForGlyph(glyph) / 2;
}
-inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
+inline static float offsetToMiddleOfAdvanceAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
{
- return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
+ return glyphBuffer.advanceAt(i) / 2;
}
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& runInfo, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
@@ -519,12 +519,12 @@ void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r
Glyph markGlyph = markGlyphData.glyph;
Glyph spaceGlyph = markFontData->spaceGlyph();
- float middleOfLastGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, 0);
+ float middleOfLastGlyph = offsetToMiddleOfAdvanceAtIndex(glyphBuffer, 0);
FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y());
GlyphBuffer markBuffer;
for (unsigned i = 0; i + 1 < glyphBuffer.size(); ++i) {
- float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1);
+ float middleOfNextGlyph = offsetToMiddleOfAdvanceAtIndex(glyphBuffer, i + 1);
float advance = glyphBuffer.advanceAt(i) - middleOfLastGlyph + middleOfNextGlyph;
markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
middleOfLastGlyph = middleOfNextGlyph;

Powered by Google App Engine
This is Rietveld 408576698