summaryrefslogtreecommitdiff
path: root/src/fontdetection.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2018-11-25 02:00:42 +0100
committerOwen Rudge <owen@owenrudge.net>2019-05-14 11:21:36 +0100
commit2675762ae9c58c47dc442b422927206c7bee13a8 (patch)
treecb1272f39546c66c03441887b3541fb48e6f96f3 /src/fontdetection.cpp
parenta8b6e9f23cc7f8c0835743d462fd27a20af6518e (diff)
downloadopenttd-2675762ae9c58c47dc442b422927206c7bee13a8.tar.xz
Add: [Win32] GDI engine for font glyph rendering as a replacement for including FreeType.
Building with FreeType is still possible and will take precedence over the GDI renderer, but the project files don't include FreeType anymore by default. Combining GDI rendering with ICU text layout is untested.
Diffstat (limited to 'src/fontdetection.cpp')
-rw-r--r--src/fontdetection.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp
index 3a5893e11..f7465a268 100644
--- a/src/fontdetection.cpp
+++ b/src/fontdetection.cpp
@@ -9,7 +9,7 @@
/** @file fontdetection.cpp Detection of the right font. */
-#ifdef WITH_FREETYPE
+#if defined(WITH_FREETYPE) || defined(_WIN32)
#include "stdafx.h"
#include "debug.h"
@@ -17,7 +17,9 @@
#include "string_func.h"
#include "strings_func.h"
+#ifdef WITH_FREETYPE
extern FT_Library _library;
+#endif /* WITH_FREETYPE */
/**
* Get the font loaded into a Freetype face by using a font-name.
@@ -37,6 +39,7 @@ extern FT_Library _library;
#include "safeguards.h"
+#ifdef WITH_FREETYPE
/**
* Get the short DOS 8.3 format for paths.
* FreeType doesn't support Unicode filenames and Windows' fopen (as used
@@ -241,6 +244,7 @@ err2:
err1:
return ret_font_name == nullptr ? WIDE_TO_MB((const TCHAR*)logfont->elfFullName) : ret_font_name;
}
+#endif /* WITH_FREETYPE */
class FontList {
protected:
@@ -317,6 +321,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
char font_name[MAX_PATH];
convert_from_fs((const TCHAR *)logfont->elfFullName, font_name, lengthof(font_name));
+#ifdef WITH_FREETYPE
/* Add english name after font name */
const char *english_name = GetEnglishFontName(logfont);
strecpy(font_name + strlen(font_name) + 1, english_name, lastof(font_name));
@@ -337,6 +342,9 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
}
if (!found) return 1;
+#else
+ const char *english_name = font_name;
+#endif /* WITH_FREETYPE */
info->callback->SetFontNames(info->settings, font_name);
if (info->callback->FindMissingGlyphs(nullptr)) return 1;