Flutter Engine
The Flutter Engine
Functions
PreshapeTool.cpp File Reference
#include "include/core/SkData.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkGraphics.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkFeatures.h"
#include "modules/skottie/utils/TextPreshape.h"
#include "modules/skresources/include/SkResources.h"
#include "modules/skshaper/utils/FactoryHelpers.h"
#include "tools/flags/CommandLineFlags.h"
#include "include/ports/SkFontMgr_empty.h"

Go to the source code of this file.

Functions

static DEFINE_string2 (input, i, nullptr, "Input .json file.")
 
static DEFINE_string2 (output, o, nullptr, "Output .json file.")
 
int main (int argc, char **argv)
 

Function Documentation

◆ DEFINE_string2() [1/2]

static DEFINE_string2 ( input  ,
i  ,
nullptr  ,
"Input .json file."   
)
static

◆ DEFINE_string2() [2/2]

static DEFINE_string2 ( output  ,
,
nullptr  ,
"Output .json file."   
)
static

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 34 of file PreshapeTool.cpp.

34 {
37
38 if (FLAGS_input.isEmpty() || FLAGS_output.isEmpty()) {
39 SkDebugf("Missing required 'input' and 'output' args.\n");
40 return 1;
41 }
42
43 const auto data = SkData::MakeFromFileName(FLAGS_input[0]);
44 if (!data) {
45 SkDebugf("Could not read file: %s\n", FLAGS_input[0]);
46 return 1;
47 }
48
49 SkFILEWStream out(FLAGS_output[0]);
50 if (!out.isValid()) {
51 SkDebugf("Could not write file: %s\n", FLAGS_output[0]);
52 return 1;
53 }
54
55#if defined(SK_BUILD_FOR_MAC) && defined(SK_FONTMGR_CORETEXT_AVAILABLE)
57#elif defined(SK_BUILD_FOR_ANDROID) && defined(SK_FONTMGR_ANDROID_AVAILABLE)
58 sk_sp<SkFontMgr> fontMgr = SkFontMgr_New_Android(nullptr, std::make_unique<SkFontScanner_FreeType>());
59#elif defined(SK_BUILD_FOR_UNIX) && defined(SK_FONTMGR_FONTCONFIG_AVAILABLE)
61#else
63#endif
64
66 SkDebugf("Could not preshape: %s\n", FLAGS_input[0]);
67 return -1;
68 }
69
70 return 0;
71 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts *custom)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
SK_API sk_sp< SkFontMgr > SkFontMgr_New_FontConfig(FcConfig *fc)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_CoreText(CTFontCollectionRef)
static void Parse(int argc, const char *const *argv)
static sk_sp< SkData > MakeFromFileName(const char path[])
Definition: SkData.cpp:148
static void Init()
Definition: SkGraphics.cpp:22
sk_sp< SkFontMgr > fontMgr
Definition: examples.cpp:32
char ** argv
Definition: library.h:9
sk_sp< Factory > BestAvailable()
bool Preshape(const char *json, size_t size, SkWStream *stream, const sk_sp< SkFontMgr > &fmgr, const sk_sp< SkShapers::Factory > &sfact, const sk_sp< skresources::ResourceProvider > &rp)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63