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

Unified Diff: Source/platform/fonts/shaping/HarfBuzzFace.cpp

Issue 1316843005: Round glyph width and bounds if !SkPaint.isSubpixelText() in complex path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: eae nits Created 5 years, 4 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 | « LayoutTests/fast/text/complex-path-with-no-subpixel-fonts.html ('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/HarfBuzzFace.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index 5c345269de13eb618ab926ce2483c9148a98a74e..e740665315b1ec8aeed383b1963942489cc6a13e 100644
--- a/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -146,9 +146,19 @@ 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()) {
+ // Use roundOut() rather than round() to avoid rendering glyphs
+ // outside the visual overflow rect. crbug.com/452914.
+ 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);
« no previous file with comments | « LayoutTests/fast/text/complex-path-with-no-subpixel-fonts.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698