Review interfaceFontGetStringWidthImpl
This commit is contained in:
parent
37f7ecc1c3
commit
3015f39368
|
@ -236,26 +236,22 @@ static int interfaceFontGetStringWidthImpl(const char* string)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* pch = string;
|
int stringWidth = 0;
|
||||||
int width = 0;
|
|
||||||
|
|
||||||
while (*pch != '\0') {
|
while (*string != '\0') {
|
||||||
int v3;
|
unsigned char ch = static_cast<unsigned char>(*string++);
|
||||||
int v4;
|
|
||||||
|
|
||||||
if (*pch == ' ') {
|
int characterWidth;
|
||||||
v3 = gCurrentInterfaceFontDescriptor->letterSpacing;
|
if (ch == ' ') {
|
||||||
v4 = gCurrentInterfaceFontDescriptor->wordSpacing;
|
characterWidth = gCurrentInterfaceFontDescriptor->wordSpacing;
|
||||||
} else {
|
} else {
|
||||||
v3 = gCurrentInterfaceFontDescriptor->glyphs[*pch & 0xFF].width;
|
characterWidth = gCurrentInterfaceFontDescriptor->glyphs[ch].width;
|
||||||
v4 = gCurrentInterfaceFontDescriptor->letterSpacing;
|
|
||||||
}
|
}
|
||||||
width += v3 + v4;
|
|
||||||
|
|
||||||
pch++;
|
stringWidth += characterWidth + gCurrentInterfaceFontDescriptor->letterSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return width;
|
return stringWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4421DC
|
// 0x4421DC
|
||||||
|
|
Loading…
Reference in New Issue