From 8860bb5c8d8a61f897add664addfde516823a35e Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 22 Dec 2013 17:46:27 +0000 Subject: [PATCH] (svn r26170) -Feature-ish: add the currently used fonts to the crash log --- src/crashlog.cpp | 13 +++++++++++++ src/fontcache.cpp | 2 ++ src/fontcache.h | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index 6881ff31f6..ef8c70dd16 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -26,6 +26,7 @@ #include "gfx_func.h" #include "network/network.h" #include "language.h" +#include "fontcache.h" #include "ai/ai_info.hpp" #include "game/game.hpp" @@ -147,6 +148,18 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const _video_driver == NULL ? "none" : _video_driver->GetName() ); + buffer += seprintf(buffer, last, + "Fonts:\n" + " Small: %s\n" + " Medium: %s\n" + " Large: %s\n" + " Mono: %s\n\n", + FontCache::Get(FS_SMALL)->GetFontName(), + FontCache::Get(FS_NORMAL)->GetFontName(), + FontCache::Get(FS_LARGE)->GetFontName(), + FontCache::Get(FS_MONO)->GetFontName() + ); + buffer += seprintf(buffer, last, "AI Configuration (local: %i):\n", (int)_local_company); const Company *c; FOR_ALL_COMPANIES(c) { diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 9e95fee642..37f949c874 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -81,6 +81,7 @@ public: virtual bool GetDrawGlyphShadow(); virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return NULL; } + virtual const char *GetFontName() { return "sprite"; } }; /** @@ -239,6 +240,7 @@ public: virtual bool GetDrawGlyphShadow(); virtual GlyphID MapCharToGlyph(WChar key); virtual const void *GetFontTable(uint32 tag, size_t &length); + virtual const char *GetFontName() { return face->family_name; } }; FT_Library _library = NULL; diff --git a/src/fontcache.h b/src/fontcache.h index 646adff1aa..804ad2c4b5 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -119,6 +119,12 @@ public: */ virtual const void *GetFontTable(uint32 tag, size_t &length) = 0; + /** + * Get the name of this font. + * @return The name of the font. + */ + virtual const char *GetFontName() = 0; + /** * Get the font cache of a given font size. * @param fs The font size to look up.