Skip to content

Commit

Permalink
set PANGOCAIRO_BACKEND=fc to avoid crash; fixes #736
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Oct 23, 2018
1 parent 3d508a6 commit e60318f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/training/text2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
#include "tlog.h"
#include "unicharset.h"
#include "util.h"
#ifdef _MSC_VER
# define putenv(s) _putenv(s)
#endif

// A number with which to initialize the random number generator.
const int kRandomSeed = 0x18273645;
Expand Down Expand Up @@ -681,6 +684,18 @@ static int Main() {
}

int main(int argc, char** argv) {
// Respect enviroment variable. could be:
// fc (fontconfig), win32, and coretext
// If not set force fontconfig for Mac OS.
// See https://github.com/tesseract-ocr/tesseract/issues/736
char* backend;
backend = getenv("PANGOCAIRO_BACKEND");
if (backend == NULL) {
putenv("PANGOCAIRO_BACKEND=fc");
} else {
printf("Using '%s' as pango cairo backend based on enviroment "
"variable.\n", backend);
}
tesseract::CheckSharedLibraryVersion();
if (argc > 1) {
if ((strcmp(argv[1], "-v") == 0) ||
Expand Down

0 comments on commit e60318f

Please sign in to comment.