27 #ifndef DISABLED_LEGACY_ENGINE 31 #endif // ndef DISABLED_LEGACY_ENGINE 33 static const char kUnknownFontName[] =
"UnknownFont";
36 "Default font name to be used in training");
49 if (*fontname == kUnknownFontName) {
52 const char *basename = strrchr(filename.
string(),
'/');
53 const char *firstdot = strchr(basename ? basename : filename.
string(),
'.');
54 const char *lastdot = strrchr(filename.
string(),
'.');
55 if (firstdot != lastdot && firstdot !=
nullptr && lastdot !=
nullptr) {
66 #ifndef DISABLED_LEGACY_ENGINE 77 const char* blob_text) {
86 tr_file_data_ +=
"\n";
87 tr_file_data_ += fontname;
89 tr_file_data_ += blob_text;
90 tr_file_data_ +=
"\n";
95 tprintf(
"Blob learned was invalid!\n");
104 STRING tr_filename = filename +
".tr";
105 FILE* fp = fopen(tr_filename.
string(),
"wb");
115 #endif // ndef DISABLED_LEGACY_ENGINE void ExtractFontName(const STRING &filename, STRING *fontname)
void FreeCharDescription(CHAR_DESC CharDesc)
FEATURE_SET ExtractIntCNFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
FEATURE_SET ExtractIntGeoFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
#define STRING_VAR(name, val, comment)
const char * string() const
bool Serialize(FILE *fp, const char *data, size_t n)
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
DLLSYM void tprintf(const char *format,...)
void truncate_at(int32_t index)
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
bool WriteTRFile(const STRING &filename)
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
char * classify_font_name
void LearnBlob(const STRING &fontname, TBLOB *Blob, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info, const char *blob_text)
FEATURE_DEFS_STRUCT feature_defs_
FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm)
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)