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

Side by Side Diff: src/ports/SkFontHost_mac.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, 9 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 unified diff | Download patch
« src/core/SkScalerContext.cpp ('K') | « src/core/SkScalerContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkTypes.h" // Keep this before any #ifdef ... 9 #include "SkTypes.h" // Keep this before any #ifdef ...
10 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 10 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 /* 1352 /*
1353 * For subpixel positioning, we want to return an unhinted outline, so it 1353 * For subpixel positioning, we want to return an unhinted outline, so it
1354 * can be positioned nicely at fractional offsets. However, we special-case 1354 * can be positioned nicely at fractional offsets. However, we special-case
1355 * if the baseline of the (horizontal) text is axis-aligned. In those cases 1355 * if the baseline of the (horizontal) text is axis-aligned. In those cases
1356 * we want to retain hinting in the direction orthogonal to the baseline. 1356 * we want to retain hinting in the direction orthogonal to the baseline.
1357 * e.g. for horizontal baseline, we want to retain hinting in Y. 1357 * e.g. for horizontal baseline, we want to retain hinting in Y.
1358 * The way we remove hinting is to scale the font by some value (4) in that 1358 * The way we remove hinting is to scale the font by some value (4) in that
1359 * direction, ask for the path, and then scale the path back down. 1359 * direction, ask for the path, and then scale the path back down.
1360 */ 1360 */
1361 if (fDoSubPosition) { 1361 if (fDoSubPosition) {
1362 SkMatrix m;
1363 fRec.getSingleMatrix(&m);
1364
1365 // start out by assuming that we want no hining in X and Y 1362 // start out by assuming that we want no hining in X and Y
1366 scaleX = scaleY = kScaleForSubPixelPositionHinting; 1363 scaleX = scaleY = kScaleForSubPixelPositionHinting;
1367 // now see if we need to restore hinting for axis-aligned baselines 1364 // now see if we need to restore hinting for axis-aligned baselines
1368 switch (SkComputeAxisAlignmentForHText(m)) { 1365 switch (this->computeAxisAlignmentForHText()) {
1369 case kX_SkAxisAlignment: 1366 case kX_SkAxisAlignment:
1370 scaleY = SK_Scalar1; // want hinting in the Y direction 1367 scaleY = SK_Scalar1; // want hinting in the Y direction
1371 break; 1368 break;
1372 case kY_SkAxisAlignment: 1369 case kY_SkAxisAlignment:
1373 scaleX = SK_Scalar1; // want hinting in the X direction 1370 scaleX = SK_Scalar1; // want hinting in the X direction
1374 break; 1371 break;
1375 default: 1372 default:
1376 break; 1373 break;
1377 } 1374 }
1378 1375
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 } 2624 }
2628 return face; 2625 return face;
2629 } 2626 }
2630 }; 2627 };
2631 2628
2632 /////////////////////////////////////////////////////////////////////////////// 2629 ///////////////////////////////////////////////////////////////////////////////
2633 2630
2634 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } 2631 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
2635 2632
2636 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 2633 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
OLDNEW
« src/core/SkScalerContext.cpp ('K') | « src/core/SkScalerContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698