| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkAdvancedTypefaceMetrics.h" | 9 #include "SkAdvancedTypefaceMetrics.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 metrics->fUnderlinePosition = underlinePosition * scale; | 1497 metrics->fUnderlinePosition = underlinePosition * scale; |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph
) | 1500 void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph
) |
| 1501 { | 1501 { |
| 1502 // check to see if the embolden bit is set | 1502 // check to see if the embolden bit is set |
| 1503 if (0 == (fRec.fFlags & SkScalerContext::kEmbolden_Flag)) { | 1503 if (0 == (fRec.fFlags & SkScalerContext::kEmbolden_Flag)) { |
| 1504 return; | 1504 return; |
| 1505 } | 1505 } |
| 1506 | 1506 |
| 1507 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) | |
| 1508 // Android doesn't want to embolden a font that is already bold. | |
| 1509 if ((fFace->style_flags & FT_STYLE_FLAG_BOLD)) { | |
| 1510 return; | |
| 1511 } | |
| 1512 #endif | |
| 1513 | |
| 1514 switch (glyph->format) { | 1507 switch (glyph->format) { |
| 1515 case FT_GLYPH_FORMAT_OUTLINE: | 1508 case FT_GLYPH_FORMAT_OUTLINE: |
| 1516 FT_Pos strength; | 1509 FT_Pos strength; |
| 1517 strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale
) / 24; | 1510 strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale
) / 24; |
| 1518 FT_Outline_Embolden(&glyph->outline, strength); | 1511 FT_Outline_Embolden(&glyph->outline, strength); |
| 1519 break; | 1512 break; |
| 1520 case FT_GLYPH_FORMAT_BITMAP: | 1513 case FT_GLYPH_FORMAT_BITMAP: |
| 1521 FT_GlyphSlot_Own_Bitmap(glyph); | 1514 FT_GlyphSlot_Own_Bitmap(glyph); |
| 1522 FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenSt
rength, 0); | 1515 FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenSt
rength, 0); |
| 1523 break; | 1516 break; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 *style = (SkTypeface::Style) tempStyle; | 1713 *style = (SkTypeface::Style) tempStyle; |
| 1721 } | 1714 } |
| 1722 if (isFixedPitch) { | 1715 if (isFixedPitch) { |
| 1723 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1716 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
| 1724 } | 1717 } |
| 1725 | 1718 |
| 1726 FT_Done_Face(face); | 1719 FT_Done_Face(face); |
| 1727 FT_Done_FreeType(library); | 1720 FT_Done_FreeType(library); |
| 1728 return true; | 1721 return true; |
| 1729 } | 1722 } |
| OLD | NEW |