1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Ignore directional control chars in font::len()

They're invisible in font::print(), but they were still considered
characters with widths in the width function. This change made the
levels screen look better in RTL too - I was wondering why the level
options were too far left.
This commit is contained in:
Dav999 2024-01-06 01:56:45 +01:00 committed by Misa Elizabeth Kai
parent 18dfcff985
commit 945f0edaae

View file

@ -1232,9 +1232,12 @@ int len(const uint32_t flags, const char* text)
int text_len = 0; int text_len = 0;
uint32_t codepoint; uint32_t codepoint;
while ((codepoint = UTF8_next(&text))) while ((codepoint = UTF8_next(&text)))
{
if (!is_directional_character(codepoint) && !is_joiner(codepoint))
{ {
text_len += get_advance(pf.font_sel, codepoint); text_len += get_advance(pf.font_sel, codepoint);
} }
}
return text_len * pf.scale; return text_len * pf.scale;
} }