|
|
| version 1.9, 2005/02/13 05:31:26 | version 1.11, 2005/04/01 15:35:50 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #if defined(UNICODE) && defined(OSLANG_UTF8) | #include "oemtext.h" |
| #include "codecnv.h" | |
| #endif | |
| #include "fontmng.h" | #include "fontmng.h" |
| Line 249 static void fontmng_getchar(FNTMNG fhdl, | Line 247 static void fontmng_getchar(FNTMNG fhdl, |
| FillRect(fhdl->hdcimage, &fhdl->rect, | FillRect(fhdl->hdcimage, &fhdl->rect, |
| (HBRUSH)GetStockObject(BLACK_BRUSH)); | (HBRUSH)GetStockObject(BLACK_BRUSH)); |
| #if !defined(_WIN32_WCE) | |
| TextOut(fhdl->hdcimage, 0, 0, string, length); | 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); | getlength1(fhdl, fdat, string, length); |
| } | } |
| Line 269 BRESULT fontmng_getsize(void *hdl, const | Line 271 BRESULT fontmng_getsize(void *hdl, const |
| if (!leng) { | if (!leng) { |
| break; | break; |
| } | } |
| #if defined(UNICODE) && defined(OSLANG_UTF8) | #if defined(OEMCHAR_SAME_TCHAR) |
| UINT16 unistr[2]; | |
| codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | |
| getlength1((FNTMNG)hdl, &fdat, unistr, 1); | |
| #else | |
| getlength1((FNTMNG)hdl, &fdat, string, leng); | 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 | #endif |
| string += leng; | string += leng; |
| width += fdat.pitch; | width += fdat.pitch; |
| Line 308 BRESULT fontmng_getdrawsize(void *hdl, c | Line 310 BRESULT fontmng_getdrawsize(void *hdl, c |
| if (!leng) { | if (!leng) { |
| break; | break; |
| } | } |
| #if defined(UNICODE) && defined(OSLANG_UTF8) | #if defined(OEMCHAR_SAME_TCHAR) |
| UINT16 unistr[2]; | |
| codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | |
| getlength1((FNTMNG)hdl, &fdat, unistr, 1); | |
| #else | |
| getlength1((FNTMNG)hdl, &fdat, string, leng); | 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 | #endif |
| string += leng; | string += leng; |
| width = posx + max(fdat.width, fdat.pitch); | width = posx + max(fdat.width, fdat.pitch); |
| Line 418 FNTDAT fontmng_get(void *hdl, const OEMC | Line 420 FNTDAT fontmng_get(void *hdl, const OEMC |
| FNTMNG fhdl; | FNTMNG fhdl; |
| FNTDAT fdat; | FNTDAT fdat; |
| UINT leng; | |
| if ((hdl == NULL) || (string == NULL)) { | if ((hdl == NULL) || (string == NULL)) { |
| goto ftmggt_err; | goto ftmggt_err; |
| } | } |
| fhdl = (FNTMNG)hdl; | fhdl = (FNTMNG)hdl; |
| leng = milstr_charsize(string); | |
| #if defined(FONTMNG_CACHE) | #if defined(FONTMNG_CACHE) |
| { | { |
| Line 433 FNTDAT fontmng_get(void *hdl, const OEMC | Line 437 FNTDAT fontmng_get(void *hdl, const OEMC |
| UINT cnt; | UINT cnt; |
| #if defined(OSLANG_SJIS) || defined(OSLANG_UTF8) | #if defined(OSLANG_SJIS) || defined(OSLANG_UTF8) |
| int len; | leng = (UINT8)string[0]; |
| len = milstr_charsize(string); | if (leng >= 2) { |
| str = (UINT8)string[0]; | |
| if (len >= 2) { | |
| str |= ((UINT8)string[1]) << 8; | str |= ((UINT8)string[1]) << 8; |
| } | } |
| if (len >= 3) { | if (leng >= 3) { |
| str |= ((UINT8)string[2]) << 16; | str |= ((UINT8)string[2]) << 16; |
| } | } |
| if (len >= 4) { | if (leng >= 4) { |
| str |= ((UINT8)string[3]) << 24; | str |= ((UINT8)string[3]) << 24; |
| } | } |
| #else | #else |
| Line 479 FNTDAT fontmng_get(void *hdl, const OEMC | Line 481 FNTDAT fontmng_get(void *hdl, const OEMC |
| fdat = (FNTDAT)(fhdl + 1); | fdat = (FNTDAT)(fhdl + 1); |
| #endif | #endif |
| #if defined(UNICODE) && defined(OSLANG_UTF8) | #if defined(OEMCHAR_SAME_TCHAR) |
| UINT16 unistr[2]; | fontmng_getchar(fhdl, fdat, string, leng); |
| codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | |
| fontmng_getchar(fhdl, fdat, unistr, 1); | |
| #else | #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 | #endif |
| fontmng_setpat(fhdl, fdat); | fontmng_setpat(fhdl, fdat); |
| return(fdat); | return(fdat); |