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
This commit is contained in:
bungeman@google.com 2013-12-19 19:34:22 +00:00
parent a6ecbb8414
commit 12bd4a0147

View File

@ -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;
}
}