aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-06-05 16:54:31 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-05 16:54:31 -0700
commit24517c6f43792290191f4860fbe1ae4ae976cede (patch)
treec53a97bcfac92eb991013ad2461ac19eb7501cfd
parent287b065688229e4750fd3fbabbf50c3a36ae87e5 (diff)
parent1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5 (diff)
downloadexternal_skia-24517c6f43792290191f4860fbe1ae4ae976cede.zip
external_skia-24517c6f43792290191f4860fbe1ae4ae976cede.tar.gz
external_skia-24517c6f43792290191f4860fbe1ae4ae976cede.tar.bz2
am 1b0ebcb6: am bd64a4dd: Use FreeType\'s "embolden", but only if face is not already bold.
* commit '1b0ebcb6e80bf4e66580808d02fe5da5b4a72ea5': 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);