forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
jjag i was just looking over your changes again.
Previously you mentioned font description needed work but it appears you have already changed it over to ints from char.
Anyways the post title.
I think i get the idea for the getutf32(...) function to localize the code. but it is going to hurt performance to make another method call in the for loop especially with that yield.
This is what i came up with i think its probably faster.
(1) a assignment
(2) a conditional test.
for (int i = 0; i < text.Length; i++)
{
char cs = text[i];
int charval = cs; // (1)
if (char.IsHighSurrogate(cs)) // (2)
{
// if we do end up in here we get to skip a entire character calculation next pass so this is essentially a speed improvement.
charval = char.ConvertToUtf32(cs, text[i + 1]);
i++;
}
if (charval == '\r')
continue;
Metadata
Metadata
Assignees
Labels
No labels