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

Unified Diff: src/ports/SkFontHost_FreeType.cpp

Issue 216983005: The android framework should not embolden glyphs that originate from bold fonts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: spacing part 2 Created 6 years, 9 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_FreeType.cpp
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index fce8259a39ce40e8affbd1b5ec1189ddf338555d..97caab4b6be5aabb8ca25f348a0f4add055994ad 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1497,20 +1497,30 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* mx,
void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph)
{
- if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
- switch ( glyph->format ) {
- case FT_GLYPH_FORMAT_OUTLINE:
- FT_Pos strength;
- strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) / 24;
- FT_Outline_Embolden(&glyph->outline, strength);
- 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");
- }
+ // check to see if the embolden bit is set
+ if (0 == (fRec.fFlags & SkScalerContext::kEmbolden_Flag)) {
bungeman-skia 2014/04/01 18:13:01 nit: you could also use SkToBool(...) here.
+ return;
+ }
+
+#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
+ // Android doesn't want to embolden a font that is already bold.
+ if ((fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
+ return;
+ }
+#endif
+
+ switch (glyph->format) {
+ case FT_GLYPH_FORMAT_OUTLINE:
+ FT_Pos strength;
+ strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale) / 24;
+ FT_Outline_Embolden(&glyph->outline, strength);
+ 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");
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698