@@ -2103,42 +2103,32 @@ bool CL_InitRenderer()
21032103 return false ;
21042104 }
21052105
2106- cl_consoleFont = Cvar_Get ( " cl_consoleFont" , " fonts/unifont.ttf " , CVAR_LATCH );
2106+ cl_consoleFont = Cvar_Get ( " cl_consoleFont" , " " , CVAR_LATCH );
21072107 cl_consoleFontSize = Cvar_Get ( " cl_consoleFontSize" , " 16" , CVAR_LATCH );
21082108 cl_consoleFontScaling = Cvar_Get ( " cl_consoleFontScaling" , " 1" , CVAR_LATCH );
21092109
21102110 // load character sets
21112111 cls.charSetShader = re.RegisterShader ( " gfx/2d/bigchars" , RSF_2D );
21122112 cls.useLegacyConsoleFont = cls.useLegacyConsoleFace = true ;
21132113
2114- // Register console font specified by cl_consoleFont, if any
2115- // filehandle is unused but forces FS_FOpenFileRead() to heed purecheck because it does not when filehandle is nullptr
2116- if ( cl_consoleFont->string [0 ] )
2117- {
2118- if ( FS_FOpenFileRead ( cl_consoleFont->string , &f ) >= 0 )
2119- {
2120- if ( cl_consoleFontScaling->value == 0 )
2121- {
2122- cls.consoleFont = re.RegisterFont ( cl_consoleFont->string , cl_consoleFontSize->integer );
2123- }
2124- else
2125- {
2126- // This gets 12px on 1920×1080 screen, which is libRocket default for 1em
2127- int fontScale = std::min (cls.windowConfig .vidWidth , cls.windowConfig .vidHeight ) / 90 ;
2114+ // Register console font specified by cl_consoleFont. Empty string means use the embbed Unifont
21282115
2129- // fontScale / 12px gets 1px on 1920×1080 screen
2130- cls.consoleFont = re.RegisterFont ( cl_consoleFont->string , cl_consoleFontSize->integer * fontScale / 12 );
2131- }
2116+ if ( cl_consoleFontScaling->value == 0 )
2117+ {
2118+ cls.consoleFont = re.RegisterFont ( cl_consoleFont->string , cl_consoleFontSize->integer );
2119+ }
2120+ else
2121+ {
2122+ // This gets 12px on 1920×1080 screen, which is libRocket default for 1em
2123+ int fontScale = std::min (cls.windowConfig .vidWidth , cls.windowConfig .vidHeight ) / 90 ;
21322124
2133- if ( cls.consoleFont != nullptr )
2134- cls.useLegacyConsoleFont = false ;
2135- }
2136- else
2137- {
2138- Log::Warn (" Font file '%s' not found" , cl_consoleFont->string );
2139- }
2125+ // fontScale / 12px gets 1px on 1920×1080 screen
2126+ cls.consoleFont = re.RegisterFont ( cl_consoleFont->string , cl_consoleFontSize->integer * fontScale / 12 );
2127+ }
21402128
2141- FS_FCloseFile ( f );
2129+ if ( cls.consoleFont != nullptr )
2130+ {
2131+ cls.useLegacyConsoleFont = false ;
21422132 }
21432133
21442134 cls.whiteShader = re.RegisterShader ( " white" , RSF_NOMIP );
0 commit comments