Support Unicode in plTextFont
(avatar tooltips, console, etc.)
#1489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the last remaining problems with rendering non-ASCII characters. The main effect is that avatar tooltips work for non-ASCII names now:
Aside from that, it fixes non-ASCII text rendering in the console, log drawer, other debug views, and the loading screen. With this, I think Plasma now supports Unicode (or at least Latin-1) in all places where it matters.
Internally, this expands the supported character range of
plTextFont
from ASCII to Latin-1. Characters beyond the supported range don't cause rendering glitches anymore and instead show a fallback character (currently¿
, because the real replacement character�
is not in Latin-1).Because
plTextFont
uses the OS native fonts instead of the game's .p2f files, it's easy to extend the character range further, theoretically up to all of Unicode. The practical limit is currently much lower than that though, becauseplTextFont
pre-renders the entire character set into a texture with hardcoded sizes. I stuck with Latin-1 for now, because it fits into the current texture sizes, and anything else isn't usable by players yet anyway (though that would change with H-uru/moul-assets#237 adding Russian fonts).If we want to support more than Latin-1, we need to adjust the hardcoded texture sizes accordingly, or calculate the required texture size dynamically as the font is loaded. Might also be good to support non-contiguous ranges of characters - that's an open issue for
plFont
as well I think.The diff is quite big, but most of it are boring
ST::string
ification changes for all the debug views. The actually interesting changes are are inplTextFont
andpfConsole
.