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

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 574873002: Add onGetFamilyName to SkTypeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add .get() for DirectWrite. Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 SkString fName; 446 SkString fName;
447 AutoCFRelease<CTFontRef> fFontRef; 447 AutoCFRelease<CTFontRef> fFontRef;
448 SkFontStyle fFontStyle; 448 SkFontStyle fFontStyle;
449 449
450 protected: 450 protected:
451 friend class SkFontHost; // to access our protected members for deprecate d methods 451 friend class SkFontHost; // to access our protected members for deprecate d methods
452 452
453 virtual int onGetUPEM() const SK_OVERRIDE; 453 virtual int onGetUPEM() const SK_OVERRIDE;
454 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE; 454 virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE;
455 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE;
455 virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_ OVERRIDE; 456 virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_ OVERRIDE;
456 virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE; 457 virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE;
457 virtual size_t onGetTableData(SkFontTableTag, size_t offset, 458 virtual size_t onGetTableData(SkFontTableTag, size_t offset,
458 size_t length, void* data) const SK_OVERRIDE; 459 size_t length, void* data) const SK_OVERRIDE;
459 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK _OVERRIDE; 460 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK _OVERRIDE;
460 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE; 461 virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
461 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE ; 462 virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE ;
462 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 463 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
463 SkAdvancedTypefaceMetrics::PerGlyphInfo, 464 SkAdvancedTypefaceMetrics::PerGlyphInfo,
464 const uint32_t*, uint32_t) const SK_OVERRIDE; 465 const uint32_t*, uint32_t) const SK_OVERRIDE;
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 // we take ownership of the ref 1894 // we take ownership of the ref
1894 static const char* get_str(CFStringRef ref, SkString* str) { 1895 static const char* get_str(CFStringRef ref, SkString* str) {
1895 if (NULL == ref) { 1896 if (NULL == ref) {
1896 return NULL; 1897 return NULL;
1897 } 1898 }
1898 CFStringToSkString(ref, str); 1899 CFStringToSkString(ref, str);
1899 CFSafeRelease(ref); 1900 CFSafeRelease(ref);
1900 return str->c_str(); 1901 return str->c_str();
1901 } 1902 }
1902 1903
1904 void SkTypeface_Mac::onGetFamilyName(SkString* familyName) const {
1905 get_str(CTFontCopyFamilyName(fFontRef), familyName);
1906 }
1907
1903 void SkTypeface_Mac::onGetFontDescriptor(SkFontDescriptor* desc, 1908 void SkTypeface_Mac::onGetFontDescriptor(SkFontDescriptor* desc,
1904 bool* isLocalStream) const { 1909 bool* isLocalStream) const {
1905 SkString tmpStr; 1910 SkString tmpStr;
1906 1911
1907 desc->setFamilyName(get_str(CTFontCopyFamilyName(fFontRef), &tmpStr)); 1912 desc->setFamilyName(get_str(CTFontCopyFamilyName(fFontRef), &tmpStr));
1908 desc->setFullName(get_str(CTFontCopyFullName(fFontRef), &tmpStr)); 1913 desc->setFullName(get_str(CTFontCopyFullName(fFontRef), &tmpStr));
1909 desc->setPostscriptName(get_str(CTFontCopyPostScriptName(fFontRef), &tmpStr) ); 1914 desc->setPostscriptName(get_str(CTFontCopyPostScriptName(fFontRef), &tmpStr) );
1910 *isLocalStream = fIsLocalStream; 1915 *isLocalStream = fIsLocalStream;
1911 } 1916 }
1912 1917
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); 2309 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits);
2305 } 2310 }
2306 }; 2311 };
2307 2312
2308 /////////////////////////////////////////////////////////////////////////////// 2313 ///////////////////////////////////////////////////////////////////////////////
2309 2314
2310 SkFontMgr* SkFontMgr::Factory() { 2315 SkFontMgr* SkFontMgr::Factory() {
2311 return SkNEW(SkFontMgr_Mac); 2316 return SkNEW(SkFontMgr_Mac);
2312 } 2317 }
2313 #endif 2318 #endif
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698