Clean up comment formatting re: UTF-8 stuff
This commit is contained in:
parent
0eb9409ea5
commit
f46df76736
1 changed files with 33 additions and 29 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - October 29, 2021
|
June 14, 2002 - November 3, 2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
@ -1665,54 +1665,58 @@ static SDL_Surface *render_text_w(TuxPaint_Font * restrict font, const wchar_t *
|
||||||
{
|
{
|
||||||
if (str[i] <= 0x0000007F)
|
if (str[i] <= 0x0000007F)
|
||||||
{
|
{
|
||||||
/* 0x00000000 - 0x0000007F:
|
/* Range: 0x00000000 - 0x0000007F:
|
||||||
0xxxxxxx */
|
|
||||||
|
In: 00abcdef
|
||||||
|
Out: 00abcdef */
|
||||||
|
|
||||||
utfstr[j++] = (str[i] & 0x7F);
|
utfstr[j++] = (str[i] & 0x7F);
|
||||||
}
|
}
|
||||||
else if (str[i] <= 0x000007FF)
|
else if (str[i] <= 0x000007FF)
|
||||||
{
|
{
|
||||||
/* 0x00000080 - 0x000007FF:
|
/* Range: 0x00000080 - 0x000007FF:
|
||||||
|
|
||||||
00000abc defghijk
|
In: 00000abc defghijk
|
||||||
110abcde 10fghijk */
|
Out: 110abcde 10fghijk */
|
||||||
|
|
||||||
utfstr[j++] = (((str[i] & 0x0700) >> 6) | /* -----abc -------- to ---abc-- */
|
utfstr[j++] = (((str[i] & 0x0700) >> 6) | /* -----abc -------- to ---abc-- */
|
||||||
((str[i] & 0x00C0) >> 6) | /* -------- de------ to ------de */
|
((str[i] & 0x00C0) >> 6) | /* -------- de------ to ------de */
|
||||||
(0xC0)); /* add 110----- */
|
(0xC0)); /* add 110----- */
|
||||||
|
|
||||||
utfstr[j++] = (((str[i] & 0x003F)) | /* -------- --fghijk to --fghijk */
|
utfstr[j++] = (((str[i] & 0x003F)) | /* -------- --fghijk to --fghijk */
|
||||||
(0x80)); /* add 10------ */
|
(0x80)); /* add 10------ */
|
||||||
}
|
}
|
||||||
else if (str[i] <= 0x0000FFFF)
|
else if (str[i] <= 0x0000FFFF)
|
||||||
{
|
{
|
||||||
/* 0x00000800 - 0x0000FFFF:
|
/* Range: 0x00000800 - 0x0000FFFF:
|
||||||
|
|
||||||
abcdefgh ijklmnop
|
In: abcdefgh ijklmnop
|
||||||
1110abcd 10efghij 10klmnop */
|
Out: 1110abcd 10efghij 10klmnop */
|
||||||
|
|
||||||
utfstr[j++] = (((str[i] & 0xF000) >> 12) | /* abcd---- -------- to ----abcd */
|
utfstr[j++] = (((str[i] & 0xF000) >> 12) | /* abcd---- -------- to ----abcd */
|
||||||
(0xE0)); /* add 1110---- */
|
(0xE0)); /* add 1110---- */
|
||||||
utfstr[j++] = (((str[i] & 0x0FC0) >> 6) | /* ----efgh ij------ to --efghij */
|
utfstr[j++] = (((str[i] & 0x0FC0) >> 6) | /* ----efgh ij------ to --efghij */
|
||||||
(0x80)); /* add 10------ */
|
(0x80)); /* add 10------ */
|
||||||
utfstr[j++] = (((str[i] & 0x003F)) | /* -------- --klmnop to --klmnop */
|
utfstr[j++] = (((str[i] & 0x003F)) | /* -------- --klmnop to --klmnop */
|
||||||
(0x80)); /* add 10------ */
|
(0x80)); /* add 10------ */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* 0x00010000 - 0x001FFFFF:
|
/* Range: 0x00010000 - 0x001FFFFF:
|
||||||
11110abc 10defghi 10jklmno 10pqrstu */
|
|
||||||
|
|
||||||
utfstr[j++] = (((str[i] & 0x1C0000) >> 18) | /* ---abc-- -------- -------- to -----abc */
|
In: 000abcde fghijklm nopqrstu
|
||||||
(0xF0)); /* add 11110000 */
|
Out: 11110abc 10defghi 10jklmno 10pqrstu */
|
||||||
utfstr[j++] = (((str[i] & 0x030000) >> 12) | /* ------de -------- -------- to --de---- */
|
|
||||||
((str[i] & 0x00F000) >> 12) | /* -------- fghi---- -------- to ----fghi */
|
utfstr[j++] = (((str[i] & 0x1C0000) >> 18) | /* ---abc-- -------- -------- to -----abc */
|
||||||
(0x80)); /* add 10------ */
|
(0xF0)); /* add 11110000 */
|
||||||
utfstr[j++] = (((str[i] & 0x000F00) >> 6) | /* -------- ----jklm -------- to --jklm-- */
|
utfstr[j++] = (((str[i] & 0x030000) >> 12) | /* ------de -------- -------- to --de---- */
|
||||||
((str[i] & 0x0000C0) >> 6) | /* -------- -------- no------ to ------no */
|
((str[i] & 0x00F000) >> 12) | /* -------- fghi---- -------- to ----fghi */
|
||||||
(0x80)); /* add 10------ */
|
(0x80)); /* add 10------ */
|
||||||
utfstr[j++] = ((str[i] & 0x00003F) | /* -------- -------- --pqrstu to --prqstu */
|
utfstr[j++] = (((str[i] & 0x000F00) >> 6) | /* -------- ----jklm -------- to --jklm-- */
|
||||||
(0x80)); /* add 10------ */
|
((str[i] & 0x0000C0) >> 6) | /* -------- -------- no------ to ------no */
|
||||||
|
(0x80)); /* add 10------ */
|
||||||
|
utfstr[j++] = ((str[i] & 0x00003F) | /* -------- -------- --pqrstu to --prqstu */
|
||||||
|
(0x80)); /* add 10------ */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
utfstr[j] = '\0';
|
utfstr[j] = '\0';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue