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 "SkFixed.h" | 9 #include "SkFixed.h" |
10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 const int ttcIndex = fontData->getIndex(); | 867 const int ttcIndex = fontData->getIndex(); |
868 SkFontStyle style; | 868 SkFontStyle style; |
869 bool isFixedWidth = false; | 869 bool isFixedWidth = false; |
870 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth,
nullptr)) { | 870 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth,
nullptr)) { |
871 return nullptr; | 871 return nullptr; |
872 } | 872 } |
873 | 873 |
874 return new SkTypeface_stream(fontData, style, isFixedWidth); | 874 return new SkTypeface_stream(fontData, style, isFixedWidth); |
875 } | 875 } |
876 | 876 |
877 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE | |
878 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { | |
879 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); | |
880 #else | |
881 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { | 877 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
882 #endif | |
883 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty
le)); | 878 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty
le)); |
884 if (typeface.get()) { | 879 if (typeface.get()) { |
885 return typeface.release(); | 880 return typeface.release(); |
886 } | 881 } |
887 | 882 |
888 return this->matchFamilyStyle(nullptr, style); | 883 return this->matchFamilyStyle(nullptr, style); |
889 } | 884 } |
890 }; | 885 }; |
891 | 886 |
892 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 887 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
893 return new SkFontMgr_fontconfig(fc); | 888 return new SkFontMgr_fontconfig(fc); |
894 } | 889 } |
OLD | NEW |