diff options
Diffstat (limited to 'win32/winfont.c')
-rw-r--r-- | win32/winfont.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/win32/winfont.c b/win32/winfont.c index 4632d51..fb98ccd 100644 --- a/win32/winfont.c +++ b/win32/winfont.c @@ -11,7 +11,7 @@ struct font_win32 { uint8_t buf[16]; }; - +/* #include "jisunih.h" uint16_t jis2unih(uint8_t jis) { @@ -26,7 +26,15 @@ uint16_t jis2unih(uint8_t jis) { return jis; } } - +*/ +uint16_t jis2unih(uint8_t jis) { + uint16_t wbuf[2]; + int outchar = MultiByteToWideChar(932, MB_ERR_INVALID_CHARS, + (char *)&jis, 1, (wchar_t *)wbuf, 2); + if (!outchar) return 0; + return wbuf[0]; +} +/* #include "jisuni.h" uint16_t jis2uni(uint16_t jis) { @@ -40,6 +48,16 @@ uint16_t jis2uni(uint16_t jis) { } return 0; } +*/ +uint16_t jis2uni(uint16_t jis) { + uint16_t sjis = jis2sjis(jis); + uint8_t abuf[2] = {sjis>>8, sjis}; + uint16_t wbuf[2]; + int outchar = MultiByteToWideChar(932, MB_ERR_INVALID_CHARS, + (char *)abuf, 2, (wchar_t *)wbuf, 2); + if (!outchar) return 0; + return wbuf[0]; +} static const void *winfont_get(const struct fmdsp_font *font, uint16_t c, enum fmdsp_font_type type) { |