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

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

Issue 180893004: Adjust both x and y position when drawing glyphs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: w/mac fix Created 6 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/core/rendering/svg/SVGTextRunRenderingContext.cpp ('k') | Source/platform/fonts/GlyphBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/Font.cpp
diff --git a/Source/platform/fonts/Font.cpp b/Source/platform/fonts/Font.cpp
index 1de2bf07648162c8ab0a58cfc809a66f2147db1a..f9702bbf3055c0721bf70747f633dac5ce092224 100644
--- a/Source/platform/fonts/Font.cpp
+++ b/Source/platform/fonts/Font.cpp
@@ -660,7 +660,7 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const TextRunPaintInfo& run
// Draw each contiguous run of glyphs that use the same font data.
const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
FloatPoint startPoint(point);
- float nextX = startPoint.x() + glyphBuffer.advanceAt(0);
+ FloatPoint nextPoint = startPoint + glyphBuffer.advanceAt(0);
unsigned lastFrom = 0;
unsigned nextGlyph = 1;
#if ENABLE(SVG_FONTS)
@@ -679,9 +679,9 @@ void Font::drawGlyphBuffer(GraphicsContext* context, const TextRunPaintInfo& run
lastFrom = nextGlyph;
fontData = nextFontData;
- startPoint.setX(nextX);
+ startPoint = nextPoint;
}
- nextX += glyphBuffer.advanceAt(nextGlyph);
+ nextPoint += glyphBuffer.advanceAt(nextGlyph);
nextGlyph++;
}
@@ -705,7 +705,7 @@ inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph
inline static float offsetToMiddleOfAdvanceAtIndex(const GlyphBuffer& glyphBuffer, size_t i)
{
- return glyphBuffer.advanceAt(i) / 2;
+ return glyphBuffer.advanceAt(i).width() / 2;
}
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& runInfo, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
@@ -730,7 +730,7 @@ void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r
GlyphBuffer markBuffer;
for (unsigned i = 0; i + 1 < glyphBuffer.size(); ++i) {
float middleOfNextGlyph = offsetToMiddleOfAdvanceAtIndex(glyphBuffer, i + 1);
- float advance = glyphBuffer.advanceAt(i) - middleOfLastGlyph + middleOfNextGlyph;
+ float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph;
markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
middleOfLastGlyph = middleOfNextGlyph;
}
« no previous file with comments | « Source/core/rendering/svg/SVGTextRunRenderingContext.cpp ('k') | Source/platform/fonts/GlyphBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698