Fix #10993: Crash log when font caches not initialised (#11024)

See also: #10836
This commit is contained in:
Jonathan G Rennison
2023-06-17 17:56:27 +01:00
committed by GitHub
parent 1d902a97ce
commit a6b625eea3
3 changed files with 21 additions and 4 deletions

View File

@@ -53,6 +53,21 @@ int FontCache::GetDefaultFontHeight(FontSize fs)
return _default_font_height[fs];
}
/**
* Get the font name of a given font size.
* @param fs The font size to look up.
* @return The font name.
*/
std::string FontCache::GetName(FontSize fs)
{
FontCache *fc = FontCache::Get(fs);
if (fc != nullptr) {
return fc->GetFontName();
} else {
return "[NULL]";
}
}
/**
* Get height of a character for a given font size.