{"action":"created","issue":{"url":"https://api.github.com/repos/Razish/japp/issues/337","labels_url":"https://api.github.com/repos/Razish/japp/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/Razish/japp/issues/337/comments","events_url":"https://api.github.com/repos/Razish/japp/issues/337/events","html_url":"https://github.com/Razish/japp/issues/337","id":112028649,"number":337,"title":"CG display context has the wrong function pointer signature for drawText","user":{"login":"ensiform","id":997399,"avatar_url":"https://avatars.githubusercontent.com/u/997399?v=3","gravatar_id":"","url":"https://api.github.com/users/ensiform","html_url":"https://github.com/ensiform","followers_url":"https://api.github.com/users/ensiform/followers","following_url":"https://api.github.com/users/ensiform/following{/other_user}","gists_url":"https://api.github.com/users/ensiform/gists{/gist_id}","starred_url":"https://api.github.com/users/ensiform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ensiform/subscriptions","organizations_url":"https://api.github.com/users/ensiform/orgs","repos_url":"https://api.github.com/users/ensiform/repos","events_url":"https://api.github.com/users/ensiform/events{/privacy}","received_events_url":"https://api.github.com/users/ensiform/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Razish/japp/labels/bug","name":"bug","color":"7F7F7F"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-18T16:41:44Z","updated_at":"2015-10-27T01:15:42Z","closed_at":null,"body":"CG_Text_Paint etc have an extra parameter and the DC->drawText expects without the extra parameter."},"comment":{"url":"https://api.github.com/repos/Razish/japp/issues/comments/151333040","html_url":"https://github.com/Razish/japp/issues/337#issuecomment-151333040","issue_url":"https://api.github.com/repos/Razish/japp/issues/337","id":151333040,"user":{"login":"Razish","id":844370,"avatar_url":"https://avatars.githubusercontent.com/u/844370?v=3","gravatar_id":"","url":"https://api.github.com/users/Razish","html_url":"https://github.com/Razish","followers_url":"https://api.github.com/users/Razish/followers","following_url":"https://api.github.com/users/Razish/following{/other_user}","gists_url":"https://api.github.com/users/Razish/gists{/gist_id}","starred_url":"https://api.github.com/users/Razish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Razish/subscriptions","organizations_url":"https://api.github.com/users/Razish/orgs","repos_url":"https://api.github.com/users/Razish/repos","events_url":"https://api.github.com/users/Razish/events{/privacy}","received_events_url":"https://api.github.com/users/Razish/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T01:15:42Z","updated_at":"2015-10-27T01:15:42Z","body":"Yep, and that's what the customFont parameter allows you to pass.\r\n\r\nHere's a slightly outdated diff on the engine's API/font changes\r\n\r\n```diff\r\ncommit 3e15f18d87d15815564f78cf8e3eec0ed309d79f\r\nAuthor: Razish <mrrazish@gmail.com>\r\nDate:   Tue Oct 27 01:26:17 2015 +1100\r\n\r\n    [MP] Add font aspect-ratio correction and expose floating point width calculation to engine/cgame/ui\r\n    Bumps CGAME_API_VERSION, UI_API_VERSION, REF_API_VERSION\r\n\r\ndiff --git a/codemp/cgame/cg_main.c b/codemp/cgame/cg_main.c\r\nindex c6703a1..dab4883 100644\r\n--- a/codemp/cgame/cg_main.c\r\n+++ b/codemp/cgame/cg_main.c\r\n@@ -2372,6 +2372,8 @@ void CG_LoadHudMenu()\r\n \tcgDC.stopCinematic\t\t\t\t\t= &CG_StopCinematic;\r\n \tcgDC.drawCinematic\t\t\t\t\t= &CG_DrawCinematic;\r\n \tcgDC.runCinematicFrame\t\t\t\t= &CG_RunCinematicFrame;\r\n+\tcgDC.ext.Font_StrLenPixels\t\t\t= trap->ext.R_Font_StrLenPixels;\r\n+\r\n \r\n \tInit_Display(&cgDC);\r\n \r\ndiff --git a/codemp/cgame/cg_public.h b/codemp/cgame/cg_public.h\r\nindex 8b32ca6..36a273b 100644\r\n--- a/codemp/cgame/cg_public.h\r\n+++ b/codemp/cgame/cg_public.h\r\n@@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.\r\n \r\n #pragma once\r\n \r\n-#define\tCGAME_API_VERSION\t\t1\r\n+#define\tCGAME_API_VERSION\t\t2\r\n \r\n #define\tCMD_BACKUP\t\t\t64\r\n #define\tCMD_MASK\t\t\t(CMD_BACKUP - 1)\r\n@@ -713,6 +713,10 @@ typedef struct cgameImport_s {\r\n \tvoid\t\t\t(*G2API_CleanEntAttachments)\t\t\t( void );\r\n \tqboolean\t\t(*G2API_OverrideServer)\t\t\t\t\t( void *serverInstance );\r\n \tvoid\t\t\t(*G2API_GetSurfaceName)\t\t\t\t\t( void *ghoul2, int surfNumber, int modelIndex, char *fillBuf );\r\n+\r\n+\tstruct {\r\n+\t\tfloat\t\t\t(*R_Font_StrLenPixels)\t\t\t\t\t( const char *text, const int iFontIndex, const float scale );\r\n+\t} ext;\r\n } cgameImport_t;\r\n \r\n typedef struct cgameExport_s {\r\ndiff --git a/codemp/cgame/cg_syscalls.c b/codemp/cgame/cg_syscalls.c\r\nindex 36b1069..bb056ed 100644\r\n--- a/codemp/cgame/cg_syscalls.c\r\n+++ b/codemp/cgame/cg_syscalls.c\r\n@@ -219,7 +219,12 @@ qhandle_t trap_R_RegisterShaderNoMip( const char *name ) {\r\n qhandle_t trap_R_RegisterFont( const char *fontName ) {\r\n \treturn Q_syscall( CG_R_REGISTERFONT, fontName);\r\n }\r\n-int\ttrap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale) {\r\n+int trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale) {\r\n+\t//HACK! RE_Font_StrLenPixels works better with 1.0f scale\r\n+\tfloat width = (float)Q_syscall( CG_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(1.0f));\r\n+\treturn width * scale;\r\n+}\r\n+float trap_R_Font_StrLenPixelsFloat(const char *text, const int iFontIndex, const float scale) {\r\n \t//HACK! RE_Font_StrLenPixels works better with 1.0f scale\r\n \tfloat width = (float)Q_syscall( CG_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(1.0f));\r\n \treturn width * scale;\r\n@@ -228,7 +233,8 @@ int trap_R_Font_StrLenChars(const char *text) {\r\n \treturn Q_syscall( CG_R_FONT_STRLENCHARS, text);\r\n }\r\n int trap_R_Font_HeightPixels(const int iFontIndex, const float scale) {\r\n-\treturn Q_syscall( CG_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT(scale));\r\n+\tfloat height = (float)Q_syscall( CG_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT(1.0f) );\r\n+\treturn height * scale;\r\n }\r\n void trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale) {\r\n \tQ_syscall( CG_R_FONT_DRAWSTRING, ox, oy, text, rgba, setIndex, iCharLimit, PASSFLOAT(scale));\r\n@@ -936,4 +942,6 @@ static void TranslateSyscalls( void ) {\r\n \ttrap->G2API_CleanEntAttachments\t\t\t= trap_G2API_CleanEntAttachments;\r\n \ttrap->G2API_OverrideServer\t\t\t\t= trap_G2API_OverrideServer;\r\n \ttrap->G2API_GetSurfaceName\t\t\t\t= trap_G2API_GetSurfaceName;\r\n+\r\n+\ttrap->ext.R_Font_StrLenPixels\t\t\t= trap_R_Font_StrLenPixelsFloat;\r\n }\r\ndiff --git a/codemp/client/cl_cgameapi.cpp b/codemp/client/cl_cgameapi.cpp\r\nindex 48e33de..4d1d0bb 100644\r\n--- a/codemp/client/cl_cgameapi.cpp\r\n+++ b/codemp/client/cl_cgameapi.cpp\r\n@@ -1858,6 +1858,8 @@ void CL_BindCGame( void ) {\r\n \t\tcgi.G2API_OverrideServer\t\t\t\t= CL_G2API_OverrideServer;\r\n \t\tcgi.G2API_GetSurfaceName\t\t\t\t= CL_G2API_GetSurfaceName;\r\n \r\n+\t\tcgi.ext.R_Font_StrLenPixels\t\t\t\t= re->ext.Font_StrLenPixels;\r\n+\r\n \t\tGetCGameAPI = (GetCGameAPI_t)cgvm->GetModuleAPI;\r\n \t\tret = GetCGameAPI( CGAME_API_VERSION, &cgi );\r\n \t\tif ( !ret ) {\r\ndiff --git a/codemp/client/cl_uiapi.cpp b/codemp/client/cl_uiapi.cpp\r\nindex 8921aa6..70cfab4 100644\r\n--- a/codemp/client/cl_uiapi.cpp\r\n+++ b/codemp/client/cl_uiapi.cpp\r\n@@ -1194,6 +1194,8 @@ void CL_BindUI( void ) {\r\n \t\tuii.G2API_GetSurfaceName\t\t\t\t= CL_G2API_GetSurfaceName;\r\n \t\tuii.G2API_AttachG2Model\t\t\t\t\t= CL_G2API_AttachG2Model;\r\n \r\n+\t\tuii.ext.R_Font_StrLenPixels\t\t\t\t= re->ext.Font_StrLenPixels;\r\n+\r\n \t\tGetUIAPI = (GetUIAPI_t)uivm->GetModuleAPI;\r\n \t\tret = GetUIAPI( UI_API_VERSION, &uii );\r\n \t\tif ( !ret ) {\r\ndiff --git a/codemp/rd-common/tr_font.cpp b/codemp/rd-common/tr_font.cpp\r\nindex 8c33625..152423f 100644\r\n--- a/codemp/rd-common/tr_font.cpp\r\n+++ b/codemp/rd-common/tr_font.cpp\r\n@@ -1355,17 +1355,10 @@ CFontInfo *GetFont(int index)\r\n \treturn pFont;\r\n }\r\n \r\n-\r\n-int RE_Font_StrLenPixels(const char *psText, const int iFontHandle, const float fScale)\r\n-{\r\n-\tfloat\t\tfMaxWidth = 0.0f;\r\n-\tfloat\t\tfThisWidth = 0.0f;\r\n-\tCFontInfo\t*curfont;\r\n-\r\n-\tcurfont = GetFont(iFontHandle);\r\n-\tif(!curfont)\r\n-\t{\r\n-\t\treturn(0);\r\n+float RE_Font_StrLenPixelsNew( const char *psText, const int iFontHandle, const float fScale ) {\r\n+\tCFontInfo *curfont = GetFont(iFontHandle);\r\n+\tif ( !curfont ) {\r\n+\t\treturn 0.0f;\r\n \t}\r\n \r\n \tfloat fScaleAsian = fScale;\r\n@@ -1374,42 +1367,44 @@ int RE_Font_StrLenPixels(const char *psText, const int iFontHandle, const float\r\n \t\tfScaleAsian = fScale * 0.75f;\r\n \t}\r\n \r\n-\twhile(*psText)\r\n-\t{\r\n+\tfloat maxLineWidth = 0.0f;\r\n+\tfloat thisLineWidth = 0.0f;\r\n+\twhile ( *psText ) {\r\n \t\tint iAdvanceCount;\r\n \t\tunsigned int uiLetter = AnyLanguage_ReadCharFromString( psText, &iAdvanceCount, NULL );\r\n \t\tpsText += iAdvanceCount;\r\n \r\n-\t\tif (uiLetter == '^' )\r\n-\t\t{\r\n-\t\t\tif (*psText >= '0' &&\r\n-\t\t\t\t*psText <= '9')\r\n-\t\t\t{\r\n+\t\tif ( uiLetter == '^' ) {\r\n+\t\t\tif ( *psText >= '0' && *psText <= '9' ) {\r\n \t\t\t\tuiLetter = AnyLanguage_ReadCharFromString( psText, &iAdvanceCount, NULL );\r\n \t\t\t\tpsText += iAdvanceCount;\r\n \t\t\t\tcontinue;\r\n \t\t\t}\r\n \t\t}\r\n \r\n-\t\tif (uiLetter == 0x0A)\r\n-\t\t{\r\n-\t\t\tfThisWidth = 0.0f;\r\n+\t\tif ( uiLetter == '\\n' ) {\r\n+\t\t\tthisLineWidth = 0.0f;\r\n \t\t}\r\n-\t\telse\r\n-\t\t{\r\n-\t\t\tint iPixelAdvance = curfont->GetLetterHorizAdvance( uiLetter );\r\n+\t\telse {\r\n+\t\t\tfloat iPixelAdvance = (float)curfont->GetLetterHorizAdvance( uiLetter );\r\n \r\n \t\t\tfloat fValue = iPixelAdvance * ((uiLetter > (unsigned)g_iNonScaledCharRange) ? fScaleAsian : fScale);\r\n-\t\t\tfThisWidth += curfont->mbRoundCalcs ? Round( fValue ) : fValue;\r\n-\t\t\tif (fThisWidth > fMaxWidth)\r\n-\t\t\t{\r\n-\t\t\t\tfMaxWidth = fThisWidth;\r\n+\t\t\tthisLineWidth += curfont->mbRoundCalcs ? roundf( fValue ) : fValue;\r\n+\t\t\tif ( thisLineWidth > maxLineWidth ) {\r\n+\t\t\t\tmaxLineWidth = thisLineWidth;\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n+\tif ( r_aspectCorrectFonts->integer ) {\r\n+\t\treturn maxLineWidth * ((float)(SCREEN_WIDTH * glConfig.vidHeight) / (float)(SCREEN_HEIGHT * glConfig.vidWidth));\r\n+\t}\r\n+\telse {\r\n+\t\treturn maxLineWidth;\r\n+\t}\r\n+}\r\n \r\n-\t// using ceil because we need to make sure that all the text is contained within the integer pixel width we're returning\r\n-\treturn (int)ceilf(fMaxWidth);\r\n+int RE_Font_StrLenPixels( const char *psText, const int iFontHandle, const float fScale ) {\r\n+\treturn (int)ceilf( RE_Font_StrLenPixelsNew( psText, iFontHandle, fScale ) );\r\n }\r\n \r\n // not really a font function, but keeps naming consistant...\r\n@@ -1652,8 +1647,17 @@ void RE_Font_DrawString(int ox, int oy, const char *psText, const float *rgba, c\r\n \t\t\t\t\t\t\t\t//lastcolour.c,\r\n \t\t\t\t\t\t\t\thShader\t\t\t\t\t\t\t// qhandle_t hShader\r\n \t\t\t\t\t\t\t\t);\r\n-\r\n-\t\t\t\tfx += fAdvancePixels;\r\n+\t\t\t\tif ( r_aspectCorrectFonts->integer == 1 ) {\r\n+\t\t\t\t\tfx += fAdvancePixels\r\n+\t\t\t\t\t\t* ((float)(SCREEN_WIDTH * glConfig.vidHeight) / (float)(SCREEN_HEIGHT * glConfig.vidWidth));\r\n+\t\t\t\t}\r\n+\t\t\t\telse if ( r_aspectCorrectFonts->integer == 2 ) {\r\n+\t\t\t\t\tfx += ceilf( fAdvancePixels\r\n+\t\t\t\t\t\t* ((float)(SCREEN_WIDTH * glConfig.vidHeight) / (float)(SCREEN_HEIGHT * glConfig.vidWidth)) );\r\n+\t\t\t\t}\r\n+\t\t\t\telse {\r\n+\t\t\t\t\tfx += fAdvancePixels;\r\n+\t\t\t\t}\r\n \t\t\t}\r\n \t\t\tbreak;\r\n \t\t}\r\ndiff --git a/codemp/rd-common/tr_font.h b/codemp/rd-common/tr_font.h\r\nindex 0017e18..d8e073d 100644\r\n--- a/codemp/rd-common/tr_font.h\r\n+++ b/codemp/rd-common/tr_font.h\r\n@@ -33,7 +33,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.\r\n void R_ShutdownFonts(void);\r\n void R_InitFonts(void);\r\n int RE_RegisterFont(const char *psName);\r\n-int RE_Font_StrLenPixels(const char *psText, const int iFontHandle, const float fScale = 1.0f);\r\n+float RE_Font_StrLenPixelsNew( const char *psText, const int iFontHandle, const float fScale = 1.0f );\r\n+int RE_Font_StrLenPixels( const char *psText, const int iFontHandle, const float fScale = 1.0f );\r\n int RE_Font_StrLenChars(const char *psText);\r\n int RE_Font_HeightPixels(const int iFontHandle, const float fScale = 1.0f);\r\n void RE_Font_DrawString(int ox, int oy, const char *psText, const float *rgba, const int iFontHandle, int iMaxPixelWidth, const float fScale = 1.0f);\r\ndiff --git a/codemp/rd-common/tr_public.h b/codemp/rd-common/tr_public.h\r\nindex ac62599..9da97ca 100644\r\n--- a/codemp/rd-common/tr_public.h\r\n+++ b/codemp/rd-common/tr_public.h\r\n@@ -30,7 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.\r\n #include \"../qcommon/qcommon.h\"\r\n #include \"../ghoul2/ghoul2_shared.h\"\r\n \r\n-#define\tREF_API_VERSION 7\r\n+#define\tREF_API_VERSION 8\r\n \r\n //\r\n // these are the functions exported by the refresh module\r\n@@ -239,7 +239,12 @@ typedef struct refexport_s {\r\n \tint\t\t\t\t\t(*G2API_GetNumGoreMarks)\t\t\t\t( CGhoul2Info_v& ghoul2, int modelIndex );\r\n \tvoid\t\t\t\t(*G2API_AddSkinGore)\t\t\t\t\t( CGhoul2Info_v &ghoul2, SSkinGoreData &gore );\r\n \tvoid\t\t\t\t(*G2API_ClearSkinGore)\t\t\t\t\t( CGhoul2Info_v &ghoul2 );\r\n-\t#endif // _SOF2\r\n+\t#endif // _G2_GORE\r\n+\r\n+\tstruct {\r\n+\t\tfloat\t\t\t\t(*Font_StrLenPixels)\t\t\t\t\t( const char *text, const int iFontIndex, const float scale );\r\n+\t} ext;\r\n+\r\n } refexport_t;\r\n \r\n //\r\ndiff --git a/codemp/rd-vanilla/tr_init.cpp b/codemp/rd-vanilla/tr_init.cpp\r\nindex 22bc593..a9aeb5a 100644\r\n--- a/codemp/rd-vanilla/tr_init.cpp\r\n+++ b/codemp/rd-vanilla/tr_init.cpp\r\n@@ -164,6 +164,8 @@ cvar_t\t*r_debugSort;\r\n \r\n cvar_t\t*r_marksOnTriangleMeshes;\r\n \r\n+cvar_t\t*r_aspectCorrectFonts;\r\n+\r\n // the limits apply to the sum of all scenes in a frame --\r\n // the main view, all the 3D icons, etc\r\n #define\tDEFAULT_MAX_POLYS\t\t600\r\n@@ -1646,6 +1648,7 @@ void R_Register( void )\r\n \tr_shadows\t\t\t\t\t\t\t= ri->Cvar_Get( \"cg_shadows\",\t\t\t\t\t\t\"1\",\t\t\t\t\t\tCVAR_NONE );\r\n \tr_shadowRange\t\t\t\t\t\t= ri->Cvar_Get( \"r_shadowRange\",\t\t\t\t\t\"1000\",\t\t\t\t\t\tCVAR_NONE );\r\n \tr_marksOnTriangleMeshes\t\t\t\t= ri->Cvar_Get( \"r_marksOnTriangleMeshes\",\t\t\t\"0\",\t\t\t\t\t\tCVAR_ARCHIVE );\r\n+\tr_aspectCorrectFonts\t\t\t\t= ri->Cvar_Get( \"r_aspectCorrectFonts\",\t\t\t\t\"0\",\t\t\t\t\t\tCVAR_ARCHIVE );\r\n \tr_maxpolys\t\t\t\t\t\t\t= ri->Cvar_Get( \"r_maxpolys\",\t\t\t\t\t\tXSTRING( DEFAULT_MAX_POLYS ),\t\tCVAR_NONE );\r\n \tr_maxpolyverts\t\t\t\t\t\t= ri->Cvar_Get( \"r_maxpolyverts\",\t\t\t\t\tXSTRING( DEFAULT_MAX_POLYVERTS ),\tCVAR_NONE );\r\n /*\r\n@@ -2129,6 +2132,8 @@ Q_EXPORT refexport_t* QDECL GetRefAPI( int apiVersion, refimport_t *rimp ) {\r\n \t// this is set in R_Init\r\n \t//re.G2VertSpaceServer\t= G2VertSpaceServer;\r\n \r\n+\tre.ext.Font_StrLenPixels\t\t\t\t= RE_Font_StrLenPixelsNew;\r\n+\r\n \treturn &re;\r\n }\r\n \r\ndiff --git a/codemp/rd-vanilla/tr_local.h b/codemp/rd-vanilla/tr_local.h\r\nindex 6c47877..da275d2 100644\r\n--- a/codemp/rd-vanilla/tr_local.h\r\n+++ b/codemp/rd-vanilla/tr_local.h\r\n@@ -1225,6 +1225,8 @@ extern\tcvar_t\t*r_debugSort;\r\n \r\n extern\tcvar_t\t*r_marksOnTriangleMeshes;\r\n \r\n+extern\tcvar_t\t*r_aspectCorrectFonts;\r\n+\r\n /*\r\n Ghoul2 Insert Start\r\n */\r\ndiff --git a/codemp/ui/ui_main.c b/codemp/ui/ui_main.c\r\nindex 21f28b1..6d9515a 100644\r\n--- a/codemp/ui/ui_main.c\r\n+++ b/codemp/ui/ui_main.c\r\n@@ -9898,6 +9898,7 @@ void UI_Init( qboolean inGameLoad ) {\r\n \tuiInfo.uiDC.stopCinematic\t\t\t\t\t= &UI_StopCinematic;\r\n \tuiInfo.uiDC.drawCinematic\t\t\t\t\t= &UI_DrawCinematic;\r\n \tuiInfo.uiDC.runCinematicFrame\t\t\t\t= &UI_RunCinematicFrame;\r\n+\tuiInfo.uiDC.ext.Font_StrLenPixels\t\t\t= trap->ext.R_Font_StrLenPixels;\r\n \r\n \tInit_Display(&uiInfo.uiDC);\r\n \r\ndiff --git a/codemp/ui/ui_public.h b/codemp/ui/ui_public.h\r\nindex d033051..4a1f2d7 100644\r\n--- a/codemp/ui/ui_public.h\r\n+++ b/codemp/ui/ui_public.h\r\n@@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.\r\n \r\n #pragma once\r\n \r\n-#define UI_API_VERSION 1\r\n+#define UI_API_VERSION 2\r\n #define UI_LEGACY_API_VERSION 7\r\n \r\n typedef struct uiClientState_s {\r\n@@ -370,6 +370,10 @@ typedef struct uiImport_s {\r\n \tvoid\t\t\t(*G2API_GetSurfaceName)\t\t\t\t\t( void *ghoul2, int surfNumber, int modelIndex, char *fillBuf );\r\n \tqboolean\t\t(*G2API_SetSkin)\t\t\t\t\t\t( void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin );\r\n \tqboolean\t\t(*G2API_AttachG2Model)\t\t\t\t\t( void *ghoul2From, int modelIndexFrom, void *ghoul2To, int toBoltIndex, int toModel );\r\n+\r\n+\tstruct {\r\n+\t\tfloat\t\t\t(*R_Font_StrLenPixels)\t\t\t\t\t( const char *text, const int iFontIndex, const float scale );\r\n+\t} ext;\r\n } uiImport_t;\r\n \r\n typedef struct uiExport_s {\r\ndiff --git a/codemp/ui/ui_shared.h b/codemp/ui/ui_shared.h\r\nindex 005e56c..5e74993 100644\r\n--- a/codemp/ui/ui_shared.h\r\n+++ b/codemp/ui/ui_shared.h\r\n@@ -485,6 +485,10 @@ typedef struct displayContextDef_s {\r\n \tqhandle_t\t\tgradientImage;\r\n \tqhandle_t\t\tcursor;\r\n \tfloat\t\t\tFPS;\r\n+\r\n+\tstruct {\r\n+\t\tfloat\t\t\t(*Font_StrLenPixels)\t\t\t\t( const char *text, const int iFontIndex, const float scale );\r\n+\t} ext;\r\n } displayContextDef_t;\r\n \r\n \r\ndiff --git a/codemp/ui/ui_syscalls.c b/codemp/ui/ui_syscalls.c\r\nindex aac79ff..3841266 100644\r\n--- a/codemp/ui/ui_syscalls.c\r\n+++ b/codemp/ui/ui_syscalls.c\r\n@@ -113,13 +113,21 @@ qhandle_t trap_R_RegisterFont( const char *fontName ) {\r\n \treturn Q_syscall( UI_R_REGISTERFONT, fontName);\r\n }\r\n int\ttrap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale) {\r\n-\treturn Q_syscall( UI_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(scale));\r\n+\t//HACK! RE_Font_StrLenPixels works better with 1.0f scale\r\n+\tfloat width = (float)Q_syscall( UI_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(1.0f));\r\n+\treturn width * scale;\r\n+}\r\n+float trap_R_Font_StrLenPixelsFloat(const char *text, const int iFontIndex, const float scale) {\r\n+\t//HACK! RE_Font_StrLenPixels works better with 1.0f scale\r\n+\tfloat width = (float)Q_syscall( UI_R_FONT_STRLENPIXELS, text, iFontIndex, PASSFLOAT(1.0f));\r\n+\treturn width * scale;\r\n }\r\n int trap_R_Font_StrLenChars(const char *text) {\r\n \treturn Q_syscall( UI_R_FONT_STRLENCHARS, text);\r\n }\r\n int trap_R_Font_HeightPixels(const int iFontIndex, const float scale) {\r\n-\treturn Q_syscall( UI_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT(scale));\r\n+\tfloat height = (float)Q_syscall( UI_R_FONT_STRHEIGHTPIXELS, iFontIndex, PASSFLOAT( 1.0f ) );\r\n+\treturn height * scale;\r\n }\r\n void trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale) {\r\n \tQ_syscall( UI_R_FONT_DRAWSTRING, ox, oy, text, rgba, setIndex, iCharLimit, PASSFLOAT(scale));\r\n@@ -627,4 +635,6 @@ static void TranslateSyscalls( void ) {\r\n \ttrap->G2API_IKMove\t\t\t\t\t\t= trap_G2API_IKMove;\r\n \ttrap->G2API_GetSurfaceName\t\t\t\t= trap_G2API_GetSurfaceName;\r\n \ttrap->G2API_AttachG2Model\t\t\t\t= trap_G2API_AttachG2Model;\r\n+\r\n+\ttrap->ext.R_Font_StrLenPixels\t\t\t= trap_R_Font_StrLenPixelsFloat;\r\n }\r\n```"}}