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

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

Issue 66783003: Remove SK_FONTHOST_USES_FONTMGR. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontHost_none.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 <vector> 9 #include <vector>
10 #ifdef SK_BUILD_FOR_MAC 10 #ifdef SK_BUILD_FOR_MAC
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 size_t length, void* data) const SK_OVERRIDE; 460 size_t length, void* data) const SK_OVERRIDE;
461 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK _OVERRIDE; 461 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK _OVERRIDE;
462 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE; 462 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
463 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE ; 463 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE ;
464 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 464 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
465 SkAdvancedTypefaceMetrics::PerGlyphInfo, 465 SkAdvancedTypefaceMetrics::PerGlyphInfo,
466 const uint32_t*, uint32_t) const SK_OVERRIDE; 466 const uint32_t*, uint32_t) const SK_OVERRIDE;
467 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], 467 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[],
468 int glyphCount) const SK_OVERRIDE; 468 int glyphCount) const SK_OVERRIDE;
469 virtual int onCountGlyphs() const SK_OVERRIDE; 469 virtual int onCountGlyphs() const SK_OVERRIDE;
470 virtual SkTypeface* onRefMatchingStyle(Style) const SK_OVERRIDE;
471 470
472 private: 471 private:
473 472
474 typedef SkTypeface INHERITED; 473 typedef SkTypeface INHERITED;
475 }; 474 };
476 475
477 static SkTypeface* NewFromFontRef(CTFontRef fontRef, const char name[]) { 476 static SkTypeface* NewFromFontRef(CTFontRef fontRef, const char name[]) {
478 SkASSERT(fontRef); 477 SkASSERT(fontRef);
479 bool isFixedPitch; 478 bool isFixedPitch;
480 SkTypeface::Style style = computeStyleBits(fontRef, &isFixedPitch); 479 SkTypeface::Style style = computeStyleBits(fontRef, &isFixedPitch);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 if (face) { 625 if (face) {
627 SkTypefaceCache::Add(face, style); 626 SkTypefaceCache::Add(face, style);
628 } else { 627 } else {
629 face = GetDefaultFace(); 628 face = GetDefaultFace();
630 face->ref(); 629 face->ref();
631 } 630 }
632 } 631 }
633 return face; 632 return face;
634 } 633 }
635 634
636 SkTypeface* SkTypeface_Mac::onRefMatchingStyle(Style styleBits) const {
637 return create_typeface(this, NULL, styleBits);
638 }
639
640 /////////////////////////////////////////////////////////////////////////////// 635 ///////////////////////////////////////////////////////////////////////////////
641 636
642 /** GlyphRect is in FUnits (em space, y up). */ 637 /** GlyphRect is in FUnits (em space, y up). */
643 struct GlyphRect { 638 struct GlyphRect {
644 int16_t fMinX; 639 int16_t fMinX;
645 int16_t fMinY; 640 int16_t fMinY;
646 int16_t fMaxX; 641 int16_t fMaxX;
647 int16_t fMaxY; 642 int16_t fMaxY;
648 }; 643 };
649 644
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 } 2303 }
2309 2304
2310 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 2305 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
2311 unsigned styleBits) SK_OVERRIDE { 2306 unsigned styleBits) SK_OVERRIDE {
2312 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); 2307 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits);
2313 } 2308 }
2314 }; 2309 };
2315 2310
2316 /////////////////////////////////////////////////////////////////////////////// 2311 ///////////////////////////////////////////////////////////////////////////////
2317 2312
2318 #ifndef SK_FONTHOST_USES_FONTMGR
2319
2320 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
2321 const char familyName[],
2322 SkTypeface::Style style) {
2323 return create_typeface(familyFace, familyName, style);
2324 }
2325
2326 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
2327 AutoCFRelease<CGDataProviderRef> provider(SkCreateDataProviderFromStream(str eam));
2328 if (NULL == provider) {
2329 return NULL;
2330 }
2331 return create_from_dataProvider(provider);
2332 }
2333
2334 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
2335 AutoCFRelease<CGDataProviderRef> provider(CGDataProviderCreateWithFilename(p ath));
2336 if (NULL == provider) {
2337 return NULL;
2338 }
2339 return create_from_dataProvider(provider);
2340 }
2341
2342 #endif
2343
2344 SkFontMgr* SkFontMgr::Factory() { 2313 SkFontMgr* SkFontMgr::Factory() {
2345 return SkNEW(SkFontMgr_Mac); 2314 return SkNEW(SkFontMgr_Mac);
2346 } 2315 }
2347 #endif 2316 #endif
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontHost_none.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698