| OLD | NEW |
| 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 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 NameFontStyleRec rec; | 2100 NameFontStyleRec rec; |
| 2101 CFStringToSkString(cfFamilyName, &rec.fFamilyName); | 2101 CFStringToSkString(cfFamilyName, &rec.fFamilyName); |
| 2102 rec.fFontStyle = desc2fontstyle(desc); | 2102 rec.fFontStyle = desc2fontstyle(desc); |
| 2103 | 2103 |
| 2104 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(nameFontStyleProc, | 2104 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(nameFontStyleProc, |
| 2105 &rec); | 2105 &rec); |
| 2106 if (face) { | 2106 if (face) { |
| 2107 return face; | 2107 return face; |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 AutoCFRelease<CTFontRef> ctNamed(CTFontCreateWithName(cfFamilyName, 1, NULL)
); | 2110 AutoCFRelease<CFDictionaryRef> fontFamilyNameDictionary( |
| 2111 CFDictionaryCreate(kCFAllocatorDefault, |
| 2112 (const void**)&kCTFontFamilyNameAttribute, (const voi
d**)&cfFamilyName, |
| 2113 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionary
ValueCallBacks)); |
| 2114 AutoCFRelease<CTFontDescriptorRef> fontDescriptor( |
| 2115 CTFontDescriptorCreateWithAttributes(fontFamilyNameDictionary)); |
| 2116 AutoCFRelease<CTFontRef> ctNamed(CTFontCreateWithFontDescriptor(fontDescript
or, 0, NULL)); |
| 2111 CTFontRef ctFont = CTFontCreateCopyWithAttributes(ctNamed, 1, NULL, desc); | 2117 CTFontRef ctFont = CTFontCreateCopyWithAttributes(ctNamed, 1, NULL, desc); |
| 2112 if (NULL == ctFont) { | 2118 if (NULL == ctFont) { |
| 2113 return NULL; | 2119 return NULL; |
| 2114 } | 2120 } |
| 2115 | 2121 |
| 2116 SkString str; | 2122 SkString str; |
| 2117 CFStringToSkString(cfFamilyName, &str); | 2123 CFStringToSkString(cfFamilyName, &str); |
| 2118 | 2124 |
| 2119 bool isFixedPitch; | 2125 bool isFixedPitch; |
| 2120 (void)computeStyleBits(ctFont, &isFixedPitch); | 2126 (void)computeStyleBits(ctFont, &isFixedPitch); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); | 2313 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); |
| 2308 } | 2314 } |
| 2309 }; | 2315 }; |
| 2310 | 2316 |
| 2311 /////////////////////////////////////////////////////////////////////////////// | 2317 /////////////////////////////////////////////////////////////////////////////// |
| 2312 | 2318 |
| 2313 SkFontMgr* SkFontMgr::Factory() { | 2319 SkFontMgr* SkFontMgr::Factory() { |
| 2314 return SkNEW(SkFontMgr_Mac); | 2320 return SkNEW(SkFontMgr_Mac); |
| 2315 } | 2321 } |
| 2316 #endif | 2322 #endif |
| OLD | NEW |