Index: Source/platform/fonts/shaping/HarfBuzzFace.cpp |
diff --git a/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
index 5c345269de13eb618ab926ce2483c9148a98a74e..bd2c129ce8ac70eb7c988a9c1fc3034324b28b55 100644 |
--- a/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
+++ b/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
@@ -146,9 +146,17 @@ static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint |
uint16_t glyph = codepoint; |
paint->getTextWidths(&glyph, sizeof(glyph), &skWidth, &skBounds); |
- if (width) |
+ if (width) { |
+ if (!paint->isSubpixelText()) |
+ skWidth = SkScalarRoundToInt(skWidth); |
*width = SkiaScalarToHarfBuzzPosition(skWidth); |
+ } |
if (extents) { |
+ if (!paint->isSubpixelText()) { |
eae
2015/09/01 16:24:38
Would you mind adding a comment here as to why we'
|
+ SkIRect ir; |
+ skBounds.roundOut(&ir); |
+ skBounds.set(ir); |
+ } |
// Invert y-axis because Skia is y-grows-down but we set up HarfBuzz to be y-grows-up. |
extents->x_bearing = SkiaScalarToHarfBuzzPosition(skBounds.fLeft); |
extents->y_bearing = SkiaScalarToHarfBuzzPosition(-skBounds.fTop); |