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

Unified Diff: src/ports/SkFontHost_mac.cpp

Issue 692553002: Add a flag indicating locally-created fonts to SkCreateTypefaceFromCTFont (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | tests/SerializationTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698