Skip to content

Commit 941d870

Browse files
committed
Fixed training build
1 parent 81b67f7 commit 941d870

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

ccutil/unicharset.h

+4
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,10 @@ class UNICHARSET {
617617
unichars[unichar_id].properties.max_advance =
618618
static_cast<inT16>(ClipToRange(max_advance, 0, MAX_INT16));
619619
}
620+
// Returns true if the font metrics properties are empty.
621+
bool PropertiesIncomplete(UNICHAR_ID unichar_id) const {
622+
return unichars[unichar_id].properties.AnyRangeEmpty();
623+
}
620624

621625
// Return the script name of the given unichar.
622626
// The returned pointer will always be the same for the same script, it's

training/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ text2image_LDADD += \
243243
../api/libtesseract.la
244244
endif
245245
text2image_LDADD += $(libicu) -lpango-1.0 -lpangocairo-1.0 \
246-
-lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0
246+
-lgobject-2.0 -lglib-2.0 -lcairo -lpangoft2-1.0 -lfontconfig
247247

248248
unicharset_extractor_SOURCES = unicharset_extractor.cpp
249249
#unicharset_extractor_LDFLAGS = -static

training/pango_font_info.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void PangoFontInfo::InitFontConfig(bool force_clear, const string& fonts_dir) {
161161

162162
static void ListFontFamilies(PangoFontFamily*** families,
163163
int* n_families) {
164-
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir);
164+
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir.c_str());
165165
PangoFontMap* font_map = pango_cairo_font_map_get_default();
166166
DISABLE_HEAP_LEAK_CHECK;
167167
pango_font_map_list_families(font_map, families, n_families);
@@ -235,7 +235,7 @@ bool PangoFontInfo::ParseFontDescriptionName(const string& name) {
235235
// in the font map. Note that if the font is wholly missing, this could
236236
// correspond to a completely different font family and face.
237237
PangoFont* PangoFontInfo::ToPangoFont() const {
238-
InitFontConfig(false, FLAGS_fonts_dir);
238+
InitFontConfig(false, FLAGS_fonts_dir.c_str());
239239
PangoFontMap* font_map = pango_cairo_font_map_get_default();
240240
PangoContext* context = pango_context_new();
241241
pango_cairo_context_set_resolution(context, resolution_);
@@ -512,7 +512,7 @@ bool FontUtils::IsAvailableFont(const char* input_query_desc,
512512
query_desc.c_str());
513513
PangoFont* selected_font = NULL;
514514
{
515-
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir);
515+
PangoFontInfo::InitFontConfig(false, FLAGS_fonts_dir.c_str());
516516
PangoFontMap* font_map = pango_cairo_font_map_get_default();
517517
PangoContext* context = pango_context_new();
518518
pango_context_set_font_map(context, font_map);

training/text2image.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ int main(int argc, char** argv) {
630630
box_name += ".box";
631631
render.WriteAllBoxes(box_name);
632632
} else if (!FLAGS_render_per_font && !font_names.empty()) {
633-
string filename = FLAGS_outputbase + ".fontlist.txt";
633+
string filename = FLAGS_outputbase.c_str();
634+
filename += ".fontlist.txt";
634635
FILE* fp = fopen(filename.c_str(), "wb");
635636
if (fp == NULL) {
636637
tprintf("Failed to create output font list %s\n", filename.c_str());

0 commit comments

Comments
 (0)