aboutsummaryrefslogtreecommitdiffstats
path: root/src/ports
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-05-30 13:39:03 -0700
committerVictoria Lease <violets@google.com>2012-05-31 09:05:51 -0700
commitbd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e (patch)
tree0cbaaeb7661e5196a459ab234355e1a06a8d997f /src/ports
parentf37732cf5b2f45e434ef1374224b870f1a0f2ca6 (diff)
downloadexternal_skia-bd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e.zip
external_skia-bd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e.tar.gz
external_skia-bd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e.tar.bz2
Use FreeType's "embolden", but only if face is not already bold.
A side-effect of not knowing the actual SkTypeface used to draw text until render-time is that we cannot make decisions based upon the face's proper font metrics. As a result, attempts to draw bold text will fail when a fallback font with normal weight is selected. With this, we can feel free to enable fake bold mode even if the primary font is bold, as the extraneous fake bold bit will just get ignored at render-time if the actual font used to draw the text is bold. Bug: 6522642 Change-Id: Icdd13f6bd36a85ba374b6ed7a08b596d4c31e86f
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontHost_FreeType.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index ada0751..621c94a 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1029,7 +1029,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
break;
}
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
emboldenOutline(&fFace->glyph->outline);
}
@@ -1051,7 +1051,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
}
case FT_GLYPH_FORMAT_BITMAP:
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
FT_GlyphSlot_Own_Bitmap(fFace->glyph);
FT_Bitmap_Embolden(gFTLibrary, &fFace->glyph->bitmap, kBitmapEmboldenStrength, 0);
}
@@ -1100,7 +1100,7 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
goto ERROR;
}
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
emboldenOutline(&fFace->glyph->outline);
}
}
@@ -1330,7 +1330,7 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
FT_BBox bbox;
FT_Bitmap target;
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
emboldenOutline(outline);
}
@@ -1373,7 +1373,7 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
} break;
case FT_GLYPH_FORMAT_BITMAP: {
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
FT_GlyphSlot_Own_Bitmap(fFace->glyph);
FT_Bitmap_Embolden(gFTLibrary, &fFace->glyph->bitmap, kBitmapEmboldenStrength, 0);
}
@@ -1516,7 +1516,7 @@ void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph,
return;
}
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
emboldenOutline(&fFace->glyph->outline);
}
@@ -1598,7 +1598,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
if (x_glyph) {
FT_BBox bbox;
FT_Load_Glyph(fFace, x_glyph, fLoadGlyphFlags);
- if (fRec.fFlags & kEmbolden_Flag) {
+ if ((fRec.fFlags & kEmbolden_Flag) && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
emboldenOutline(&fFace->glyph->outline);
}
FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox);