aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-06-05 16:52:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-05 16:52:40 -0700
commit1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5 (patch)
tree0cbaaeb7661e5196a459ab234355e1a06a8d997f
parenta1c8d491e40f972967b4ab89f63625a570fbf8fb (diff)
parentbd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e (diff)
downloadexternal_skia-1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5.zip
external_skia-1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5.tar.gz
external_skia-1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5.tar.bz2
am bd64a4dd: Use FreeType\'s "embolden", but only if face is not already bold.
* commit 'bd64a4dd0d45eb7ea09dd46e2e5f3291655dbc5e': Use FreeType's "embolden", but only if face is not already bold.
-rw-r--r--Android.mk4
-rw-r--r--src/ports/SkFontHost_FreeType.cpp14
2 files changed, 11 insertions, 7 deletions
diff --git a/Android.mk b/Android.mk
index 0630d51..08cf6f8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -51,6 +51,10 @@ endif
# procedures (C and assembly) seriously improve skia performance
LOCAL_CFLAGS += -DTEST_SRC_ALPHA
+# using freetype's embolden allows us to adjust fake bold settings at
+# draw-time, at which point we know which SkTypeface is being drawn
+LOCAL_CFLAGS += -DSK_USE_FREETYPE_EMBOLDEN
+
LOCAL_SRC_FILES:= \
src/core/Sk64.cpp \
src/core/SkAAClip.cpp \
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);