Register - Login
Views: 96132522
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
12-10-18 06:57:17 PM

Jul - Meta - RPG + UTF-8 = � New poll - New thread - New reply
Next older thread
RanAS
Member
Level: 41


Posts: 486/521
EXP: 463990
For next: 16155

Since: 10-10-14

From: Brazil

Since last post: 16 hours
Last activity: 4 hours

Posted on 10-26-18 06:05:45 AM Link | Quote

I mean, there's not much that can be done to fix it because of the font used, but it's still a bit funny to look at it.

Also it doesn't look like Jul has been updating its code along with the GitHub repository since March 3rd for some reason?
Xkeeper

Level: 251


Posts: 23358/24710
EXP: 251088367
For next: 2951509

Since: 07-03-07

Pronouns: they/them, she/her, etc.

Since last post: 19 hours
Last activity: 5 hours

Posted on 10-26-18 11:39:34 AM Link | Quote
I have a few suspicions for why the latter is true...


For the font, you're right, though in theory there's something that could be done to display Unicode — mostly just using a font that supports its glyphs instead of the image-based font.

StapleButter
Member
Level: 43


Posts: 507/507
EXP: 525022
For next: 40024

Since: 02-24-13

From: your dreams

Since last post: 9 hours
Last activity: 9 hours

Posted on 12-10-18 09:11:37 AM Link | Quote
indeed.

K64 has a halfhearted fix in place for that. UTF8 characters display as a [?] placeholder, which is not too useful but somewhat better than 㤲àéè garbage.


// halfassed UTF8 support
// uh, we don't have UTF8 shit in font.png...

function strlen_utf8($str)
{
$ret = 0;
$len = strlen($str)
for ($i = 0; $i < $len; )
{
$c = ord($str[$i++])
$ret++;

if ($c & 0x80)
{
$c &= 0xFC;
while ($c & 0x40)
{
$c <<= 1;
$i++;
}
}
}

return $ret;
}

function twrite_utf8($font,$x,$y,$l,$text)
{
global $img;
$x*=8;
$y*=8;
$text.='';
$len = strlen_utf8($text)
if($len<$l) $x+=($l-$len)*8;
$len = strlen($text)
$pos = 0;
for($i=0;$i<$len;)
{
$c = ord($text[$i++])

if ($c & 0x80)
{
if (!($c & 0x3C))
{
$c2 = ord($text[$i++])
$c = ($c2 & 0x3F) | (($c & 0x03) << 6)
}
else
{
$c &= 0xFC;
while ($c & 0x40)
{
$c <<= 1;
$i++;
}
$c = 0x7F;
}
}

ImageCopy($img,$font,$pos*8+$x,$y,($c&0xF)*8,($c>>4)*8,8,8)
$pos++;
}
}


probably could have used mb_strlen() instead of coding my own, but eh
Next older thread
Jul - Meta - RPG + UTF-8 = � New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 220d144 [2018-11-04]
©2000-2018 Acmlm, Xkeeper, Inuyasha, et al.

27 database queries.
Query execution time: 0.197405 seconds
Script execution time: 0.008090 seconds
Total render time: 0.205495 seconds