Chromium Code Reviews| Index: src/ports/SkFontHost_mac.cpp |
| diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp |
| index 4e573541ca2780b2a9383a9e471a1cb294317e58..2dea5d0802c14dd17eeaa94db58f83d9a1a1d46a 100755 |
| --- a/src/ports/SkFontHost_mac.cpp |
| +++ b/src/ports/SkFontHost_mac.cpp |
| @@ -575,7 +575,14 @@ SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef fontRef) { |
| if (face) { |
| face->ref(); |
| } else { |
| - face = NewFromFontRef(fontRef, NULL, false); |
| + bool isLocal = false; |
| + AutoCFRelease<CTFontDescriptorRef> fontDescriptor(CTFontCopyFontDescriptor(fontRef)); |
| + AutoCFRelease<CFTypeRef> priority(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontPriorityAttribute)); |
|
reed1
2014/10/29 15:36:33
nit: 100cols
|
| + if (CFGetTypeID(priority) == CFNumberGetTypeID()) { |
| + uint32_t priorityValue; |
| + isLocal = CFNumberGetValue(reinterpret_cast<CFNumberRef>(priority.get()), kCFNumberSInt32Type, &priorityValue) && priorityValue >= kCTFontPriorityProcess; |
| + } |
| + face = NewFromFontRef(fontRef, NULL, isLocal); |
| SkTypefaceCache::Add(face, face->fontStyle()); |
| // NewFromFontRef doesn't retain the parameter, but the typeface it |
| // creates does release it in its destructor, so we balance that with |