Chromium Code Reviews| Index: Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp |
| diff --git a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp |
| index 2fd38bf7a7bd3210200522549f47e7364be4ac10..b6b489bfe196eca6515be7f49fbf2f615cc48635 100644 |
| --- a/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp |
| +++ b/Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp |
| @@ -157,7 +157,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, |
| pos[i].set( |
| x + SkIntToScalar(lroundf(translations[i].x())), |
| y + -SkIntToScalar(-lroundf(currentWidth - translations[i].y()))); |
| - currentWidth += glyphBuffer.advanceAt(from + glyphIndex).width(); |
| + currentWidth += glyphBuffer.advanceAt(from + glyphIndex); |
| } |
| horizontalOffset += currentWidth; |
| paintGlyphs(gc, font, glyphs, chunkLength, pos, textRect); |
| @@ -167,13 +167,13 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, |
| return; |
| } |
| - if (!glyphBuffer.hasVerticalAdvances()) { |
| + if (!glyphBuffer.hasOffsets()) { |
| SkAutoSTMalloc<64, SkScalar> storage(numGlyphs); |
| SkScalar* xpos = storage.get(); |
| - const FloatSize* adv = glyphBuffer.advances(from); |
| + const float* adv = glyphBuffer.advances(from); |
| for (unsigned i = 0; i < numGlyphs; i++) { |
| xpos[i] = x; |
| - x += SkFloatToScalar(adv[i].width()); |
| + x += SkFloatToScalar(adv[i]); |
| } |
| const Glyph* glyphs = glyphBuffer.glyphs(from); |
| paintGlyphsHorizontal(gc, font, glyphs, numGlyphs, xpos, SkFloatToScalar(y), textRect); |
| @@ -188,11 +188,14 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, |
| // here. |
| SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); |
| SkPoint* pos = storage.get(); |
| - const FloatSize* adv = glyphBuffer.advances(from); |
| + const FloatSize* offsets = glyphBuffer.offsets(from); |
| + const float* advances = glyphBuffer.advances(from); |
| + SkScalar advanceSoFar = SkFloatToScalar(0); |
| for (unsigned i = 0; i < numGlyphs; i++) { |
| - pos[i].set(x, y); |
| - x += SkFloatToScalar(adv[i].width()); |
| - y += SkFloatToScalar(adv[i].height()); |
| + pos[i].set( |
| + x + SkFloatToScalar(offsets[i].width()) + advanceSoFar, |
| + y + SkFloatToScalar(offsets[i].height())); |
| + advanceSoFar += SkFloatToScalar(advances[i]); |
| } |
| const Glyph* glyphs = glyphBuffer.glyphs(from); |
| @@ -236,8 +239,7 @@ float Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo |
| shaper.setDrawRange(runInfo.from, runInfo.to); |
| if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty()) |
| return 0; |
| - FloatPoint adjustedPoint = shaper.adjustStartPoint(point); |
| - return drawGlyphBuffer(gc, runInfo, glyphBuffer, adjustedPoint); |
| + return drawGlyphBuffer(gc, runInfo, glyphBuffer, point); |
| } |
| void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const |
| @@ -302,7 +304,6 @@ PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initia |
| // FIXME: Except for setupPaint, this is not specific to FontHarfBuzz. |
| // FIXME: Also implement the more general full-positioning path. |
| - ASSERT(!glyphBuffer.hasVerticalAdvances()); |
| SkTextBlobBuilder builder; |
| SkScalar x = SkFloatToScalar(initialAdvance); |
| @@ -340,10 +341,10 @@ PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initia |
| const uint16_t* glyphs = glyphBuffer.glyphs(start); |
| std::copy(glyphs, glyphs + count, buffer.glyphs); |
| - const FloatSize* advances = glyphBuffer.advances(start); |
| + const FloatSize* offsets = glyphBuffer.offsets(start); |
|
f(malita)
2014/09/25 16:42:05
I think we still want advances here. We only suppo
eae
2014/09/26 05:26:51
Right, thanks!
|
| for (unsigned j = 0; j < count; j++) { |
| buffer.pos[j] = x; |
| - x += SkFloatToScalar(advances[j].width()); |
| + x += SkFloatToScalar(offsets[j].width()); |
| } |
| } |