diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-01 19:03:07 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-01 19:03:07 +0000 |
commit | 921d2b3f6c4b32345f9561be91806793b4842283 (patch) | |
tree | 40918f080c46fcba657206d8cce230cdf6f4f2af | |
parent | 23f116daa3fbb63892bed845e9e10d431d00d0ed (diff) |
The android framework should not embolden glyphs that originate from bold fonts.
R=scroggo@google.com, bungeman@google.com
Author: djsollen@google.com
Review URL: https://codereview.chromium.org/216983005
git-svn-id: http://skia.googlecode.com/svn/trunk@14014 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index fce8259a39..97caab4b6b 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -1497,20 +1497,30 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx, void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph) { - if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) { - switch ( glyph->format ) { - case FT_GLYPH_FORMAT_OUTLINE: - FT_Pos strength; - strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) / 24; - FT_Outline_Embolden(&glyph->outline, strength); - break; - case FT_GLYPH_FORMAT_BITMAP: - FT_GlyphSlot_Own_Bitmap(glyph); - FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenStrength, 0); - break; - default: - SkDEBUGFAIL("unknown glyph format"); - } + // check to see if the embolden bit is set + if (0 == (fRec.fFlags & SkScalerContext::kEmbolden_Flag)) { + return; + } + +#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) + // Android doesn't want to embolden a font that is already bold. + if ((fFace->style_flags & FT_STYLE_FLAG_BOLD)) { + return; + } +#endif + + switch (glyph->format) { + case FT_GLYPH_FORMAT_OUTLINE: + FT_Pos strength; + strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) / 24; + FT_Outline_Embolden(&glyph->outline, strength); + break; + case FT_GLYPH_FORMAT_BITMAP: + FT_GlyphSlot_Own_Bitmap(glyph); + FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenStrength, 0); + break; + default: + SkDEBUGFAIL("unknown glyph format"); } } |