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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class ColorEmojiGM : public GM { | 47 class ColorEmojiGM : public GM { |
48 public: | 48 public: |
49 ColorEmojiGM() : fCBDT_CBLC_Typeface(NULL), fSBIX_Typeface(NULL) { } | 49 ColorEmojiGM() : fCBDT_CBLC_Typeface(NULL), fSBIX_Typeface(NULL) { } |
50 | 50 |
51 protected: | 51 protected: |
52 struct EmojiFont { | 52 struct EmojiFont { |
53 SkTypeface* typeface; | 53 SkTypeface* typeface; |
54 const char* text; | 54 const char* text; |
55 } emojiFonts[2]; | 55 } emojiFonts[2]; |
56 virtual void onOnceBeforeDraw() override { | 56 virtual void onOnceBeforeDraw() override { |
57 SkString filename = GetResourcePath("/Funkster.ttf"); | 57 fCBDT_CBLC_Typeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf")); |
58 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str())); | 58 emojiFonts[0].typeface = fCBDT_CBLC_Typeface; |
59 if (stream->isValid()) { | |
60 fCBDT_CBLC_Typeface.reset(SkTypeface::CreateFromStream(stream.detach
())); | |
61 emojiFonts[0].typeface = fCBDT_CBLC_Typeface; | |
62 } else { | |
63 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); | |
64 emojiFonts[0].typeface = NULL; | |
65 } | |
66 emojiFonts[0].text = "hamburgerfons"; | 59 emojiFonts[0].text = "hamburgerfons"; |
67 | 60 |
68 fSBIX_Typeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT
ypeface::kNormal)); | 61 fSBIX_Typeface.reset(SkTypeface::CreateFromName("Apple Color Emoji", SkT
ypeface::kNormal)); |
69 emojiFonts[1].typeface = fSBIX_Typeface; | 62 emojiFonts[1].typeface = fSBIX_Typeface; |
70 emojiFonts[1].text = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E
\x85" // π°π‘π
| 63 emojiFonts[1].text = "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E
\x85" // π°π‘π
|
71 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A
\x80" // πͺππ | 64 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A
\x80" // πͺππ |
72 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93
\xB7" // π»π©π· | 65 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93
\xB7" // π»π©π· |
73 "\xF0\x9F\x93\xA6" // π¦ | 66 "\xF0\x9F\x93\xA6" // π¦ |
74 "\xF0\x9F\x87\xBA" "\xF0\x9F\x87\xB8" "\xF0\x9F\x87
\xA6"; // πΊπΈπ¦ | 67 "\xF0\x9F\x87\xBA" "\xF0\x9F\x87\xB8" "\xF0\x9F\x87
\xA6"; // πΊπΈπ¦ |
75 } | 68 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 170 |
178 typedef GM INHERITED; | 171 typedef GM INHERITED; |
179 }; | 172 }; |
180 | 173 |
181 ////////////////////////////////////////////////////////////////////////////// | 174 ////////////////////////////////////////////////////////////////////////////// |
182 | 175 |
183 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 176 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
184 static GMRegistry reg(MyFactory); | 177 static GMRegistry reg(MyFactory); |
185 | 178 |
186 } | 179 } |
OLD | NEW |