diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 20:12:41 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 20:12:41 +0000 |
commit | 2f7fb641f6a3afb436df92744bdd3f22f3b479e7 (patch) | |
tree | a88d588b2e8ba674cff27de7c14cba9febcdc599 /skia | |
parent | eb474e2d2c3acf0bdc850db5b50ccf736f8d2dc9 (diff) | |
download | chromium_src-2f7fb641f6a3afb436df92744bdd3f22f3b479e7.zip chromium_src-2f7fb641f6a3afb436df92744bdd3f22f3b479e7.tar.gz chromium_src-2f7fb641f6a3afb436df92744bdd3f22f3b479e7.tar.bz2 |
Linux: use xheight from OS2 table if given.
The x-height isn't really any longer the actual height of an 'x'. Some
faces provide an explicit x-height value in the OS/2 table which we
should use if given.
Review URL: http://codereview.chromium.org/12953
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ports/SkFontHost_FreeType.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/skia/ports/SkFontHost_FreeType.cpp b/skia/ports/SkFontHost_FreeType.cpp index ac938ec..9564c53 100644 --- a/skia/ports/SkFontHost_FreeType.cpp +++ b/skia/ports/SkFontHost_FreeType.cpp @@ -811,14 +811,18 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, SkP ys[6] = os2 ? os2->xAvgCharWidth : 0; SkScalar x_height; - const FT_UInt x_glyph = FT_Get_Char_Index(fFace, 'x'); - if (x_glyph) { - FT_BBox bbox; - FT_Load_Glyph(fFace, x_glyph, fLoadGlyphFlags); - FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox); - x_height = static_cast<SkScalar>(bbox.yMax) / 64; + if (os2 && os2->sxHeight) { + x_height = static_cast<SkScalar>(os2->sxHeight) / 64; } else { - x_height = 0; + const FT_UInt x_glyph = FT_Get_Char_Index(fFace, 'x'); + if (x_glyph) { + FT_BBox bbox; + FT_Load_Glyph(fFace, x_glyph, fLoadGlyphFlags); + FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox); + x_height = static_cast<SkScalar>(bbox.yMax) / 64; + } else { + x_height = 0; + } } // convert upem-y values into scalar points |