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..c830c388eedf55563a344b58c9797a513b841487 100755 |
| --- a/src/ports/SkFontHost_mac.cpp |
| +++ b/src/ports/SkFontHost_mac.cpp |
| @@ -575,7 +575,17 @@ 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)); |
| + if (CFGetTypeID(priority) == CFNumberGetTypeID()) { |
|
bungeman-skia
2014/10/29 17:40:55
According to the documentation, the request for kC
|
| + CFNumberRef priorityNumber = reinterpret_cast<CFNumberRef>(priority.get()); |
|
bungeman-skia
2014/10/29 17:40:55
I believe this can be a static_cast .
|
| + uint32_t priorityValue; |
| + if (CFNumberGetValue(priorityNumber, kCFNumberSInt32Type, &priorityValue)) |
| + isLocal = 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 |