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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 const int ttcIndex = fontData->getIndex(); | 875 const int ttcIndex = fontData->getIndex(); |
876 SkFontStyle style; | 876 SkFontStyle style; |
877 bool isFixedWidth = false; | 877 bool isFixedWidth = false; |
878 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth,
nullptr)) { | 878 if (!fScanner.scanFont(stream, ttcIndex, nullptr, &style, &isFixedWidth,
nullptr)) { |
879 return nullptr; | 879 return nullptr; |
880 } | 880 } |
881 | 881 |
882 return new SkTypeface_stream(fontData, style, isFixedWidth); | 882 return new SkTypeface_stream(fontData, style, isFixedWidth); |
883 } | 883 } |
884 | 884 |
885 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 885 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE |
886 unsigned styleBits) const overrid
e { | 886 SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBi
ts) const override { |
887 bool bold = styleBits & SkTypeface::kBold; | 887 SkFontStyle style = SkFontStyle::FromOldStyle(styleBits); |
888 bool italic = styleBits & SkTypeface::kItalic; | 888 #else |
889 SkFontStyle style = SkFontStyle(bold ? SkFontStyle::kBold_Weight | 889 SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle styl
e) const override { |
890 : SkFontStyle::kNormal_Weight, | 890 #endif |
891 SkFontStyle::kNormal_Width, | |
892 italic ? SkFontStyle::kItalic_Slant | |
893 : SkFontStyle::kUpright_Slant); | |
894 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty
le)); | 891 SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, sty
le)); |
895 if (typeface.get()) { | 892 if (typeface.get()) { |
896 return typeface.release(); | 893 return typeface.release(); |
897 } | 894 } |
898 | 895 |
899 return this->matchFamilyStyle(nullptr, style); | 896 return this->matchFamilyStyle(nullptr, style); |
900 } | 897 } |
901 }; | 898 }; |
902 | 899 |
903 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 900 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
904 return new SkFontMgr_fontconfig(fc); | 901 return new SkFontMgr_fontconfig(fc); |
905 } | 902 } |
OLD | NEW |