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

Unified Diff: src/core/SkScalerContext.cpp

Issue 1740163002: Improve horizontal baseline detection. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Just the bug fixes first. Created 4 years, 10 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
Index: src/core/SkScalerContext.cpp
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index caef2d137721254b865e0f0b29f5fac9af8fadf4..c67ca3e9fa992a4b6da0a921315e19ff070491bc 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -827,13 +827,21 @@ void SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector
}
}
-SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix) {
- SkASSERT(!matrix.hasPerspective());
-
- if (0 == matrix[SkMatrix::kMSkewY]) {
+SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() {
+ // Why fPost2x2 can be used here.
+ // getSingleMatrix multiplies in getLocalMatrix, which consists of
+ // * fTextSize (a scale, which has no effect)
+ // * fPreScaleX (a scale in x, which has no effect)
+ // * fPreSkewX (has no effect, but would on vertical text alignment).
+ // In other words, making the text bigger, stretching it along the
+ // horizontal axis, or fake italicizing it does not move the baseline.
herb_g 2016/02/29 18:37:10 italicizing; it does...
bungeman-skia 2016/02/29 19:21:20 it actually has no effect on the horizontal baseli
+
+ if (0 == fRec.fPost2x2[1][0]) {
+ // The x axis is mapped onto the x axis.
return kX_SkAxisAlignment;
}
- if (0 == matrix[SkMatrix::kMSkewX]) {
+ if (0 == fRec.fPost2x2[0][0]) {
+ // The x axis is mapped onto the y axis.
return kY_SkAxisAlignment;
}
return kNone_SkAxisAlignment;

Powered by Google App Engine
This is Rietveld 408576698