Index: src/ports/SkFontHost_FreeType_common.cpp |
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp |
index e4323d81a1c8c8a5ba73950a361428d6ffa3b187..065a83a41c2d4c3546363d311ec501cdb57b40ab 100644 |
--- a/src/ports/SkFontHost_FreeType_common.cpp |
+++ b/src/ports/SkFontHost_FreeType_common.cpp |
@@ -344,6 +344,11 @@ |
FT_BBox bbox; |
FT_Bitmap target; |
+ if (fRec.fFlags & SkScalerContext::kEmbolden_Flag && |
+ !(face->style_flags & FT_STYLE_FLAG_BOLD)) { |
+ emboldenOutline(face, outline); |
+ } |
+ |
int dx = 0, dy = 0; |
if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) { |
dx = SkFixedToFDot6(glyph.getSubXFixed()); |
@@ -542,6 +547,10 @@ |
void SkScalerContext_FreeType_Base::generateGlyphPath(FT_Face face, |
SkPath* path) |
{ |
+ if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) { |
+ emboldenOutline(face, &face->glyph->outline); |
+ } |
+ |
FT_Outline_Funcs funcs; |
funcs.move_to = move_proc; |
@@ -560,3 +569,11 @@ |
path->close(); |
} |
+ |
+void SkScalerContext_FreeType_Base::emboldenOutline(FT_Face face, FT_Outline* outline) |
+{ |
+ FT_Pos strength; |
+ strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) |
+ / 24; |
+ FT_Outline_Embolden(outline, strength); |
+} |