View Single Post
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-04-2020 , 05:58   Re: DHUD empty spaces
Reply With Quote #6

Quote:
Originally Posted by georgik57 View Post
How do I get the needed character width info? Looks like it would be the best option.
Manually define spacing for every character. Maybe something like this (could be improved to use a smaller array, but fine for an example):

PHP Code:
new Float:CharSpace[1024];

SetupCharSpace()
{
    
CharSpace['0'] = 0.8;
    
CharSpace['1'] = 0.4;
    
CharSpace['W'] = 1.2;
    
// Etc.
}

CountStringSpacesEquivalent(const str[])
{
    new 
Float:space;

    for (new 
ilen strlen(str), cleni++)
    {
        
str[i];
        
space += CharSpace[c];
    }

    return 
floatround(space);

__________________
hleV is offline