2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 // running create_test_font_color generates ./<cbdt|sbix|cpal>.ttx
9 // which are read by fonttools ttx to produce native fonts.
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkStream.h"
13 #include "include/core/SkString.h"
14 #include "tools/flags/CommandLineFlags.h"
15 #include "tools/fonts/TestSVGTypeface.h"
17 #if defined(SK_ENABLE_SVG)
19 static 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);
28 SkFILEWStream sbix((SkString(prefix) += "sbix.ttx").c_str());
29 typeface->exportTtxSbix(&sbix, sbixStrikeSizes);
33 SkFILEWStream colr((SkString(prefix) += "colr.ttx").c_str());
34 typeface->exportTtxColr(&colr);
39 int main(int argc, char** argv) {
40 CommandLineFlags::Parse(argc, argv);
42 // Most of the time use these sizes.
43 unsigned usual[] = { 16, 64, 128 };
45 // But the planet font cannot get very big in the size limited cbdt format.
46 unsigned small[] = { 8, 16 };
48 export_ttx(TestSVGTypeface::Default(), SkString(), SkMakeSpan(usual), SkMakeSpan(usual));
50 TestSVGTypeface::Planets(), SkString("planet"), SkMakeSpan(small), SkMakeSpan(usual));
57 int main(int argc, char** argv) {
58 SkDebugf("compile with SVG enabled\n");
62 #endif // SK_ENABLE_SVG