mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-30 19:52:43 +00:00
V_TitleCardStringWidth: don't count punctuation, in order to help centering
Punctuation, like ellipsis, normally offsets the centered
position of text. But this looks subjectively weird. By
not counting it, punctuation is basically allowed to
extend further off to the sides.
The difference looks like:
CENTER
||
\/
||
OLD: | TOO LATE... |
||
NEW: | TOO LATE... |
||
/\
||
CENTER
This commit is contained in:
parent
ae2fdcbd12
commit
2328ceb4bc
1 changed files with 11 additions and 0 deletions
|
|
@ -1881,6 +1881,17 @@ INT32 V_TitleCardStringWidth(const char *str, boolean p4)
|
|||
continue;
|
||||
}
|
||||
|
||||
// For the sake of centering, don't count punctuation.
|
||||
// TODO: This should ideally be more sophisticated:
|
||||
// - Only apply on the ends of each line.
|
||||
// - Check patch width directly for monospace or
|
||||
// punctuation that isn't necessarily thin.
|
||||
// - Apply to all string drawing.
|
||||
if (ispunct(*ch))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *ch;
|
||||
c = toupper(c);
|
||||
c -= LT_FONTSTART;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue