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

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

Issue 1115073002: Check for NULL familyName in SkFontMgr_fontconfig. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFontDescriptor.h" 9 #include "SkFontDescriptor.h"
10 #include "SkFontHost_FreeType_common.h" 10 #include "SkFontHost_FreeType_common.h"
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 764
765 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], 765 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[],
766 const SkFontStyle& style, 766 const SkFontStyle& style,
767 const char* bcp47[], 767 const char* bcp47[],
768 int bcp47Count, 768 int bcp47Count,
769 SkUnichar character) const o verride 769 SkUnichar character) const o verride
770 { 770 {
771 FCLocker lock; 771 FCLocker lock;
772 772
773 SkAutoFcPattern pattern; 773 SkAutoFcPattern pattern;
774 FcValue familyNameValue; 774 if (familyName) {
775 familyNameValue.type = FcTypeString; 775 FcValue familyNameValue;
776 familyNameValue.u.s = reinterpret_cast<const FcChar8*>(familyName); 776 familyNameValue.type = FcTypeString;
777 FcPatternAddWeak(pattern, FC_FAMILY, familyNameValue, FcFalse); 777 familyNameValue.u.s = reinterpret_cast<const FcChar8*>(familyName);
778 FcPatternAddWeak(pattern, FC_FAMILY, familyNameValue, FcFalse);
779 }
778 fcpattern_from_skfontstyle(style, pattern); 780 fcpattern_from_skfontstyle(style, pattern);
779 781
780 SkAutoFcCharSet charSet; 782 SkAutoFcCharSet charSet;
781 FcCharSetAddChar(charSet, character); 783 FcCharSetAddChar(charSet, character);
782 FcPatternAddCharSet(pattern, FC_CHARSET, charSet); 784 FcPatternAddCharSet(pattern, FC_CHARSET, charSet);
783 785
784 if (bcp47Count > 0) { 786 if (bcp47Count > 0) {
785 SkASSERT(bcp47); 787 SkASSERT(bcp47);
786 SkAutoFcLangSet langSet; 788 SkAutoFcLangSet langSet;
787 for (int i = bcp47Count; i --> 0;) { 789 for (int i = bcp47Count; i --> 0;) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 return typeface.detach(); 852 return typeface.detach();
851 } 853 }
852 854
853 return this->matchFamilyStyle(NULL, style); 855 return this->matchFamilyStyle(NULL, style);
854 } 856 }
855 }; 857 };
856 858
857 SkFontMgr* SkFontMgr::Factory() { 859 SkFontMgr* SkFontMgr::Factory() {
858 return SkNEW(SkFontMgr_fontconfig); 860 return SkNEW(SkFontMgr_fontconfig);
859 } 861 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698