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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 my->fXMax = xmax; 1490 my->fXMax = xmax;
1491 my->fXHeight = x_height; 1491 my->fXHeight = x_height;
1492 my->fCapHeight = cap_height; 1492 my->fCapHeight = cap_height;
1493 my->fUnderlineThickness = underlineThickness; 1493 my->fUnderlineThickness = underlineThickness;
1494 my->fUnderlinePosition = underlinePosition; 1494 my->fUnderlinePosition = underlinePosition;
1495 } 1495 }
1496 } 1496 }
1497 1497
1498 void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph ) 1498 void SkScalerContext_FreeType::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph )
1499 { 1499 {
1500 if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) { 1500 // check to see if the embolden bit is set
1501 switch ( glyph->format ) { 1501 if (0 == (fRec.fFlags & SkScalerContext::kEmbolden_Flag)) {
bungeman-skia 2014/04/01 18:13:01 nit: you could also use SkToBool(...) here.
1502 case FT_GLYPH_FORMAT_OUTLINE: 1502 return;
1503 FT_Pos strength; 1503 }
1504 strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_s cale) / 24; 1504
1505 FT_Outline_Embolden(&glyph->outline, strength); 1505 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
1506 break; 1506 // Android doesn't want to embolden a font that is already bold.
1507 case FT_GLYPH_FORMAT_BITMAP: 1507 if ((fFace->style_flags & FT_STYLE_FLAG_BOLD)) {
1508 FT_GlyphSlot_Own_Bitmap(glyph); 1508 return;
1509 FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmbold enStrength, 0); 1509 }
1510 break; 1510 #endif
1511 default: 1511
1512 SkDEBUGFAIL("unknown glyph format"); 1512 switch (glyph->format) {
1513 } 1513 case FT_GLYPH_FORMAT_OUTLINE:
1514 FT_Pos strength;
1515 strength = FT_MulFix(face->units_per_EM, face->size->metrics.y_scale ) / 24;
1516 FT_Outline_Embolden(&glyph->outline, strength);
1517 break;
1518 case FT_GLYPH_FORMAT_BITMAP:
1519 FT_GlyphSlot_Own_Bitmap(glyph);
1520 FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenSt rength, 0);
1521 break;
1522 default:
1523 SkDEBUGFAIL("unknown glyph format");
1514 } 1524 }
1515 } 1525 }
1516 1526
1517 /////////////////////////////////////////////////////////////////////////////// 1527 ///////////////////////////////////////////////////////////////////////////////
1518 1528
1519 #include "SkUtils.h" 1529 #include "SkUtils.h"
1520 1530
1521 static SkUnichar next_utf8(const void** chars) { 1531 static SkUnichar next_utf8(const void** chars) {
1522 return SkUTF8_NextUnichar((const char**)chars); 1532 return SkUTF8_NextUnichar((const char**)chars);
1523 } 1533 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 *style = (SkTypeface::Style) tempStyle; 1720 *style = (SkTypeface::Style) tempStyle;
1711 } 1721 }
1712 if (isFixedPitch) { 1722 if (isFixedPitch) {
1713 *isFixedPitch = FT_IS_FIXED_WIDTH(face); 1723 *isFixedPitch = FT_IS_FIXED_WIDTH(face);
1714 } 1724 }
1715 1725
1716 FT_Done_Face(face); 1726 FT_Done_Face(face);
1717 FT_Done_FreeType(library); 1727 FT_Done_FreeType(library);
1718 return true; 1728 return true;
1719 } 1729 }
OLDNEW
« 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