diff options
Diffstat (limited to 'graphics/macgui/macfontmanager.cpp')
| -rw-r--r-- | graphics/macgui/macfontmanager.cpp | 28 | 
1 files changed, 27 insertions, 1 deletions
| diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp index 03fcb41f91..97da1a6d96 100644 --- a/graphics/macgui/macfontmanager.cpp +++ b/graphics/macgui/macfontmanager.cpp @@ -72,6 +72,7 @@ void MacFontManager::loadFonts() {  		}  		FontMan.assignFontToName(fontName, font); +		_fontRegistry.setVal(fontName, font);  		debug(2, " %s", fontName.c_str());  	} @@ -86,7 +87,10 @@ const Font *MacFontManager::getFont(MacFont macFont) {  	if (!_builtInFonts) {  		if (macFont.getName().empty()) -			macFont.setName(getFontName(macFont.getId(), macFont.getSize())); +			macFont.setName(getFontName(macFont.getId(), macFont.getSize(), macFont.getSlant())); + +		if (!_fontRegistry.contains(macFont.getName())) +			generateFontSubstitute(macFont);  		font = FontMan.getFontByName(macFont.getName()); @@ -172,4 +176,26 @@ const char *MacFontManager::getFontName(int id, int size, int slant) {  	return name;  } +const char *MacFontManager::getFontName(MacFont &font) { +	return getFontName(font.getId(), font.getSize(), font.getSlant()); +} + +void MacFontManager::generateFontSubstitute(MacFont &macFont) { +	if (_fontRegistry.contains(getFontName(macFont.getId(), macFont.getSize() * 2, macFont.getSlant()))) { +		generateFont(macFont, MacFont(macFont.getId(), macFont.getSize() * 2, macFont.getSlant())); + +		return; +	} + +	if (_fontRegistry.contains(getFontName(macFont.getId(), macFont.getSize() / 2, macFont.getSlant()))) { +		generateFont(macFont, MacFont(macFont.getId(), macFont.getSize() / 2, macFont.getSlant())); + +		return; +	} +} + +void MacFontManager::generateFont(MacFont fromFont, MacFont toFont) { +	warning("Found font substitute from font %s to %s", getFontName(fromFont), getFontName(toFont)); +} +  } // End of namespace Graphics | 
