All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
set_unicharset_properties.cpp
Go to the documentation of this file.
1 // This program reads a unicharset file, puts the result in a UNICHARSET
2 // object, fills it with properties about the unichars it contains and writes
3 // the result back to a file.
4 
5 #include <stdlib.h>
6 #include <string.h>
7 #include <string>
8 
9 #include "commandlineflags.h"
10 #include "tprintf.h"
12 
13 // The directory that is searched for universal script unicharsets.
14 STRING_PARAM_FLAG(script_dir, "",
15  "Directory name for input script unicharsets/xheights");
16 
17 // Flags from commontraining.cpp
21 
22 int main(int argc, char** argv) {
23  tesseract::ParseCommandLineFlags(argv[0], &argc, &argv, true);
24 
25  // Check validity of input flags.
26  if (FLAGS_U.empty() || FLAGS_O.empty()) {
27  tprintf("Specify both input and output unicharsets!\n");
28  exit(1);
29  }
30  if (FLAGS_script_dir.empty()) {
31  tprintf("Must specify a script_dir!\n");
32  exit(1);
33  }
34 
35  tesseract::SetPropertiesForInputFile(FLAGS_script_dir.c_str(),
36  FLAGS_U.c_str(), FLAGS_O.c_str(),
37  FLAGS_X.c_str());
38  return 0;
39 }
DECLARE_STRING_PARAM_FLAG(U)
#define tprintf(...)
Definition: tprintf.h:31
void ParseCommandLineFlags(const char *usage, int *argc, char ***argv, const bool remove_flags)
STRING_PARAM_FLAG(script_dir,"","Directory name for input script unicharsets/xheights")
int main(int argc, char **argv)
void SetPropertiesForInputFile(const string &script_dir, const string &input_unicharset_file, const string &output_unicharset_file, const string &output_xheights_file)