SkPaint::Style style = paint.getStyle();
SkScalar strokeWidth = paint.getStrokeWidth();
+ unsigned flags = SkFontHost::ComputeGammaFlag(paint);
+
if (paint.isFakeBoldText())
{
+#ifdef SK_USE_FREETYPE_EMBOLDEN
+ flags |= SkScalerContext::kEmbolden_Flag;
+#else
SkScalar fakeBoldScale = interpolate(paint.getTextSize(), pointSizes, multipliers, 2);
SkScalar extra = SkScalarMul(paint.getTextSize(), fakeBoldScale);
}
else
strokeWidth += extra;
+#endif
}
- unsigned flags = SkFontHost::ComputeGammaFlag(paint);
-
if (paint.isDevKernText())
flags |= SkScalerContext::kDevKernText_Flag;
uint32_t fLoadGlyphFlags;
FT_Error setupSize();
+ void emboldenOutline(FT_Outline* outline);
};
///////////////////////////////////////////////////////////////////////////
return err;
}
+void SkScalerContext_FreeType::emboldenOutline(FT_Outline* outline) {
+ FT_Pos strength;
+ strength = FT_MulFix(fFace->units_per_EM, fFace->size->metrics.y_scale)
+ / 24;
+ FT_Outline_Embolden(outline, strength);
+}
+
unsigned SkScalerContext_FreeType::generateGlyphCount() const {
return fFace->num_glyphs;
}
case FT_GLYPH_FORMAT_OUTLINE:
FT_BBox bbox;
+ if (fRec.fFlags & kEmbolden_Flag) {
+ emboldenOutline(&fFace->glyph->outline);
+ }
FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox);
if (fRec.fSubpixelPositioning) {
FT_BBox bbox;
FT_Bitmap target;
+ if (fRec.fFlags & kEmbolden_Flag) {
+ emboldenOutline(outline);
+ }
+
int dx = 0, dy = 0;
if (fRec.fSubpixelPositioning) {
dx = glyph.getSubXFixed() >> 10;
return;
}
+ if (fRec.fFlags & kEmbolden_Flag) {
+ emboldenOutline(&fFace->glyph->outline);
+ }
+
FT_Outline_Funcs funcs;
funcs.move_to = move_proc;
if (x_glyph) {
FT_BBox bbox;
FT_Load_Glyph(fFace, x_glyph, fLoadGlyphFlags);
+ if (fRec.fFlags & kEmbolden_Flag) {
+ emboldenOutline(&fFace->glyph->outline);
+ }
FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox);
x_height = SkIntToScalar(bbox.yMax) / 64;
} else {