Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 162988beeb145a50e6a3616383a46a6b67d8cfdf..ff08a0a65f571695d0ccc11e53b79d5563a15408 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -1237,6 +1237,21 @@ void SkPaint::getPosTextPath(const void* textData, size_t length, |
} |
} |
+SkRect SkPaint::getFontBounds() const { |
+ SkMatrix m; |
+ m.setScale(fTextSize * fTextScaleX, fTextSize); |
+ m.postSkew(fTextSkewX, 0); |
+ |
+ SkTypeface* typeface = this->getTypeface(); |
+ if (NULL == typeface) { |
+ typeface = SkTypeface::GetDefaultTypeface(); |
+ } |
+ |
+ SkRect bounds; |
+ m.mapRect(&bounds, typeface->getBounds()); |
+ return bounds; |
+} |
+ |
static void add_flattenable(SkDescriptor* desc, uint32_t tag, |
SkWriteBuffer* buffer) { |
buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL)); |