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

Fix most non-ASCII characters treated as fullwidth #106

Closed CelticMinstrel closed 7 years ago

CelticMinstrel commented 7 years ago

When the rendering engine decides that a character is full-width, it skips a space, leaving it untouched, and continues in the next space. This looks really bad when the character is not, in fact, full-width. (I don't know if it looks good when the character is full-width.) This patch just fixes the detection of full-width characters in the Basic Multilingual Plane. (That last cc > 0xffee is also wrong, but didn't seem worth fixing.)

There's probably still issues with this line, as this change also squishes Chinese characters together for example... but Chinese characters didn't fit vertically into the cell either in my quick test. Still, additional ranges for CJK ideographs probably need to be added.

ondras commented 7 years ago

Hi,

thanks for this PR. I am going to merge it, although I am not really sure how this whole fixed-width feature works (it is a contributed code and my knowledge of this BMP/Unicode area is pretty leaky). Hopefully this patch improves the status quo :smile: