From 8d2d94e4ed32c694193baa38897b675f709f08e0 Mon Sep 17 00:00:00 2001 From: jm Date: Fri, 5 Aug 2016 19:52:39 +0200 Subject: [PATCH] fixes some of the windows issue with text2image, see #380 --- training/pango_font_info.cpp | 15 +++++++++++++-- training/tlog.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index 641d537d05..8c20b56943 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -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 #include #include +#ifndef _MSC_VER #include +#endif #include #include "pango_font_info.h" @@ -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(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); diff --git a/training/tlog.h b/training/tlog.h index 1269b905b2..af1245b6b9 100644 --- a/training/tlog.h +++ b/training/tlog.h @@ -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", \