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