ondras / rot.js

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
https://ondras.github.io/rot.js/hp/
BSD 3-Clause "New" or "Revised" License
2.33k stars 254 forks source link

drawText: cjk bug fixed #166

Closed myevan closed 5 years ago

myevan commented 5 years ago

cjk characters are full-width characters but rot.js can't draw them on display layout("term")

old encoded cjk characters have 2 codes and move the cursor 2 spaces.

Ah
아
あ
啊

unicode cjk character have 1~3 codes and move the cursor 2 spaces.

아
0xC544 (unicode)
0xEC, 0x95, 0x84 (utf-8)

we can only choose whole cjk character and can't choose separated space on terminal(with cjk encoding).

but rot.js can draw some codes in the unknown separated spaces. i think it makes the cjk bug. if we avoid the bug, first space is placed unicode character and second space should be empty (and deleted if there is something already.)

i wanted to used the null or empty character for deleting but have choosed the other character ('\t') because null or empty character is already used.

if you give me a better character or other solution, i'll apply it : )

thanks

ondras commented 5 years ago

Thanks!