OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
9 #include "SkFontMgr.h" | 9 #include "SkFontMgr.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 static void test_matchStyleCSS3(skiatest::Reporter* reporter) { | 119 static void test_matchStyleCSS3(skiatest::Reporter* reporter) { |
120 static const SkFontID invalidFontID = std::numeric_limits<SkFontID>::max(); | 120 static const SkFontID invalidFontID = std::numeric_limits<SkFontID>::max(); |
121 static const SkFontStyle invalidFontStyle(101, SkFontStyle::kNormal_Width, S
kFontStyle::kUpright_Slant); | 121 static const SkFontStyle invalidFontStyle(101, SkFontStyle::kNormal_Width, S
kFontStyle::kUpright_Slant); |
122 | 122 |
123 class TestTypeface : public SkTypeface { | 123 class TestTypeface : public SkTypeface { |
124 public: | 124 public: |
125 TestTypeface(const SkFontStyle& fontStyle, SkFontID id) : SkTypeface(fon
tStyle, id, false){} | 125 TestTypeface(const SkFontStyle& fontStyle, SkFontID id) : SkTypeface(fon
tStyle, id, false){} |
126 protected: | 126 protected: |
127 SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullp
tr; } | 127 SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullp
tr; } |
128 SkScalerContext* onCreateScalerContext(const SkDescriptor*) const overri
de { | 128 SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, |
| 129 const SkDescriptor*) const overri
de { |
129 return nullptr; | 130 return nullptr; |
130 } | 131 } |
131 void onFilterRec(SkScalerContextRec*) const override { } | 132 void onFilterRec(SkScalerContextRec*) const override { } |
132 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( | 133 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( |
133 PerGlyphInfo, | 134 PerGlyphInfo, |
134 const uint32_t*, uint32_t) const override { return nullptr; } | 135 const uint32_t*, uint32_t) const override { return nullptr; } |
135 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override { } | 136 void onGetFontDescriptor(SkFontDescriptor*, bool*) const override { } |
136 virtual int onCharsToGlyphs(const void* chars, Encoding encoding, | 137 virtual int onCharsToGlyphs(const void* chars, Encoding encoding, |
137 uint16_t glyphs[], int glyphCount) const override { | 138 uint16_t glyphs[], int glyphCount) const override { |
138 if (glyphs && glyphCount > 0) { | 139 if (glyphs && glyphCount > 0) { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 641 } |
641 | 642 |
642 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); | 643 DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); |
643 | 644 |
644 DEF_TEST(FontMgr, reporter) { | 645 DEF_TEST(FontMgr, reporter) { |
645 test_matchStyleCSS3(reporter); | 646 test_matchStyleCSS3(reporter); |
646 test_fontiter(reporter, FLAGS_verboseFontMgr); | 647 test_fontiter(reporter, FLAGS_verboseFontMgr); |
647 test_alias_names(reporter); | 648 test_alias_names(reporter); |
648 test_font(reporter); | 649 test_font(reporter); |
649 } | 650 } |
OLD | NEW |