Skip to content

Commit

Permalink
Merge pull request tesseract-ocr#381 from vidiecan/issue_380
Browse files Browse the repository at this point in the history
fixes some of the windows issue with text2image, see tesseract-ocr#380
  • Loading branch information
zdenop authored Aug 5, 2016
2 parents 337df89 + ddff7be commit 8b113a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions training/pango_font_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@
// needed for strcasestr in string.h
#define _GNU_SOURCE
#endif

#elif defined(_MSC_VER)
#include "strcasestr.h"
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <sys/param.h>
#endif
#include <algorithm>

#include "pango_font_info.h"
Expand Down Expand Up @@ -425,8 +432,12 @@ bool PangoFontInfo::CanRenderString(const char* utf8_word, int len,
}
PangoGlyph dotted_circle_glyph;
PangoFont* font = run->item->analysis.font;
dotted_circle_glyph = pango_fc_font_get_glyph(
reinterpret_cast<PangoFcFont*>(font), kDottedCircleGlyph);

PangoGlyphString * glyphs = pango_glyph_string_new();
char s[] = "\xc2\xa7";
pango_shape(s, sizeof(s), &(run->item->analysis), glyphs);
dotted_circle_glyph = glyphs->glyphs[0].glyph;

if (TLOG_IS_ON(2)) {
PangoFontDescription* desc = pango_font_describe(font);
char* desc_str = pango_font_description_to_string(desc);
Expand Down
2 changes: 1 addition & 1 deletion training/tlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DECLARE_INT_PARAM_FLAG(tlog_level);

#define TLOG_IS_ON(level) (FLAGS_tlog_level >= level)

#define TLOG_FATAL(msg...) \
#define TLOG_FATAL(msg, ...) \
{ \
tprintf(msg); \
ASSERT_FAILED.error("", ABORT, "in file %s, line %d", \
Expand Down

0 comments on commit 8b113a2

Please sign in to comment.