diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-01-31 23:06:43 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-01-31 23:06:43 +0900 |
commit | d46eb009c132b555761b95e6ac3318539dddb20e (patch) | |
tree | c5a89c651e32e263482d53c1ee4cca44bcb58066 /fmdsp/font.h | |
parent | 92ac7de6585e64006db631d6c39d4a7ef00f4776 (diff) |
use multibytetowidechar to convert charset
Diffstat (limited to 'fmdsp/font.h')
-rw-r--r-- | fmdsp/font.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fmdsp/font.h b/fmdsp/font.h index 689df04..8c57284 100644 --- a/fmdsp/font.h +++ b/fmdsp/font.h @@ -33,6 +33,21 @@ static inline uint16_t sjis2jis(uint8_t sjis_1st, uint8_t sjis_2nd) { return jis; } +static inline uint16_t jis2sjis(uint16_t jis) { + jis += 0x217e; + jis ^= 0x4000; + bool c = jis&0x100; + jis = (jis & 0xff) | (((jis>>1)|0x8000)&0xff00); + if (!c) { + uint16_t jisl = jis & 0xff; + jisl -= 0xde; + if (jisl >> 8) jisl--; + jisl -= 0x80; + jis = (jis&0xff00) | (jisl&0xff); + } + return jis; +} + enum fmdsp_font_type { FMDSP_FONT_ANK, FMDSP_FONT_JIS_LEFT, |