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

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

Issue 951723003: Provide Mac 10.6 SDK support for kCTFontColorGlyphsTrait. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 #ifdef SK_BUILD_FOR_MAC 9 #ifdef SK_BUILD_FOR_MAC
10 #import <ApplicationServices/ApplicationServices.h> 10 #import <ApplicationServices/ApplicationServices.h>
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // well-formed fonts have checksums, but as a last resort, use the pointer. 429 // well-formed fonts have checksums, but as a last resort, use the pointer.
430 if (id == 0) { 430 if (id == 0) {
431 id = (SkFontID) (uintptr_t) fontRef; 431 id = (SkFontID) (uintptr_t) fontRef;
432 id = (id & 0x3FFFFFFF) | 0x80000000; // make top two bits 10 432 id = (id & 0x3FFFFFFF) | 0x80000000; // make top two bits 10
433 } 433 }
434 return id; 434 return id;
435 } 435 }
436 436
437 #define WEIGHT_THRESHOLD ((SkFontStyle::kNormal_Weight + SkFontStyle::kBold_W eight)/2) 437 #define WEIGHT_THRESHOLD ((SkFontStyle::kNormal_Weight + SkFontStyle::kBold_W eight)/2)
438 438
439 // kCTFontColorGlyphsTrait was added in the Mac 10.7 and iPhone 4.3 SDKs.
440 // Being an enum value it is not guarded by version macros, but old SDKs must st ill be supported.
441 #if defined(__MAC_10_7) || defined(__IPHONE_4_3)
442 static const uint32_t SkCTFontColorGlyphsTrait = kCTFontColorGlyphsTrait;
443 #else
444 static const uint32_t SkCTFontColorGlyphsTrait = (1 << 13);
445 #endif
446
439 class SkTypeface_Mac : public SkTypeface { 447 class SkTypeface_Mac : public SkTypeface {
440 public: 448 public:
441 SkTypeface_Mac(const SkFontStyle& fs, SkFontID fontID, bool isFixedPitch, 449 SkTypeface_Mac(const SkFontStyle& fs, SkFontID fontID, bool isFixedPitch,
442 CTFontRef fontRef, const char requestedName[], bool isLocalSt ream) 450 CTFontRef fontRef, const char requestedName[], bool isLocalSt ream)
443 : SkTypeface(fs, fontID, isFixedPitch) 451 : SkTypeface(fs, fontID, isFixedPitch)
444 , fRequestedName(requestedName) 452 , fRequestedName(requestedName)
445 , fFontRef(fontRef) // caller has already called CFRetain for us 453 , fFontRef(fontRef) // caller has already called CFRetain for us
446 , fIsLocalStream(isLocalStream) 454 , fIsLocalStream(isLocalStream)
447 , fHasColorGlyphs(CTFontGetSymbolicTraits(fFontRef) & kCTFontColorGlyphs Trait) 455 , fHasColorGlyphs(CTFontGetSymbolicTraits(fFontRef) & SkCTFontColorGlyph sTrait)
448 { 456 {
449 SkASSERT(fontRef); 457 SkASSERT(fontRef);
450 } 458 }
451 459
452 SkString fRequestedName; 460 SkString fRequestedName;
453 AutoCFRelease<CTFontRef> fFontRef; 461 AutoCFRelease<CTFontRef> fFontRef;
454 462
455 protected: 463 protected:
456 int onGetUPEM() const SK_OVERRIDE; 464 int onGetUPEM() const SK_OVERRIDE;
457 SkStreamAsset* onOpenStream(int* ttcIndex) const SK_OVERRIDE; 465 SkStreamAsset* onOpenStream(int* ttcIndex) const SK_OVERRIDE;
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 } 2280 }
2273 return face; 2281 return face;
2274 } 2282 }
2275 }; 2283 };
2276 2284
2277 /////////////////////////////////////////////////////////////////////////////// 2285 ///////////////////////////////////////////////////////////////////////////////
2278 2286
2279 SkFontMgr* SkFontMgr::Factory() { 2287 SkFontMgr* SkFontMgr::Factory() {
2280 return SkNEW(SkFontMgr_Mac); 2288 return SkNEW(SkFontMgr_Mac);
2281 } 2289 }
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