| Index: src/ports/SkFontHost_FreeType.cpp
|
| diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
|
| index 62c7c128a7fbb33921c1923fd7c5d48b10830089..f79e27b7ed06890e7d4d5a4c3bab75286c1f4f45 100644
|
| --- a/src/ports/SkFontHost_FreeType.cpp
|
| +++ b/src/ports/SkFontHost_FreeType.cpp
|
| @@ -1,4 +1,4 @@
|
| -
|
| +
|
| /*
|
| * Copyright 2006 The Android Open Source Project
|
| *
|
| @@ -216,9 +216,6 @@
|
| bool getCBoxForLetter(char letter, FT_BBox* bbox);
|
| // Caller must lock gFTMutex before calling this function.
|
| void updateGlyphIfLCD(SkGlyph* glyph);
|
| - // Caller must lock gFTMutex before calling this function.
|
| - // update FreeType2 glyph slot with glyph emboldened
|
| - void emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph);
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////
|
| @@ -1139,7 +1136,10 @@
|
| return false;
|
| if (FT_Load_Glyph(fFace, glyph_id, fLoadGlyphFlags) != 0)
|
| return false;
|
| - emboldenIfNeeded(fFace, fFace->glyph);
|
| + if ((fRec.fFlags & kEmbolden_Flag) &&
|
| + !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
|
| + emboldenOutline(fFace, &fFace->glyph->outline);
|
| + }
|
| FT_Outline_Get_CBox(&fFace->glyph->outline, bbox);
|
| return true;
|
| }
|
| @@ -1189,7 +1189,6 @@
|
| glyph->zeroMetrics();
|
| return;
|
| }
|
| - emboldenIfNeeded(fFace, fFace->glyph);
|
|
|
| switch ( fFace->glyph->format ) {
|
| case FT_GLYPH_FORMAT_OUTLINE:
|
| @@ -1199,6 +1198,10 @@
|
| glyph->fTop = 0;
|
| glyph->fLeft = 0;
|
| } else {
|
| + if (fRec.fFlags & kEmbolden_Flag && !(fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
|
| + emboldenOutline(fFace, &fFace->glyph->outline);
|
| + }
|
| +
|
| FT_BBox bbox;
|
| getBBoxForCurrentGlyph(glyph, &bbox, true);
|
|
|
| @@ -1212,6 +1215,11 @@
|
| break;
|
|
|
| case FT_GLYPH_FORMAT_BITMAP:
|
| + if (fRec.fFlags & kEmbolden_Flag) {
|
| + FT_GlyphSlot_Own_Bitmap(fFace->glyph);
|
| + FT_Bitmap_Embolden(gFTLibrary, &fFace->glyph->bitmap, kBitmapEmboldenStrength, 0);
|
| + }
|
| +
|
| if (fRec.fFlags & SkScalerContext::kVertical_Flag) {
|
| FT_Vector vector;
|
| vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.horiBearingX;
|
| @@ -1290,7 +1298,6 @@
|
| return;
|
| }
|
|
|
| - emboldenIfNeeded(fFace, fFace->glyph);
|
| generateGlyphImage(fFace, glyph);
|
| }
|
|
|
| @@ -1318,7 +1325,6 @@
|
| path->reset();
|
| return;
|
| }
|
| - emboldenIfNeeded(fFace, fFace->glyph);
|
|
|
| generateGlyphPath(fFace, path);
|
|
|
| @@ -1460,25 +1466,6 @@
|
| }
|
| }
|
|
|
| -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");
|
| - }
|
| - }
|
| -}
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| #include "SkUtils.h"
|
|
|