Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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,
20 SkString prefix,
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) {
40 CommandLineFlags::Parse(argc, 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(
50 TestSVGTypeface::Planets(), SkString("planet"), SkSpan(small), SkSpan(usual));
51
52 return 0;
53}
54
55#else
56
57int main(int argc, char** argv) {
58 SkDebugf("compile with SVG enabled\n");
59 return 1;
60}
61
62#endif // SK_ENABLE_SVG
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void Parse(int argc, const char *const *argv)
Definition main.py:1