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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 12807004: move impl of AdvancedTypefaceMetrics into typeface (3) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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
Index: src/ports/SkFontHost_mac.cpp
===================================================================
--- src/ports/SkFontHost_mac.cpp (revision 8262)
+++ src/ports/SkFontHost_mac.cpp (working copy)
@@ -418,7 +418,10 @@
virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK_OVERRIDE;
virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
virtual void onGetFontDescriptor(SkFontDescriptor*) const SK_OVERRIDE;
-
+ virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
+ SkAdvancedTypefaceMetrics::PerGlyphInfo,
+ const uint32_t*, uint32_t) const SK_OVERRIDE;
+
private:
typedef SkTypeface INHERITED;
};
@@ -657,7 +660,7 @@
, fFBoundingBoxesGlyphOffset(0)
, fGeneratedFBoundingBoxes(false)
{
- CTFontRef ctFont = GetFontRefFromFontID(fRec.fFontID);
+ CTFontRef ctFont = typeface->fFontRef.get();
CFIndex numGlyphs = CTFontGetGlyphCount(ctFont);
// Get the state we need
@@ -1472,13 +1475,12 @@
dst->resize(strlen(dst->c_str()));
}
-// static
-SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
- uint32_t fontID,
+SkAdvancedTypefaceMetrics* SkTypeface_Mac::onGetAdvancedTypefaceMetrics(
SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo,
const uint32_t* glyphIDs,
- uint32_t glyphIDsCount) {
- CTFontRef originalCTFont = GetFontRefFromFontID(fontID);
+ uint32_t glyphIDsCount) const {
+
+ CTFontRef originalCTFont = fFontRef.get();
AutoCFRelease<CTFontRef> ctFont(CTFontCreateCopyWithAttributes(
originalCTFont, CTFontGetUnitsPerEm(originalCTFont), NULL, NULL));
SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
@@ -1503,7 +1505,7 @@
// fonts always have both glyf and loca tables. At the least, this is what
// sfntly needs to subset the font. CTFontCopyAttribute() does not always
// succeed in determining this directly.
- if (!GetTableSize(fontID, 'glyf') || !GetTableSize(fontID, 'loca')) {
+ if (!this->getTableSize('glyf') || !this->getTableSize('loca')) {
info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
info->fItalicAngle = 0;
info->fAscent = 0;

Powered by Google App Engine
This is Rietveld 408576698