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

Unified Diff: src/core/SkPaint.cpp

Issue 805983003: Use SkPaint::getFontBounds() for text bounding boxes in pictures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another 2%, more verbose assert Created 6 years 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 | « no previous file | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index ff08a0a65f571695d0ccc11e53b79d5563a15408..a9989f46e1bd6d7018c4720ff80acafb1d1486f1 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1238,8 +1238,12 @@ void SkPaint::getPosTextPath(const void* textData, size_t length,
}
SkRect SkPaint::getFontBounds() const {
+ // This approach can be a little over 1% too narrow when using GDI,
+ // so we compensate by scaling the x-axis another 2%.
+ SkScalar xScale = fTextScaleX * 1.02f;
+
SkMatrix m;
- m.setScale(fTextSize * fTextScaleX, fTextSize);
+ m.setScale(fTextSize * xScale, fTextSize);
m.postSkew(fTextSkewX, 0);
SkTypeface* typeface = this->getTypeface();
« no previous file with comments | « no previous file | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698