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 CTFontDescriptorRef descriptor = CTFontDescriptorCreateWithAttributes( |
bungeman-skia
2013/12/09 15:46:12
This create, I'm fairly certain, needs to be unref
| |
2111 CFDictionaryCreate(kCFAllocatorDefault, | |
2112 (const void**)&kCTFontFamilyNameAttribute, (const voi d**)&cfFamilyName, | |
2113 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionar yValueCallBacks)); | |
2114 AutoCFRelease<CTFontRef> ctNamed(CTFontCreateWithFontDescriptor(descriptor, 0, NULL)); | |
2111 CTFontRef ctFont = CTFontCreateCopyWithAttributes(ctNamed, 1, NULL, desc); | 2115 CTFontRef ctFont = CTFontCreateCopyWithAttributes(ctNamed, 1, NULL, desc); |
2112 if (NULL == ctFont) { | 2116 if (NULL == ctFont) { |
2113 return NULL; | 2117 return NULL; |
2114 } | 2118 } |
2115 | 2119 |
2116 SkString str; | 2120 SkString str; |
2117 CFStringToSkString(cfFamilyName, &str); | 2121 CFStringToSkString(cfFamilyName, &str); |
2118 | 2122 |
2119 bool isFixedPitch; | 2123 bool isFixedPitch; |
2120 (void)computeStyleBits(ctFont, &isFixedPitch); | 2124 (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); | 2311 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); |
2308 } | 2312 } |
2309 }; | 2313 }; |
2310 | 2314 |
2311 /////////////////////////////////////////////////////////////////////////////// | 2315 /////////////////////////////////////////////////////////////////////////////// |
2312 | 2316 |
2313 SkFontMgr* SkFontMgr::Factory() { | 2317 SkFontMgr* SkFontMgr::Factory() { |
2314 return SkNEW(SkFontMgr_Mac); | 2318 return SkNEW(SkFontMgr_Mac); |
2315 } | 2319 } |
2316 #endif | 2320 #endif |
OLD | NEW |