From b1860972c6e5192be917764548e09c05437b9991 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 13 Feb 2024 15:33:51 +0300 Subject: [PATCH] engine: font: fix inverted check, fix potential division by zero --- engine/client/cl_font.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/client/cl_font.c b/engine/client/cl_font.c index 354df2b6..c68c0a72 100644 --- a/engine/client/cl_font.c +++ b/engine/client/cl_font.c @@ -133,7 +133,7 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float font->type = FONT_VARIABLE; font->valid = true; - font->scale = scale; + font->scale = scale ? scale : 1.0f; font->rendermode = rendermode; font->charHeight = Q_rint( src.rowheight * scale ); @@ -205,7 +205,8 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon return font->charWidths[number]; rc = &font->fontRc[number]; - if( font->scale <= 1.0f || REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture )) + + if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture )) half = 0; s1 = ((float)rc->left + half ) / texw;