Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: src/ports/SkFontHost_FreeType_common.cpp

Issue 101423004: refactor emboldenGlyph (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: always embolden glyphs when kEmbolden is set. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« bench/FontScalerBench.cpp ('K') | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..df7d8a44be2e6dba8aaa630d01f7fe21ab211e4f 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) {
bungeman-skia 2013/12/16 16:33:36 I am of two minds about removing this from here an
zheng.xu 2013/12/17 10:02:51 Moving this to SkFontHost_FreeType changes the beh
- emboldenOutline(face, &face->glyph->outline);
- }
-
FT_Outline_Funcs funcs;
funcs.move_to = move_proc;
@@ -577,3 +568,20 @@ 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)
bungeman-skia 2013/12/16 16:33:36 Having this here seems a bit silly if it's only ca
zheng.xu 2013/12/17 10:02:51 Done.
+{
+ if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
+ 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");
+ }
+ }
+}
« bench/FontScalerBench.cpp ('K') | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698