aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar djsollen <djsollen@google.com>2015-01-09 08:18:13 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-09 08:18:13 -0800
commitfcfea99d9d27284f2ef3cb30ba400f53d443a6e6 (patch)
tree4ae3891375f001b17f91cb79c56c631e9857ba9b /src
parent703dd2ed187b9788c5bb0f2d313f2d07695603d6 (diff)
Upstream custom freetype embolding strength from Android
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkFontHost_FreeType.cpp16
1 files changed, 15 insertions, 1 deletions
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: