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

Unified Diff: src/ports/SkFontHost_win_dw.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: Updating files as per HEAD 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
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win_dw.cpp
diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp
index ce5e49b358c3a87f8d53f7d494a401aa6fa5c446..b80154aa6154d52c1560ad239c81908902ef4e50 100644
--- a/src/ports/SkFontHost_win_dw.cpp
+++ b/src/ports/SkFontHost_win_dw.cpp
@@ -874,6 +874,11 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* mx,
mx->fBottom = mx->fDescent;
mx->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem;
mx->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem;
+ mx->fUnderlineThickness = fRec.fTextSize * SkIntToScalar(dwfm.underlinePosition) / upem;
+ mx->fUnderlinePosition = -(fRec.fTextSize * SkIntToScalar(dwfm.underlineThickness) / upem);
+
+ mx->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
+ mx->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
}
if (my) {
@@ -883,6 +888,11 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* mx,
my->fBottom = my->fDescent;
my->fLeading = fRec.fTextSize * SkIntToScalar(dwfm.lineGap) / upem;
my->fXHeight = fRec.fTextSize * SkIntToScalar(dwfm.xHeight) / upem;
+ my->fUnderlineThickness = fRec.fTextSize * SkIntToScalar(dwfm.underlinePosition) / upem;
+ my->fUnderlinePosition = -(fRec.fTextSize * SkIntToScalar(dwfm.underlineThickness) / upem);
+
+ my->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
+ my->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
}
}
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698