Index: src/ports/SkFontHost_mac.cpp |
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp |
index 842c5e6b71747fa40ecff7e92fbcc663f56b8caa..93255df920f328cbb4d78c45583dc40a4509e79b 100644 |
--- a/src/ports/SkFontHost_mac.cpp |
+++ b/src/ports/SkFontHost_mac.cpp |
@@ -807,10 +807,16 @@ SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface, |
// As a result, it is necessary to know the actual device size and request that. |
SkVector scale; |
SkMatrix skTransform; |
- fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, &skTransform, |
- nullptr, nullptr, &fFUnitMatrix); |
+ bool invertable = fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, |
+ &scale, &skTransform, nullptr, nullptr, &fFUnitMatrix); |
fTransform = MatrixToCGAffineTransform(skTransform); |
- fInvTransform = CGAffineTransformInvert(fTransform); |
+ // CGAffineTransformInvert documents that if the transform is non-invertible it will return the |
+ // passed transform unchanged. It does so, but then also prints a message to stdout. Avoid this. |
+ if (invertable) { |
+ fInvTransform = CGAffineTransformInvert(fTransform); |
+ } else { |
+ fInvTransform = fTransform; |
+ } |
// The transform contains everything except the requested text size. |
// Some properties, like 'trak', are based on the text size (before applying the matrix). |