From 4f0eecf6c1c827f947753a81239f8160bcbd15b2 Mon Sep 17 00:00:00 2001 From: slipher Date: Thu, 28 Feb 2019 23:50:02 -0800 Subject: [PATCH 1/7] Remove unused flag IF_ALPHA --- src/engine/renderer/tr_image.cpp | 9 +-------- src/engine/renderer/tr_local.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/engine/renderer/tr_image.cpp b/src/engine/renderer/tr_image.cpp index 8a83c8cb6f..ae8ed25aab 100644 --- a/src/engine/renderer/tr_image.cpp +++ b/src/engine/renderer/tr_image.cpp @@ -1047,14 +1047,7 @@ void R_UploadImage( const byte **dataArray, int numLayers, int numMips, } else if ( samples == 4 ) { - if ( image->bits & IF_ALPHA ) - { - internalFormat = GL_ALPHA8; - } - else - { - internalFormat = GL_RGBA8; - } + internalFormat = GL_RGBA8; } } diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index 702f23d072..372df46203 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -512,7 +512,6 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out ) { IF_NONE, IF_NOPICMIP = BIT( 0 ), - IF_ALPHA = BIT( 1 ), IF_NORMALMAP = BIT( 2 ), IF_RGBA16F = BIT( 3 ), IF_RGBA32F = BIT( 4 ), From c7576e31eda214c142215f3afe1039638d2fdab6 Mon Sep 17 00:00:00 2001 From: slipher Date: Mon, 25 Mar 2019 02:17:03 -0700 Subject: [PATCH 2/7] Remove unused struct field --- src/engine/renderer/tr_local.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index 372df46203..cc2f89d8dd 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -1093,8 +1093,6 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out ) uint32_t stateBits; // GLS_xxxx mask - bool heightMapInNormalMap; - bool isCubeMap; int deformIndex; From a270911fa62cfbfa50aa7d4d13b9c818e4043310 Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 31 Mar 2019 03:24:35 -0700 Subject: [PATCH 3/7] unused local var --- src/engine/client/cl_main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp index a24400197d..4cbef3cc51 100644 --- a/src/engine/client/cl_main.cpp +++ b/src/engine/client/cl_main.cpp @@ -1906,8 +1906,6 @@ and determine if we need to download them */ void CL_InitDownloads() { - char missingfiles[ 1024 ]; - // TTimo // init some of the www dl data clc.bWWWDl = false; From 2424b30b5e39dd6f290d9d66fcf2a26b2ce6ef4e Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 31 Mar 2019 05:42:43 -0700 Subject: [PATCH 4/7] Downgrade noisy 'sound file not found' warning to a Notice --- src/engine/audio/SoundCodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/audio/SoundCodec.cpp b/src/engine/audio/SoundCodec.cpp index feeec3978c..25eb60bd51 100644 --- a/src/engine/audio/SoundCodec.cpp +++ b/src/engine/audio/SoundCodec.cpp @@ -102,7 +102,7 @@ AudioData LoadSoundCodec(std::string filename) return AudioData(); } - audioLogs.Warn("Sound file %s not found.", filename); + audioLogs.Notice("Sound file '%s' not found.", filename); return AudioData(); } From 894d52d143dbd069486e381624493120726d3d33 Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 31 Mar 2019 07:29:20 -0700 Subject: [PATCH 5/7] Remove vestigial code related to drawing fonts from the VM This functionality no longer is used (or can be used) because UI rendering is handled by librocket. --- src/engine/client/cl_cgame.cpp | 4 +-- src/engine/null/null_renderer.cpp | 15 ---------- src/engine/qcommon/q_shared.h | 1 + src/engine/renderer/tr_font.cpp | 46 ------------------------------- src/engine/renderer/tr_init.cpp | 4 --- src/engine/renderer/tr_local.h | 4 --- src/engine/renderer/tr_public.h | 4 --- 7 files changed, 3 insertions(+), 75 deletions(-) diff --git a/src/engine/client/cl_cgame.cpp b/src/engine/client/cl_cgame.cpp index 59a821d730..9d2b6d380e 100644 --- a/src/engine/client/cl_cgame.cpp +++ b/src/engine/client/cl_cgame.cpp @@ -1334,8 +1334,8 @@ void CGameVM::QVMSyscall(int index, Util::Reader& reader, IPC::Channel& channel) break; case CG_R_REGISTERFONT: - IPC::HandleMsg(channel, std::move(reader), [this] (const std::string& name, const std::string& fallbackName, int pointSize, fontMetrics_t& font) { - re.RegisterFontVM(name.c_str(), fallbackName.c_str(), pointSize, &font); + IPC::HandleMsg(channel, std::move(reader), [this] (const std::string&, const std::string&, int, fontMetrics_t&) { + Log::Warn("TODO(0.52): remove"); }); break; diff --git a/src/engine/null/null_renderer.cpp b/src/engine/null/null_renderer.cpp index 19e146a9f4..04724e0bf4 100644 --- a/src/engine/null/null_renderer.cpp +++ b/src/engine/null/null_renderer.cpp @@ -80,17 +80,6 @@ void RE_GlyphChar( fontInfo_t *font, int, glyphInfo_t *glyph ) RE_Glyph( font, nullptr, glyph ); } void RE_UnregisterFont( fontInfo_t* ) { } -void RE_RegisterFontVM( const char *, const char *, int pointSize, fontMetrics_t *font ) -{ - font->handle = 1; - font->isBitmap = true; - font->pointSize = pointSize; - font->height = 1; - font->glyphScale = 1.0f; -} -void RE_GlyphVM( fontHandle_t, const char *, glyphInfo_t * ) { } -void RE_GlyphCharVM( fontHandle_t, int, glyphInfo_t * ) { } -void RE_UnregisterFontVM( fontHandle_t ) { } void RE_LoadWorldMap( const char * ) { } void RE_SetWorldVisData( const byte * ) { } void RE_EndRegistration() { } @@ -233,10 +222,6 @@ refexport_t *GetRefAPI( int, refimport_t* ) re.Glyph = RE_Glyph; re.GlyphChar = RE_GlyphChar; re.UnregisterFont = RE_UnregisterFont; - re.RegisterFontVM = RE_RegisterFontVM; - re.GlyphVM = RE_GlyphVM; - re.GlyphCharVM = RE_GlyphCharVM; - re.UnregisterFontVM = RE_UnregisterFontVM; re.LoadWorld = RE_LoadWorldMap; re.SetWorldVisData = RE_SetWorldVisData; re.EndRegistration = RE_EndRegistration; diff --git a/src/engine/qcommon/q_shared.h b/src/engine/qcommon/q_shared.h index 069babc8a7..b87c5d61c1 100644 --- a/src/engine/qcommon/q_shared.h +++ b/src/engine/qcommon/q_shared.h @@ -2145,6 +2145,7 @@ struct fontInfo_t char name[ MAX_QPATH ]; }; +// TODO(0.52) remove. struct fontMetrics_t { fontHandle_t handle; diff --git a/src/engine/renderer/tr_font.cpp b/src/engine/renderer/tr_font.cpp index bb139b0cf6..f1f5b2dabb 100644 --- a/src/engine/renderer/tr_font.cpp +++ b/src/engine/renderer/tr_font.cpp @@ -101,7 +101,6 @@ static const int MAX_FONTS = 16; static const int MAX_FILES = ( MAX_FONTS ); static fontInfo_t registeredFont[ MAX_FONTS ]; static unsigned int fontUsage[ MAX_FONTS ]; -static unsigned int fontUsageVM[ MAX_FONTS ]; static struct { void *data; @@ -368,27 +367,11 @@ void RE_GlyphChar( fontInfo_t *font, int ch, glyphInfo_t *glyph ) memcpy( glyph, &font->glyphBlock[ ch / 256][ ch % 256 ], sizeof( *glyph ) ); } -void RE_GlyphCharVM( fontHandle_t handle, int ch, glyphInfo_t *glyph ) -{ - if ( handle < 0 || handle >= MAX_FONTS || !fontUsageVM[ handle ] ) - { - memset( glyph, 0, sizeof( *glyph ) ); - return; - } - - RE_GlyphChar( ®isteredFont[ handle ], ch, glyph ); -} - void RE_Glyph( fontInfo_t *font, const char *str, glyphInfo_t *glyph ) { RE_GlyphChar( font, Q_UTF8_CodePoint( str ), glyph ); } -void RE_GlyphVM( fontHandle_t handle, const char *str, glyphInfo_t *glyph ) -{ - RE_GlyphCharVM( handle, str ? Q_UTF8_CodePoint( str ) : 0, glyph ); -} - static void RE_StoreImage( fontInfo_t *font, int chunk, int page, int from, int to, const unsigned char *bitmap, int yEnd ) { int scaledSize = FONT_SIZE * FONT_SIZE; @@ -836,26 +819,6 @@ void RE_RegisterFont( const char *fontName, const char *fallbackName, int pointS RE_RegisterFont_Internal( fontName, fallbackName, pointSize, font ); } -void RE_RegisterFontVM( const char *fontName, const char *fallbackName, int pointSize, fontMetrics_t *metrics ) -{ - fontInfo_t *font; - fontHandle_t handle = RE_RegisterFont_Internal( fontName, fallbackName, pointSize, &font ); - - if ( handle >= 0 ) - { - ++fontUsageVM[ handle ]; - metrics->handle = handle; - metrics->isBitmap = !!font->face; - metrics->pointSize = font->pointSize; - metrics->height = font->height; - metrics->glyphScale = font->glyphScale; - } - else - { - metrics->handle = -1; - } -} - void R_InitFreeType() { if ( FT_Init_FreeType( &ftLibrary ) ) @@ -928,15 +891,6 @@ void RE_UnregisterFont( fontInfo_t *font ) } } -void RE_UnregisterFontVM( fontHandle_t handle ) -{ - if ( handle >= 0 && handle < MAX_FONTS && fontUsageVM[ handle ] ) - { - --fontUsageVM[ handle ]; - RE_UnregisterFont_Internal( handle ); - } -} - void R_DoneFreeType() { if ( ftLibrary ) diff --git a/src/engine/renderer/tr_init.cpp b/src/engine/renderer/tr_init.cpp index a904a8ccfa..9b61d53a06 100644 --- a/src/engine/renderer/tr_init.cpp +++ b/src/engine/renderer/tr_init.cpp @@ -1590,10 +1590,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p re.GlyphChar = RE_GlyphChar; re.RegisterFont = RE_RegisterFont; re.UnregisterFont = RE_UnregisterFont; - re.RegisterFontVM = RE_RegisterFontVM; - re.GlyphVM = RE_GlyphVM; - re.GlyphCharVM = RE_GlyphCharVM; - re.UnregisterFontVM = RE_UnregisterFontVM; re.RemapShader = R_RemapShader; re.GetEntityToken = R_GetEntityToken; diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index cc2f89d8dd..030a9eedc6 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -3906,10 +3906,6 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out ) void RE_UnregisterFont( fontInfo_t *font ); void RE_Glyph(fontInfo_t *font, const char *str, glyphInfo_t *glyph); void RE_GlyphChar(fontInfo_t *font, int ch, glyphInfo_t *glyph); - void RE_RegisterFontVM( const char *fontName, const char *fallbackName, int pointSize, fontMetrics_t * ); - void RE_UnregisterFontVM( fontHandle_t ); - void RE_GlyphVM( fontHandle_t, const char *str, glyphInfo_t *glyph); - void RE_GlyphCharVM( fontHandle_t, int ch, glyphInfo_t *glyph); void RE_Finish(); diff --git a/src/engine/renderer/tr_public.h b/src/engine/renderer/tr_public.h index feafd97faf..163320e798 100644 --- a/src/engine/renderer/tr_public.h +++ b/src/engine/renderer/tr_public.h @@ -71,12 +71,8 @@ struct refexport_t RegisterShaderFlags_t flags ); void ( *RegisterFont )( const char *fontName, const char *fallbackName, int pointSize, fontInfo_t **font ); void ( *UnregisterFont )( fontInfo_t *font ); - void ( *RegisterFontVM )( const char *fontName, const char *fallbackName, int pointSize, fontMetrics_t * ); - void ( *UnregisterFontVM )( fontHandle_t font ); void ( *Glyph )( fontInfo_t *font, const char *str, glyphInfo_t *glyph ); void ( *GlyphChar )( fontInfo_t *font, int ch, glyphInfo_t *glyph ); - void ( *GlyphVM )( fontHandle_t font, const char *ch, glyphInfo_t *glyph ); - void ( *GlyphCharVM )( fontHandle_t font, int ch, glyphInfo_t *glyph ); void ( *LoadWorld )( const char *name ); From 882808e36f017783a392f54ee5024b3c9b40ea4b Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 31 Mar 2019 09:16:38 -0700 Subject: [PATCH 6/7] Clean up some font registration code and fix a couple error handling bugs --- src/engine/client/cl_main.cpp | 13 +++++-- src/engine/null/null_renderer.cpp | 9 +---- src/engine/qcommon/q_shared.h | 1 + src/engine/renderer/tr_font.cpp | 64 ++++++++++++++----------------- src/engine/renderer/tr_local.h | 2 +- src/engine/renderer/tr_public.h | 2 +- 6 files changed, 43 insertions(+), 48 deletions(-) diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp index 4cbef3cc51..8690e89fba 100644 --- a/src/engine/client/cl_main.cpp +++ b/src/engine/client/cl_main.cpp @@ -716,7 +716,7 @@ void CL_ShutdownAll() CL_ShutdownCGame(); // Clear Faces - if ( re.UnregisterFont && cls.consoleFont ) + if ( cls.consoleFont ) { re.UnregisterFont( cls.consoleFont ); cls.consoleFont = nullptr; @@ -3031,7 +3031,7 @@ bool CL_InitRenderer() { if ( cl_consoleFontScaling->value == 0 ) { - re.RegisterFont( cl_consoleFont->string, nullptr, cl_consoleFontSize->integer, &cls.consoleFont ); + cls.consoleFont = re.RegisterFont( cl_consoleFont->string, nullptr, cl_consoleFontSize->integer ); } else { @@ -3039,10 +3039,15 @@ bool CL_InitRenderer() int fontScale = std::min(cls.glconfig.vidWidth, cls.glconfig.vidHeight) / 90; // fontScale / 12px gets 1px on 1920×1080 screen - re.RegisterFont( cl_consoleFont->string, nullptr, cl_consoleFontSize->integer * fontScale / 12, &cls.consoleFont ); + cls.consoleFont = re.RegisterFont( cl_consoleFont->string, nullptr, cl_consoleFontSize->integer * fontScale / 12 ); } - cls.useLegacyConsoleFont = false; + if ( cls.consoleFont != nullptr ) + cls.useLegacyConsoleFont = false; + } + else + { + Log::Warn("Font file '%s' not found", cl_consoleFont->string); } FS_FCloseFile( f ); diff --git a/src/engine/null/null_renderer.cpp b/src/engine/null/null_renderer.cpp index 04724e0bf4..c87cc4bd39 100644 --- a/src/engine/null/null_renderer.cpp +++ b/src/engine/null/null_renderer.cpp @@ -50,14 +50,9 @@ qhandle_t RE_RegisterShader( const char *, RegisterShaderFlags_t ) { return 1; } -void RE_RegisterFont( const char *, const char *, int pointSize, fontInfo_t **font ) +fontInfo_t* RE_RegisterFont( const char *, const char *, int pointSize ) { - if (!*font) - return; - (*font)->pointSize = pointSize; - (*font)->height = 1; - (*font)->glyphScale = 1.0f; - (*font)->name[0] = '\0'; + return nullptr; } void RE_Glyph( fontInfo_t *, const char *, glyphInfo_t *glyph ) { diff --git a/src/engine/qcommon/q_shared.h b/src/engine/qcommon/q_shared.h index b87c5d61c1..be605decdd 100644 --- a/src/engine/qcommon/q_shared.h +++ b/src/engine/qcommon/q_shared.h @@ -2131,6 +2131,7 @@ struct glyphInfo_t char shaderName[ 32 ]; }; +// Unlike with many other handle types, 0 is valid, not an error or default return value. using fontHandle_t = int; using glyphBlock_t = glyphInfo_t[256]; diff --git a/src/engine/renderer/tr_font.cpp b/src/engine/renderer/tr_font.cpp index f1f5b2dabb..94ec50f68c 100644 --- a/src/engine/renderer/tr_font.cpp +++ b/src/engine/renderer/tr_font.cpp @@ -604,7 +604,7 @@ static void RE_FreeFontFile( void *data ) } } -static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char *fallbackName, int pointSize, fontInfo_t **font ) +fontInfo_t* RE_RegisterFont( const char *fontName, const char *fallbackName, int pointSize ) { FT_Face face, fallback; void *faceData, *fallbackData; @@ -656,21 +656,20 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * } else if ( pointSize == registeredFont[ i ].pointSize && Q_stricmp( strippedName, registeredFont[ i ].name ) == 0 ) { - *font = ®isteredFont[ i ]; ++fontUsage[ i ]; - return i; + return ®isteredFont[ i ]; } } - *font = ®isteredFont[ fontNo ]; - memset( *font, 0, sizeof( fontInfo_t ) ); - if ( fontNo < 0 ) { Log::Warn("RE_RegisterFont: Too many fonts registered already." ); - return -1; + return nullptr; } + fontInfo_t* font = ®isteredFont[ fontNo ]; + memset( font, 0, sizeof( fontInfo_t ) ); + len = ri.FS_ReadFile( fileName, nullptr ); if ( len > 0x5004 && len <= 0x5004 + MAX_QPATH ) // 256 glyphs, scale info, and the bitmap name @@ -682,7 +681,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * fdOffset = 0; fdFile = (byte*) faceData; - glyphs = (*font)->glyphBlock[0] = (glyphInfo_t*) ri.Z_Malloc( sizeof( glyphBlock_t ) ); + glyphs = font->glyphBlock[0] = (glyphInfo_t*) ri.Z_Malloc( sizeof( glyphBlock_t ) ); memset( glyphs, 0, sizeof( glyphBlock_t ) ); for ( i = 0; i < GLYPHS_PER_FONT; i++ ) @@ -709,10 +708,10 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * fdOffset += sizeof( glyphs[ i ].shaderName ); } - (*font)->pointSize = pointSize; - (*font)->height = height; - (*font)->glyphScale = readFloat(); - Q_strncpyz( (*font)->name, registeredName, sizeof( (*font)->name ) ); + font->pointSize = pointSize; + font->height = height; + font->glyphScale = readFloat(); + Q_strncpyz( font->name, registeredName, sizeof( font->name ) ); ri.FS_FreeFile( faceData ); @@ -722,17 +721,17 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * } ++fontUsage[ fontNo ]; - return fontNo; + return font; } if ( ftLibrary == nullptr ) { Log::Warn("RE_RegisterFont: FreeType not initialized." ); - return -1; + return nullptr; } // FIXME: fallback name OR index no. - Q_strncpyz( (*font)->name, strippedName, sizeof( (*font)->name ) ); + Q_strncpyz( font->name, strippedName, sizeof( font->name ) ); Q_strncpyz( fileName, fontName, sizeof( fileName ) ); @@ -742,7 +741,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * { Log::Warn("RE_RegisterFont: Unable to read font file %s", fileName ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } // allocate on the stack first in case we fail @@ -750,7 +749,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * { Log::Warn("RE_RegisterFont: FreeType2, unable to allocate new face." ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } if ( FT_Set_Char_Size( face, pointSize << 6, pointSize << 6, 72, 72 ) ) @@ -758,7 +757,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * Log::Warn("RE_RegisterFont: FreeType2, Unable to set face char size." ); FT_Done_Face( face ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } fallback = nullptr; @@ -776,7 +775,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * RE_FreeFontFile( fallbackData ); FT_Done_Face( face ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } // allocate on the stack first in case we fail @@ -786,7 +785,7 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * RE_FreeFontFile( fallbackData ); FT_Done_Face( face ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } if ( FT_Set_Char_Size( fallback, pointSize << 6, pointSize << 6, 72, 72 ) ) @@ -796,27 +795,22 @@ static fontHandle_t RE_RegisterFont_Internal( const char *fontName, const char * RE_FreeFontFile( fallbackData ); FT_Done_Face( face ); RE_FreeFontFile( faceData ); - return -1; + return nullptr; } } - (*font)->face = face; - (*font)->faceData = faceData; - (*font)->fallback = fallback; - (*font)->fallbackData = fallbackData; - (*font)->pointSize = pointSize; - (*font)->glyphScale = Com_Clamp( 24.0f, 64.0f, r_fontScale->value ) / pointSize; - (*font)->height = ceil( ( face->height / 64.0 ) * ( face->size->metrics.y_scale / 65536.0 ) * (*font)->glyphScale ); + font->face = face; + font->faceData = faceData; + font->fallback = fallback; + font->fallbackData = fallbackData; + font->pointSize = pointSize; + font->glyphScale = Com_Clamp( 24.0f, 64.0f, r_fontScale->value ) / pointSize; + font->height = ceil( ( face->height / 64.0 ) * ( face->size->metrics.y_scale / 65536.0 ) * font->glyphScale ); - RE_RenderChunk( *font, 0 ); + RE_RenderChunk( font, 0 ); ++fontUsage[ fontNo ]; - return fontNo; -} - -void RE_RegisterFont( const char *fontName, const char *fallbackName, int pointSize, fontInfo_t **font ) -{ - RE_RegisterFont_Internal( fontName, fallbackName, pointSize, font ); + return font; } void R_InitFreeType() diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index 030a9eedc6..2b3eb31c1b 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -3902,7 +3902,7 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out ) // font stuff void R_InitFreeType(); void R_DoneFreeType(); - void RE_RegisterFont( const char *fontName, const char *fallbackName, int pointSize, fontInfo_t **font ); + fontInfo_t* RE_RegisterFont( const char *fontName, const char *fallbackName, int pointSize ); void RE_UnregisterFont( fontInfo_t *font ); void RE_Glyph(fontInfo_t *font, const char *str, glyphInfo_t *glyph); void RE_GlyphChar(fontInfo_t *font, int ch, glyphInfo_t *glyph); diff --git a/src/engine/renderer/tr_public.h b/src/engine/renderer/tr_public.h index 163320e798..adae8af504 100644 --- a/src/engine/renderer/tr_public.h +++ b/src/engine/renderer/tr_public.h @@ -69,7 +69,7 @@ struct refexport_t qhandle_t ( *RegisterSkin )( const char *name ); qhandle_t ( *RegisterShader )( const char *name, RegisterShaderFlags_t flags ); - void ( *RegisterFont )( const char *fontName, const char *fallbackName, int pointSize, fontInfo_t **font ); + fontInfo_t* ( *RegisterFont )( const char *fontName, const char *fallbackName, int pointSize ); void ( *UnregisterFont )( fontInfo_t *font ); void ( *Glyph )( fontInfo_t *font, const char *str, glyphInfo_t *glyph ); void ( *GlyphChar )( fontInfo_t *font, int ch, glyphInfo_t *glyph ); From e75bc763bd211f34f8c403ff03802223722a9e82 Mon Sep 17 00:00:00 2001 From: slipher Date: Sun, 31 Mar 2019 09:56:20 -0700 Subject: [PATCH 7/7] Make changing the console font size work This was broken due to failing to refresh the values of latched cvars. --- src/engine/client/cl_main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp index 8690e89fba..a01ffa9125 100644 --- a/src/engine/client/cl_main.cpp +++ b/src/engine/client/cl_main.cpp @@ -3019,6 +3019,10 @@ bool CL_InitRenderer() return false; } + cl_consoleFont = Cvar_Get( "cl_consoleFont", "fonts/unifont.ttf", CVAR_LATCH ); + cl_consoleFontSize = Cvar_Get( "cl_consoleFontSize", "16", CVAR_LATCH ); + cl_consoleFontScaling = Cvar_Get( "cl_consoleFontScaling", "1", CVAR_LATCH ); + // load character sets cls.charSetShader = re.RegisterShader( "gfx/2d/bigchars", RSF_DEFAULT ); cls.useLegacyConsoleFont = cls.useLegacyConsoleFace = true; @@ -3335,9 +3339,6 @@ void CL_Init() j_side_axis = Cvar_Get( "j_side_axis", "0", 0 ); j_up_axis = Cvar_Get( "j_up_axis", "2", 0 ); - cl_consoleFont = Cvar_Get( "cl_consoleFont", "fonts/unifont.ttf", CVAR_LATCH ); - cl_consoleFontSize = Cvar_Get( "cl_consoleFontSize", "16", CVAR_LATCH ); - cl_consoleFontScaling = Cvar_Get( "cl_consoleFontScaling", "1", CVAR_LATCH ); cl_consoleFontKerning = Cvar_Get( "cl_consoleFontKerning", "0", 0 ); cl_consoleCommand = Cvar_Get( "cl_consoleCommand", "say", 0 );