Initial support for fallback fonts.

Minor fix in TerminalDisplay.
This commit is contained in:
Martín Lucas Golini
2022-10-04 02:09:40 -03:00
parent 059e76d8de
commit 8949190bf9
7 changed files with 72 additions and 2 deletions
+9
View File
@@ -118,6 +118,8 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
args::Flag fb( parser, "framebuffer", "Use frame buffer (more memory usage, less CPU usage)",
{ "fb", "framebuffer" } );
args::ValueFlag<std::string> fontPath( parser, "fontpath", "Font path", { 'f', "font" } );
args::ValueFlag<std::string> fallbackFontPathF( parser, "fallback-fontpath",
"Fallback Font path", { "fallback-font" } );
args::ValueFlag<Float> fontSize( parser, "fontsize", "Font size (in dp)", { 's', "fontsize" },
11 );
args::ValueFlag<Float> width( parser, "winwidth", "Window width (in dp)", { "width" }, 1280 );
@@ -212,6 +214,13 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
->loadFromFile( resPath + "fonts/NotoEmoji-Regular.ttf" );
}
std::string fallbackFontPath( fallbackFontPathF.Get() );
if ( FileSystem::fileExists( fallbackFontPath ) ) {
FontTrueType* fallbackFont = FontTrueType::New( "fallback-font" );
if ( fallbackFont->loadFromFile( fallbackFontPath ) )
FontManager::instance()->setFallbackFont( fallbackFont );
}
Float realMaxFPS = maxFPS.Get() ? maxFPS.Get() : currentDisplay->getRefreshRate();
frameTime = benchmarkMode ? Time::Zero : Milliseconds( 1000.f / realMaxFPS );