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

Unified Diff: ports/SkFontHost_FreeType.cpp

Issue 148453005: Calculate Underline thickness for Skia from Font metrics (Closed) Base URL: https://chromium.googlesource.com/external/skia/src.git@master
Patch Set: Created 6 years, 11 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 | « core/SkPaint.cpp ('k') | ports/SkFontHost_mac.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ports/SkFontHost_FreeType.cpp
diff --git a/ports/SkFontHost_FreeType.cpp b/ports/SkFontHost_FreeType.cpp
index 97046f4ba89fda49c264225fd9f5ae76b0fa34e6..2a524e71efde0aafc374fbf4b1ebe9cd95bc40b6 100644
--- a/ports/SkFontHost_FreeType.cpp
+++ b/ports/SkFontHost_FreeType.cpp
@@ -1385,6 +1385,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
// pull from format-specific metrics as needed
SkScalar ascent, descent, leading, xmin, xmax, ymin, ymax;
+ SkScalar underlineThickness;
if (face->face_flags & FT_FACE_FLAG_SCALABLE) { // scalable outline font
ascent = -SkIntToScalar(face->ascender) / upem;
descent = -SkIntToScalar(face->descender) / upem;
@@ -1393,6 +1394,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
xmax = SkIntToScalar(face->bbox.xMax) / upem;
ymin = -SkIntToScalar(face->bbox.yMin) / upem;
ymax = -SkIntToScalar(face->bbox.yMax) / upem;
+ underlineThickness = SkIntToScalar(face->underline_thickness)/upem;
// we may be able to synthesize x_height and cap_height from outline
if (!x_height) {
FT_BBox bbox;
@@ -1448,6 +1450,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
mx->fXMax = xmax;
mx->fXHeight = x_height;
mx->fCapHeight = cap_height;
+ mx->fUnderlineThickness = underlineThickness;
}
if (my) {
my->fTop = ymax * myy;
@@ -1460,6 +1463,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
my->fXMax = xmax;
my->fXHeight = x_height;
my->fCapHeight = cap_height;
+ my->fUnderlineThickness = underlineThickness;
}
}
« no previous file with comments | « core/SkPaint.cpp ('k') | ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698