diff options
author | 2014-09-22 12:24:41 -0700 | |
---|---|---|
committer | 2014-09-22 12:24:41 -0700 | |
commit | a85511adc0173bd44ec18dd7f026ef191b2d683e (patch) | |
tree | e5addfaf60c2ead08d06d478bdfd57c9a8eddf4d | |
parent | 8d034a154fec81167ecb696c07da389b98cc02a7 (diff) |
Don't try to scale embedded bitmaps.
If a font is bitmap only we need to scale a bitmap to obtain
the requested size if there isn't an exact match. If a font has
embedded bitmaps then these bitmaps should never be scaled by Skia.
Allow FreeType to do the scaling (as requested by the font).
BUG=chromium:408059
R=mtklein@google.com
Author: bungeman@google.com
Review URL: https://codereview.chromium.org/596513002
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 7ac2083930..85f8ab9469 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -1301,7 +1301,9 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) { } } - if (fFace->glyph->format == FT_GLYPH_FORMAT_BITMAP && fScaleY && fFace->size->metrics.y_ppem) { + // If the font isn't scalable, scale the metrics from the non-scalable strike. + // This means do not try to scale embedded bitmaps; only scale bitmaps in bitmap only fonts. + if (!FT_IS_SCALABLE(fFace) && fScaleY && fFace->size->metrics.y_ppem) { // NOTE: both dimensions are scaled by y_ppem. this is WAI. scaleGlyphMetrics(*glyph, SkScalarDiv(SkFixedToScalar(fScaleY), SkIntToScalar(fFace->size->metrics.y_ppem))); |