Closed rohkea closed 7 years ago
I'm now beginning to work on this - in practice, I've found that most characters are fullwidth. The result is definitely going to be inaccurate at times, but it should work 'well enough' for now, I hope...
Hopefully fixed now, do test.
It would be nice to have a visual indication for overflowing text. Here’s how ‘Show Text’ (aka Show Message aka Say) command looks in RPG Maker 2000:
I believe the limits are 38 and 50 half-width characters respectively.
Some commands don’t really take screen space (such as \C[1] ‘change colour’), and some take unknown amount of screen space (\N[1] ‘change hero name’ — there’s a limit on hero name size, though). RM2000/2003 doesn’t handle this in any way (this is probably the reason why RM2k developers went with the lines and didn’t just make hard limits), so we can ignore this, too. But it could be nice if we don’t.
Some characters are full-width, and take space of two ordinary characters. I think it’s safe to assume that Hiragana, Katakana, Hangul, Han (CJK Ideographs), and part of Halfwidth and fullwidth forms Unicode blocks are full-width, and everything else if half-width. Those can probably be checked by the character codes.
The actual assignment is more random (and depends on the encoding: Cyrillic is full-width in ShiftJIS [useful for ASCII art] and half-width in UTF-8 [useful for writing Russian]), but this should be a good enough approximation.
(If the game encoding is ShiftJIS, Big5, 936 or 949, the character width can be checked by converting the encoding into the target encoding and checking the number of bytes. This won’t work for UTF-8.)