32 static const char kUnknownFontName[] =
"UnknownFont";
35 "Default font name to be used in training");
48 if (*fontname == kUnknownFontName) {
51 const char *basename = strrchr(filename.
string(),
'/');
52 const char *firstdot = strchr(basename ? basename : filename.
string(),
'.');
53 const char *lastdot = strrchr(filename.
string(),
'.');
54 if (firstdot != lastdot && firstdot !=
NULL && lastdot !=
NULL) {
72 const char* blob_text) {
81 tr_file_data_ +=
"\n";
82 tr_file_data_ += fontname;
84 tr_file_data_ += blob_text;
85 tr_file_data_ +=
"\n";
90 tprintf(
"Blob learned was invalid!\n");
98 STRING tr_filename = filename +
".tr";
100 int len = tr_file_data_.
length();
102 fwrite(&tr_file_data_[0],
sizeof(tr_file_data_[0]), len, fp) == len;
void ExtractFontName(const STRING &filename, STRING *fontname)
FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &bl_denorm, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info)
FILE * Efopen(const char *Name, const char *Mode)
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
void FreeCharDescription(CHAR_DESC CharDesc)
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)
#define STRING_VAR(name, val, comment)
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
void truncate_at(inT32 index)
FEATURE_SET ExtractIntGeoFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
FEATURE_DEFS_STRUCT feature_defs_
void LearnBlob(const STRING &fontname, TBLOB *Blob, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info, const char *blob_text)
bool WriteTRFile(const STRING &filename)
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
char * classify_font_name
const char * string() const
FEATURE_SET ExtractIntCNFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)