diff --git a/src/fontcache.cpp b/src/fontcache.cpp index f0e7f5ce73..dcdc1804c9 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -22,9 +22,10 @@ #include "safeguards.h" -/** Default heights for the different sizes of fonts. */ -static const int _default_font_height[FS_END] = {10, 6, 18, 10}; -static const int _default_font_ascender[FS_END] = { 8, 5, 15, 8}; +/** Default unscaled heights for the different sizes of fonts. */ +/* static */ const int FontCache::DEFAULT_FONT_HEIGHT[FS_END] = {10, 6, 18, 10}; +/** Default unscaled ascenders for the different sizes of fonts. */ +/* static */ const int FontCache::DEFAULT_FONT_ASCENDER[FS_END] = {8, 5, 15, 8}; FontCacheSettings _fcsettings; @@ -32,8 +33,7 @@ FontCacheSettings _fcsettings; * Create a new font cache. * @param fs The size of the font. */ -FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs), height(_default_font_height[fs]), - ascender(_default_font_ascender[fs]), descender(_default_font_ascender[fs] - _default_font_height[fs]) +FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs) { assert(this->parent == nullptr || this->fs == this->parent->fs); FontCache::caches[this->fs] = this; @@ -50,7 +50,7 @@ FontCache::~FontCache() int FontCache::GetDefaultFontHeight(FontSize fs) { - return _default_font_height[fs]; + return FontCache::DEFAULT_FONT_HEIGHT[fs]; } /** diff --git a/src/fontcache.h b/src/fontcache.h index 5d54879323..5026694f58 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -23,9 +23,9 @@ protected: static FontCache *caches[FS_END]; ///< All the font caches. FontCache *parent; ///< The parent of this font cache. const FontSize fs; ///< The size of the font. - int height; ///< The height of the font. - int ascender; ///< The ascender value of the font. - int descender; ///< The descender value of the font. + int height = 0; ///< The height of the font. + int ascender = 0; ///< The ascender value of the font. + int descender = 0; ///< The descender value of the font. public: FontCache(FontSize fs); @@ -33,6 +33,11 @@ public: static void InitializeFontCaches(); + /** Default unscaled font heights. */ + static const int DEFAULT_FONT_HEIGHT[FS_END]; + /** Default unscaled font ascenders. */ + static const int DEFAULT_FONT_ASCENDER[FS_END]; + static int GetDefaultFontHeight(FontSize fs); /**