Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 88e5b432eb8d714bb4ae52d716844d22f01e537a..bd3961a5ae6039c282997031769a44d76e3c82c7 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -996,8 +996,25 @@ SkScalar SkPaint::setupForAsPaths() { |
this->setHinting(SkPaint::kNo_Hinting); |
SkScalar textSize = fTextSize; |
- this->setTextSize(kCanonicalTextSizeForPaths); |
- return textSize / kCanonicalTextSizeForPaths; |
+ SkScalar scale = SK_Scalar1; |
+ |
+ // path effect will affects the generation of path for text, don't change |
+ // SkPaint if it exists. If no path effect, text drawing is based on |
+ // canonical text, so textSize and strokeWidth need to be reset. However, |
+ // hairline stroked text is treated as filled to generate its path. |
+ if (NULL == this->getPathEffect()) { |
+ this->setTextSize(kCanonicalTextSizeForPaths); |
+ scale = textSize / kCanonicalTextSizeForPaths; |
+ |
+ if (this->getStrokeWidth() > 0 && |
+ SkPaint::kFill_Style != this->getStyle()) { |
+ this->setStrokeWidth(SkScalarDiv(this->getStrokeWidth(), scale)); |
+ } else { |
+ this->setStyle(SkPaint::kFill_Style); |
+ } |
+ } |
+ |
+ return scale; |
} |
class SkCanonicalizePaint { |