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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 canvas->drawTextBlob(blob, 0, 0, paint); | 32 canvas->drawTextBlob(blob, 0, 0, paint); |
33 canvas->restore(); | 33 canvas->restore(); |
34 } | 34 } |
35 | 35 |
36 class MixedTextBlobsGM : public GM { | 36 class MixedTextBlobsGM : public GM { |
37 public: | 37 public: |
38 MixedTextBlobsGM() { } | 38 MixedTextBlobsGM() { } |
39 | 39 |
40 protected: | 40 protected: |
41 void onOnceBeforeDraw() override { | 41 void onOnceBeforeDraw() override { |
42 SkAutoTDelete<SkFILEStream> stream; | |
43 SkString filename; | |
44 #ifndef SK_BUILD_FOR_MAC | 42 #ifndef SK_BUILD_FOR_MAC |
45 filename = GetResourcePath("/Funkster.ttf"); | 43 fEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf")); |
46 stream.reset(new SkFILEStream(filename.c_str())); | |
47 if (stream->isValid()) { | |
48 fEmojiTypeface.reset(SkTypeface::CreateFromStream(stream.detach())); | |
49 } else { | |
50 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); | |
51 } | |
52 fEmojiText = "Emoji!!!"; | 44 fEmojiText = "Emoji!!!"; |
53 #else | 45 #else |
54 fEmojiTypeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT
ypeface::kNormal)); | 46 fEmojiTypeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT
ypeface::kNormal)); |
55 fEmojiText = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" //
💰🏡🎅 | 47 fEmojiText = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" //
💰🏡🎅 |
56 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80"; /
/ 🍪🍕🚀 | 48 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80"; /
/ 🍪🍕🚀 |
57 #endif | 49 #endif |
58 | 50 fReallyBigATypeface.reset(GetResourceAsTypeface("/fonts/ReallyBigA.ttf")
); |
59 filename = GetResourcePath("/ReallyBigA.ttf"); | |
60 | |
61 stream.reset(new SkFILEStream(filename.c_str())); | |
62 if (stream->isValid()) { | |
63 fReallyBigATypeface.reset(SkTypeface::CreateFromStream(stream.detach
())); | |
64 } | |
65 | 51 |
66 SkTextBlobBuilder builder; | 52 SkTextBlobBuilder builder; |
67 | 53 |
68 // make textblob | 54 // make textblob |
69 // Text so large we draw as paths | 55 // Text so large we draw as paths |
70 SkPaint paint; | 56 SkPaint paint; |
71 paint.setTextSize(384); | 57 paint.setTextSize(384); |
72 const char* text = "O"; | 58 const char* text = "O"; |
73 sk_tool_utils::set_portable_typeface(&paint); | 59 sk_tool_utils::set_portable_typeface(&paint); |
74 | 60 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 static const int kWidth = 1250; | 158 static const int kWidth = 1250; |
173 static const int kHeight = 700; | 159 static const int kHeight = 700; |
174 | 160 |
175 typedef GM INHERITED; | 161 typedef GM INHERITED; |
176 }; | 162 }; |
177 | 163 |
178 ////////////////////////////////////////////////////////////////////////////// | 164 ////////////////////////////////////////////////////////////////////////////// |
179 | 165 |
180 DEF_GM( return SkNEW(MixedTextBlobsGM); ) | 166 DEF_GM( return SkNEW(MixedTextBlobsGM); ) |
181 } | 167 } |
OLD | NEW |