OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |