diff options
author | bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 19:34:22 +0000 |
---|---|---|
committer | bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 19:34:22 +0000 |
commit | 12bd4a014745acc3cffc20f23952bbb6f8477351 (patch) | |
tree | 03423afc71e13b6fc3b8a296c2c843aa4e4c60ee /src/ports | |
parent | a6ecbb8414b017fcb262e645fffc5a3129ecdf43 (diff) |
Provide last resort for fCapHeight in SkFontHost_FreeType::onGetAdvancedTypefaceMetrics.
This was a pre-existing issue, but r12689 uncovered it in more cases.
Since there was no last resort, fonts without a cap height used
uninitialized data as their cap height here.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/114773004
git-svn-id: http://skia.googlecode.com/svn/trunk@12779 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index f79e27b7ed..6b29c1d31e 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -602,6 +602,9 @@ SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics( info->fCapHeight = m_bbox.yMax - m_bbox.yMin; } else if (!got_m && got_x) { info->fCapHeight = x_bbox.yMax - x_bbox.yMin; + } else { + // Last resort, use the ascent. + info->fCapHeight = info->fAscent; } } |