33 #define MAXFILENAME 80
36 static const char kUnknownFontName[] =
"UnknownFont";
39 "Default font name to be used in training");
53 TBLOB * Blob,
const DENORM& denorm,
const char* BlobText) {
71 #define TRAIN_SUFFIX ".tr"
72 static FILE *FeatureFile =
NULL;
77 if (CurrFontName == kUnknownFontName) {
80 const char *basename = strrchr(filename.
string(),
'/');
81 const char *firstdot = strchr(basename ? basename : filename.
string(),
'.');
82 const char *lastdot = strrchr(filename.
string(),
'.');
83 if (firstdot != lastdot && firstdot !=
NULL && lastdot !=
NULL) {
85 CurrFontName = firstdot;
86 CurrFontName[lastdot - firstdot] =
'\0';
92 if (FeatureFile ==
NULL) {
95 cprintf(
"TRAINING ... Font name = %s\n", CurrFontName.
string());
98 LearnBlob(FeatureDefs, FeatureFile, Blob, denorm, BlobText,
104 const char* BlobText,
const char* FontName) {
110 if (CharDesc ==
NULL) {
111 cprintf(
"LearnBLob: CharDesc was NULL. Aborting.\n");
117 fprintf(FeatureFile,
"\n%s %s\n", FontName, BlobText);
122 tprintf(
"Blob learned was invalid!\n");