From d46eb009c132b555761b95e6ac3318539dddb20e Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Tue, 31 Jan 2017 23:06:43 +0900 Subject: use multibytetowidechar to convert charset --- fmdsp/font.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'fmdsp/font.h') 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, -- cgit v1.2.3