--- np2/wince/fontmng.cpp 2005/02/13 05:31:26 1.9 +++ np2/wince/fontmng.cpp 2005/05/17 00:10:40 1.13 @@ -1,7 +1,5 @@ #include "compiler.h" -#if defined(UNICODE) && defined(OSLANG_UTF8) -#include "codecnv.h" -#endif +#include "oemtext.h" #include "fontmng.h" @@ -219,7 +217,7 @@ static void getlength1(FNTMNG fhdl, FNTD fdat->pitch = fntsize.cx >> 1; } else { -#if !defined(_WIN32_WCE) // PocketPCのみ戻り値が変らしい? +#if !defined(WIN32_PLATFORM_PSPC) // PocketPCのみ戻り値が変らしい? fdat->width = min(fntsize.cx, fhdl->bmpwidth); #else fdat->width = min(fntsize.cx + 1, fhdl->bmpwidth); @@ -247,9 +245,17 @@ static void getlength1(FNTMNG fhdl, FNTD static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const TCHAR *string, int length) { +#if 1 // sig3は バグあるらすー + ZeroMemory(fhdl->image, fhdl->bmpalign * fhdl->bmpheight); +#else FillRect(fhdl->hdcimage, &fhdl->rect, (HBRUSH)GetStockObject(BLACK_BRUSH)); +#endif +#if !defined(_WIN32_WCE) TextOut(fhdl->hdcimage, 0, 0, string, length); +#else + ExtTextOut(fhdl->hdcimage, 0, 0, ETO_OPAQUE, NULL, string, length, NULL); +#endif getlength1(fhdl, fdat, string, length); } @@ -269,12 +275,12 @@ BRESULT fontmng_getsize(void *hdl, const if (!leng) { break; } -#if defined(UNICODE) && defined(OSLANG_UTF8) - UINT16 unistr[2]; - codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); - getlength1((FNTMNG)hdl, &fdat, unistr, 1); -#else +#if defined(OEMCHAR_SAME_TCHAR) getlength1((FNTMNG)hdl, &fdat, string, leng); +#else + TCHAR tcharstr[4]; + UINT tlen = oemtotchar(tcharstr, NELEMENTS(tcharstr), string, leng); + getlength1((FNTMNG)hdl, &fdat, tcharstr, tlen); #endif string += leng; width += fdat.pitch; @@ -308,12 +314,12 @@ BRESULT fontmng_getdrawsize(void *hdl, c if (!leng) { break; } -#if defined(UNICODE) && defined(OSLANG_UTF8) - UINT16 unistr[2]; - codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); - getlength1((FNTMNG)hdl, &fdat, unistr, 1); -#else +#if defined(OEMCHAR_SAME_TCHAR) getlength1((FNTMNG)hdl, &fdat, string, leng); +#else + TCHAR tcharstr[4]; + UINT tlen = oemtotchar(tcharstr, NELEMENTS(tcharstr), string, leng); + getlength1((FNTMNG)hdl, &fdat, tcharstr, tlen); #endif string += leng; width = posx + max(fdat.width, fdat.pitch); @@ -418,11 +424,13 @@ FNTDAT fontmng_get(void *hdl, const OEMC FNTMNG fhdl; FNTDAT fdat; + UINT leng; if ((hdl == NULL) || (string == NULL)) { goto ftmggt_err; } fhdl = (FNTMNG)hdl; + leng = milstr_charsize(string); #if defined(FONTMNG_CACHE) { @@ -433,16 +441,14 @@ FNTDAT fontmng_get(void *hdl, const OEMC UINT cnt; #if defined(OSLANG_SJIS) || defined(OSLANG_UTF8) - int len; - len = milstr_charsize(string); str = (UINT8)string[0]; - if (len >= 2) { + if (leng >= 2) { str |= ((UINT8)string[1]) << 8; } - if (len >= 3) { + if (leng >= 3) { str |= ((UINT8)string[2]) << 16; } - if (len >= 4) { + if (leng >= 4) { str |= ((UINT8)string[3]) << 24; } #else @@ -479,12 +485,14 @@ FNTDAT fontmng_get(void *hdl, const OEMC fdat = (FNTDAT)(fhdl + 1); #endif -#if defined(UNICODE) && defined(OSLANG_UTF8) - UINT16 unistr[2]; - codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); - fontmng_getchar(fhdl, fdat, unistr, 1); +#if defined(OEMCHAR_SAME_TCHAR) + fontmng_getchar(fhdl, fdat, string, leng); #else - fontmng_getchar(fhdl, fdat, string, milstr_charsize(string)); +{ + TCHAR tcharstr[4]; + UINT tlen = oemtotchar(tcharstr, NELEMENTS(tcharstr), string, leng); + fontmng_getchar(fhdl, fdat, tcharstr, tlen); +} #endif fontmng_setpat(fhdl, fdat); return(fdat);