Flutter Engine
The Flutter Engine
create_test_font_color.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8// running create_test_font_color generates ./<cbdt|sbix|cpal>.ttx
9// which are read by fonttools ttx to produce native fonts.
10
16
17#if defined(SK_ENABLE_SVG)
18
19static void export_ttx(sk_sp<TestSVGTypeface> typeface,
21 SkSpan<unsigned> cbdtStrikeSizes,
22 SkSpan<unsigned> sbixStrikeSizes) {
23 SkFILEWStream cbdt((SkString(prefix) += "cbdt.ttx").c_str());
24 typeface->exportTtxCbdt(&cbdt, cbdtStrikeSizes);
25 cbdt.flush();
26 cbdt.fsync();
27
28 SkFILEWStream sbix((SkString(prefix) += "sbix.ttx").c_str());
29 typeface->exportTtxSbix(&sbix, sbixStrikeSizes);
30 sbix.flush();
31 sbix.fsync();
32
33 SkFILEWStream colr((SkString(prefix) += "colr.ttx").c_str());
34 typeface->exportTtxColr(&colr);
35 colr.flush();
36 colr.fsync();
37}
38
39int main(int argc, char** argv) {
41
42 // Most of the time use these sizes.
43 unsigned usual[] = { 16, 64, 128 };
44
45 // But the planet font cannot get very big in the size limited cbdt format.
46 unsigned small[] = { 8, 16 };
47
48 export_ttx(TestSVGTypeface::Default(), SkString(), SkSpan(usual), SkSpan(usual));
49 export_ttx(TestSVGTypeface::Planets(), SkString("planet"), SkSpan(small), SkSpan(usual));
50
51 return 0;
52}
53
54#else
55
56int main(int argc, char** argv) {
57 SkDebugf("compile with SVG enabled\n");
58 return 1;
59}
60
61#endif // SK_ENABLE_SVG
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
static void Parse(int argc, const char *const *argv)
int main(int argc, char **argv)
char ** argv
Definition: library.h:9