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

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 1221903004: SkAdvancedTypefaceMetrics zeroing constructor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « src/fonts/SkTestScalerContext.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | 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 "SkTypes.h" // Keep this before any #ifdef ... 9 #include "SkTypes.h" // Keep this before any #ifdef ...
10 10
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 { 1552 {
1553 AutoCFRelease<CFStringRef> fontName(CTFontCopyPostScriptName(ctFont)); 1553 AutoCFRelease<CFStringRef> fontName(CTFontCopyPostScriptName(ctFont));
1554 if (fontName.get()) { 1554 if (fontName.get()) {
1555 CFStringToSkString(fontName, &info->fFontName); 1555 CFStringToSkString(fontName, &info->fFontName);
1556 } 1556 }
1557 } 1557 }
1558 1558
1559 CFIndex glyphCount = CTFontGetGlyphCount(ctFont); 1559 CFIndex glyphCount = CTFontGetGlyphCount(ctFont);
1560 info->fLastGlyphID = SkToU16(glyphCount - 1); 1560 info->fLastGlyphID = SkToU16(glyphCount - 1);
1561 info->fEmSize = CTFontGetUnitsPerEm(ctFont); 1561 info->fEmSize = CTFontGetUnitsPerEm(ctFont);
1562 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
1563 info->fStyle = 0;
1564 1562
1565 if (perGlyphInfo & kToUnicode_PerGlyphInfo) { 1563 if (perGlyphInfo & kToUnicode_PerGlyphInfo) {
1566 populate_glyph_to_unicode(ctFont, glyphCount, &info->fGlyphToUnicode); 1564 populate_glyph_to_unicode(ctFont, glyphCount, &info->fGlyphToUnicode);
1567 } 1565 }
1568 1566
1569 // If it's not a truetype font, mark it as 'other'. Assume that TrueType 1567 // If it's not a truetype font, mark it as 'other'. Assume that TrueType
1570 // fonts always have both glyf and loca tables. At the least, this is what 1568 // fonts always have both glyf and loca tables. At the least, this is what
1571 // sfntly needs to subset the font. CTFontCopyAttribute() does not always 1569 // sfntly needs to subset the font. CTFontCopyAttribute() does not always
1572 // succeed in determining this directly. 1570 // succeed in determining this directly.
1573 if (!this->getTableSize('glyf') || !this->getTableSize('loca')) { 1571 if (!this->getTableSize('glyf') || !this->getTableSize('loca')) {
1574 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
1575 info->fItalicAngle = 0;
1576 info->fAscent = 0;
1577 info->fDescent = 0;
1578 info->fStemV = 0;
1579 info->fCapHeight = 0;
1580 info->fBBox = SkIRect::MakeEmpty();
1581 return info; 1572 return info;
1582 } 1573 }
1583 1574
1584 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font; 1575 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
1585 CTFontSymbolicTraits symbolicTraits = CTFontGetSymbolicTraits(ctFont); 1576 CTFontSymbolicTraits symbolicTraits = CTFontGetSymbolicTraits(ctFont);
1586 if (symbolicTraits & kCTFontMonoSpaceTrait) { 1577 if (symbolicTraits & kCTFontMonoSpaceTrait) {
1587 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style; 1578 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style;
1588 } 1579 }
1589 if (symbolicTraits & kCTFontItalicTrait) { 1580 if (symbolicTraits & kCTFontItalicTrait) {
1590 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style; 1581 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 } 2461 }
2471 return face; 2462 return face;
2472 } 2463 }
2473 }; 2464 };
2474 2465
2475 /////////////////////////////////////////////////////////////////////////////// 2466 ///////////////////////////////////////////////////////////////////////////////
2476 2467
2477 SkFontMgr* SkFontMgr::Factory() { 2468 SkFontMgr* SkFontMgr::Factory() {
2478 return SkNEW(SkFontMgr_Mac); 2469 return SkNEW(SkFontMgr_Mac);
2479 } 2470 }
OLDNEW
« no previous file with comments | « src/fonts/SkTestScalerContext.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698