Skip to content

Commit

Permalink
Fixed training build
Browse files Browse the repository at this point in the history
  • Loading branch information
theraysmith committed May 14, 2015
1 parent 81b67f7 commit 941d870
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ccutil/unicharset.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ class UNICHARSET {
unichars[unichar_id].properties.max_advance =
static_cast<inT16>(ClipToRange(max_advance, 0, MAX_INT16));
}
// Returns true if the font metrics properties are empty.
bool PropertiesIncomplete(UNICHAR_ID unichar_id) const {
return unichars[unichar_id].properties.AnyRangeEmpty();
}

// Return the script name of the given unichar.
// The returned pointer will always be the same for the same script, it's
Expand Down
2 changes: 1 addition & 1 deletion training/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ text2image_LDADD += \
../api/libtesseract.la
endif
text2image_LDADD += $(libicu) -lpango-1.0 -lpangocairo-1.0 \
-lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0
-lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0 -lfontconfig

unicharset_extractor_SOURCES = unicharset_extractor.cpp
#unicharset_extractor_LDFLAGS = -static
Expand Down
6 changes: 3 additions & 3 deletions training/pango_font_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void PangoFontInfo::InitFontConfig(bool force_clear, const string& fonts_dir) {

static void ListFontFamilies(PangoFontFamily*** families,
int* n_families) {
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir);
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir.c_str());
PangoFontMap* font_map = pango_cairo_font_map_get_default();
DISABLE_HEAP_LEAK_CHECK;
pango_font_map_list_families(font_map, families, n_families);
Expand Down Expand Up @@ -235,7 +235,7 @@ bool PangoFontInfo::ParseFontDescriptionName(const string& name) {
// in the font map. Note that if the font is wholly missing, this could
// correspond to a completely different font family and face.
PangoFont* PangoFontInfo::ToPangoFont() const {
InitFontConfig(false, FLAGS_fonts_dir);
InitFontConfig(false, FLAGS_fonts_dir.c_str());
PangoFontMap* font_map = pango_cairo_font_map_get_default();
PangoContext* context = pango_context_new();
pango_cairo_context_set_resolution(context, resolution_);
Expand Down Expand Up @@ -512,7 +512,7 @@ bool FontUtils::IsAvailableFont(const char* input_query_desc,
query_desc.c_str());
PangoFont* selected_font = NULL;
{
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir);
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir.c_str());
PangoFontMap* font_map = pango_cairo_font_map_get_default();
PangoContext* context = pango_context_new();
pango_context_set_font_map(context, font_map);
Expand Down
3 changes: 2 additions & 1 deletion training/text2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ int main(int argc, char** argv) {
box_name += ".box";
render.WriteAllBoxes(box_name);
} else if (!FLAGS_render_per_font && !font_names.empty()) {
string filename = FLAGS_outputbase + ".fontlist.txt";
string filename = FLAGS_outputbase.c_str();
filename += ".fontlist.txt";
FILE* fp = fopen(filename.c_str(), "wb");
if (fp == NULL) {
tprintf("Failed to create output font list %s\n", filename.c_str());
Expand Down

0 comments on commit 941d870

Please sign in to comment.