Index: src/ports/SkFontHost_FreeType_common.cpp |
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp |
index 065a83a41c2d4c3546363d311ec501cdb57b40ab..63cc659c358e506a7cc9ddcb4394215495713b7f 100644 |
--- a/src/ports/SkFontHost_FreeType_common.cpp |
+++ b/src/ports/SkFontHost_FreeType_common.cpp |
@@ -344,11 +344,6 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly |
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()); |
@@ -547,10 +542,6 @@ static int cubic_proc(const FT_Vector* pt0, const FT_Vector* pt1, |
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; |
@@ -577,3 +568,21 @@ void SkScalerContext_FreeType_Base::emboldenOutline(FT_Face face, FT_Outline* ou |
/ 24; |
FT_Outline_Embolden(outline, strength); |
} |
+ |
+void SkScalerContext_FreeType_Base::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph) |
+{ |
+ if (fRec.fFlags & SkScalerContext::kEmbolden_Flag && |
+ !(face->style_flags & FT_STYLE_FLAG_BOLD)) { |
+ switch ( glyph->format ) { |
+ case FT_GLYPH_FORMAT_OUTLINE: |
+ emboldenOutline(face, &glyph->outline); |
+ 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"); |
+ } |
+ } |
+} |