
Features:
- Print hangul strings on screen. Outlines and general control characters are supported, but most of the kana(Japanese characters) are disabled.
- Import drag-dropped txt file(utf-8 only). p8scii special characters can be written in \000 ~ \256 (3 digits decimal) form.
- Type hangul by keyboard. Keyboard layout is 두벌식(two-set).
Technical details:
- Hangul characters are stored in 2 characters, which corresponds to 2-byte unicode, big endian. First byte of such code is 0xAC ~ 0xD7, so this blocks the usage of kana.
- Originally single-consonants or single-vowels correspond to 0x1100 ~ 0x11FF, but storing such value will conflict with regular ASCII. It is replaced to codespace of 0xD800~. 0xD800~0xD812 is single (first) consonant, 0xD820~0xD834 is single vowel.
- The position of each characters are subtly offset by each other. h_offset table holds the relevant data.
- Whole cart is 1023 tokens, and if you only count the tokens needed to print hangul, it is around 370 tokens. It is quite bulky but it isn't optimized in tokenomics way, so I assume about 250~300 tokens, and probably 400 bytes in general use memory if the charcter bitmap is moved to there.



Interesting post!
I've also customized things in Japanese.
I haven't had much experience with Hangul characters, but perhaps it could be simplified a bit more by using a custom font. (Overwriting Japanese kana characters)





@shiftalow
Actually I considered using custom font and \+ to just place the characters at appropriate position, but using \+ resets the character height and having each syllable consisted of multiple characters messes up outline feature. So I guess it is possible to save memory by custom font, whilst I prefer one-off character.
[Please log in to post a comment]