From fcfea99d9d27284f2ef3cb30ba400f53d443a6e6 Mon Sep 17 00:00:00 2001 From: djsollen Date: Fri, 9 Jan 2015 08:18:13 -0800 Subject: Upstream custom freetype embolding strength from Android BUG=skia:2377 Review URL: https://codereview.chromium.org/839243002 --- src/ports/SkFontHost_FreeType.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 94af9ec285..a2a139c439 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -1403,6 +1403,19 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics metrics->fUnderlinePosition = underlinePosition * scale; } +/////////////////////////////////////////////////////////////////////////////// + +// hand-tuned value to reduce outline embolden strength +#ifndef SK_OUTLINE_EMBOLDEN_DIVISOR + #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + #define SK_OUTLINE_EMBOLDEN_DIVISOR 34 + #else + #define SK_OUTLINE_EMBOLDEN_DIVISOR 24 + #endif +#endif + +/////////////////////////////////////////////////////////////////////////////// + void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph) { // check to see if the embolden bit is set @@ -1413,7 +1426,8 @@ void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph switch (glyph->format) { case FT_GLYPH_FORMAT_OUTLINE: FT_Pos strength; - strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) / 24; + strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) + / SK_OUTLINE_EMBOLDEN_DIVISOR; FT_Outline_Embolden(&glyph->outline, strength); break; case FT_GLYPH_FORMAT_BITMAP: -- cgit v1.2.3