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

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 152073003: Adding code to calculate Underline Thickness from Font Metrics, this will be useful when Skia is us… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixing comments for Underline patch Created 6 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 unified diff | Download patch
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 <vector> 9 #include <vector>
10 #ifdef SK_BUILD_FOR_MAC 10 #ifdef SK_BUILD_FOR_MAC
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 SkPaint::FontMetrics theMetrics; 1372 SkPaint::FontMetrics theMetrics;
1373 theMetrics.fTop = CGToScalar(-CGRectGetMaxY_inline(theBounds)); 1373 theMetrics.fTop = CGToScalar(-CGRectGetMaxY_inline(theBounds));
1374 theMetrics.fAscent = CGToScalar(-CTFontGetAscent(fCTFont)); 1374 theMetrics.fAscent = CGToScalar(-CTFontGetAscent(fCTFont));
1375 theMetrics.fDescent = CGToScalar( CTFontGetDescent(fCTFont)); 1375 theMetrics.fDescent = CGToScalar( CTFontGetDescent(fCTFont));
1376 theMetrics.fBottom = CGToScalar(-CGRectGetMinY_inline(theBounds)); 1376 theMetrics.fBottom = CGToScalar(-CGRectGetMinY_inline(theBounds));
1377 theMetrics.fLeading = CGToScalar( CTFontGetLeading(fCTFont)); 1377 theMetrics.fLeading = CGToScalar( CTFontGetLeading(fCTFont));
1378 theMetrics.fAvgCharWidth = CGToScalar( CGRectGetWidth_inline(theBounds)); 1378 theMetrics.fAvgCharWidth = CGToScalar( CGRectGetWidth_inline(theBounds));
1379 theMetrics.fXMin = CGToScalar( CGRectGetMinX_inline(theBounds)); 1379 theMetrics.fXMin = CGToScalar( CGRectGetMinX_inline(theBounds));
1380 theMetrics.fXMax = CGToScalar( CGRectGetMaxX_inline(theBounds)); 1380 theMetrics.fXMax = CGToScalar( CGRectGetMaxX_inline(theBounds));
1381 theMetrics.fXHeight = CGToScalar( CTFontGetXHeight(fCTFont)); 1381 theMetrics.fXHeight = CGToScalar( CTFontGetXHeight(fCTFont));
1382 theMetrics.fUnderlineThickness = CGToScalar( CTFontGetUnderlineThickness(fCT Font));
1383 theMetrics.fUnderlinePosition = CGToScalar( CTFontGetUnderlinePosition(fCTFo nt));
1384
1385 if(!theMetrics.fUnderlineThickness)
bungeman-skia 2014/02/19 15:39:17 There is no reason for any of these tests; in this
h.joshi 2014/02/19 17:12:03 Okey, will make changes. On 2014/02/19 15:39:17,
1386 theMetrics.unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknes sIsValid_FontMetricFlag);
1387 else
1388 theMetrics.setFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessI sValid_FontMetricFlag);
1389
1390 if(!theMetrics.fUnderlinePosition)
1391 theMetrics.unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePosition IsValid_FontMetricsflag);
1392 else
1393 theMetrics.setFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIs Valid_FontMetricsflag);
1382 1394
1383 if (mx != NULL) { 1395 if (mx != NULL) {
1384 *mx = theMetrics; 1396 *mx = theMetrics;
1385 } 1397 }
1386 if (my != NULL) { 1398 if (my != NULL) {
1387 *my = theMetrics; 1399 *my = theMetrics;
1388 } 1400 }
1389 } 1401 }
1390 1402
1391 void SkScalerContext_Mac::CTPathElement(void *info, const CGPathElement *element ) { 1403 void SkScalerContext_Mac::CTPathElement(void *info, const CGPathElement *element ) {
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); 2317 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits);
2306 } 2318 }
2307 }; 2319 };
2308 2320
2309 /////////////////////////////////////////////////////////////////////////////// 2321 ///////////////////////////////////////////////////////////////////////////////
2310 2322
2311 SkFontMgr* SkFontMgr::Factory() { 2323 SkFontMgr* SkFontMgr::Factory() {
2312 return SkNEW(SkFontMgr_Mac); 2324 return SkNEW(SkFontMgr_Mac);
2313 } 2325 }
2314 #endif 2326 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698