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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: src/ports/SkFontHost_mac.cpp
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index ac0e365e2ef1658e04349a18b76f1cf4a579e43f..35815b60b6eb2c45cee91dd12ab9b8a70395bc98 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1379,6 +1379,18 @@ void SkScalerContext_Mac::generateFontMetrics(SkPaint::FontMetrics* mx,
theMetrics.fXMin = CGToScalar( CGRectGetMinX_inline(theBounds));
theMetrics.fXMax = CGToScalar( CGRectGetMaxX_inline(theBounds));
theMetrics.fXHeight = CGToScalar( CTFontGetXHeight(fCTFont));
+ theMetrics.fUnderlineThickness = CGToScalar( CTFontGetUnderlineThickness(fCTFont));
+ theMetrics.fUnderlinePosition = CGToScalar( CTFontGetUnderlinePosition(fCTFont));
+
+ 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,
+ theMetrics.unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIsValid_FontMetricFlag);
+ else
+ theMetrics.setFontMetricsFlag(SkPaint::FontMetrics::kUnderlineThinknessIsValid_FontMetricFlag);
+
+ if(!theMetrics.fUnderlinePosition)
+ theMetrics.unsetFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsValid_FontMetricsflag);
+ else
+ theMetrics.setFontMetricsFlag(SkPaint::FontMetrics::kUnderlinePositionIsValid_FontMetricsflag);
if (mx != NULL) {
*mx = theMetrics;

Powered by Google App Engine
This is Rietveld 408576698