| version 1.6, 2005/02/09 20:11:37 | version 1.8, 2005/02/12 12:14:00 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 |  | #if defined(UNICODE) && defined(OSLANG_UTF8) | 
 |  | #include        "codecnv.h" | 
 |  | #endif | 
 | #include        "fontmng.h" | #include        "fontmng.h" | 
 |  |  | 
 |  |  | 
| Line 6 | Line 9 | 
 |  |  | 
 | #if defined(FONTMNG_CACHE) | #if defined(FONTMNG_CACHE) | 
 | typedef struct { | typedef struct { | 
| UINT16          str; | UINT    str; | 
| UINT16          next; | UINT    next; | 
 | } FNTCTBL; | } FNTCTBL; | 
 | #endif | #endif | 
 |  |  | 
| Line 21  typedef struct { | Line 24  typedef struct { | 
 | // あとは拡張〜 | // あとは拡張〜 | 
 | HDC                     hdcimage; | HDC                     hdcimage; | 
 | HBITMAP         hBitmap; | HBITMAP         hBitmap; | 
| BYTE            *image; | UINT8           *image; | 
 | HFONT           hfont; | HFONT           hfont; | 
 | RECT            rect; | RECT            rect; | 
 | int                     bmpwidth; | int                     bmpwidth; | 
| Line 36  typedef struct { | Line 39  typedef struct { | 
 | } _FNTMNG, *FNTMNG; | } _FNTMNG, *FNTMNG; | 
 |  |  | 
 |  |  | 
| static const TCHAR deffontface[] = STRLITERAL("MS ゴシック"); | static const TCHAR deffontface[] = _T("MS ゴシック"); | 
| static const TCHAR deffontface2[] = STRLITERAL("MS Pゴシック"); | static const TCHAR deffontface2[] = _T("MS Pゴシック"); | 
 |  |  | 
| #ifndef _WIN32_WCE | #if !defined(_WIN32_WCE) | 
 | #define TEXTALPHABASE   (FDAT_DEPTH * 0x60 / 256) | #define TEXTALPHABASE   (FDAT_DEPTH * 0x60 / 256) | 
 | #else | #else | 
 | #define TEXTALPHABASE   (FDAT_DEPTH * 0x40 / 256) | #define TEXTALPHABASE   (FDAT_DEPTH * 0x40 / 256) | 
| Line 128  void *fontmng_create(int size, UINT type | Line 131  void *fontmng_create(int size, UINT type | 
 | ret->bmpheight = bmpheight; | ret->bmpheight = bmpheight; | 
 | ret->bmpalign = (((bmpwidth + 31) / 8) & (~3)); | ret->bmpalign = (((bmpwidth + 31) / 8) & (~3)); | 
 |  |  | 
| bi = (BITMAPINFO *)(((BYTE *)(ret + 1)) + fontwork); | bi = (BITMAPINFO *)(((UINT8 *)(ret + 1)) + fontwork); | 
 | bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | 
 | bi->bmiHeader.biWidth = ret->bmpwidth; | bi->bmiHeader.biWidth = ret->bmpwidth; | 
 | bi->bmiHeader.biHeight = ret->bmpheight; | bi->bmiHeader.biHeight = ret->bmpheight; | 
| Line 153  void *fontmng_create(int size, UINT type | Line 156  void *fontmng_create(int size, UINT type | 
 | ret->hdcimage = CreateCompatibleDC(hdc); | ret->hdcimage = CreateCompatibleDC(hdc); | 
 | ReleaseDC(NULL, hdc); | ReleaseDC(NULL, hdc); | 
 | ret->hBitmap = (HBITMAP)SelectObject(ret->hdcimage, ret->hBitmap); | ret->hBitmap = (HBITMAP)SelectObject(ret->hdcimage, ret->hBitmap); | 
| #ifndef _WIN32_WCE | #if !defined(_WIN32_WCE) | 
 | SetDIBColorTable(ret->hdcimage, 0, 2, bi->bmiColors); | SetDIBColorTable(ret->hdcimage, 0, 2, bi->bmiColors); | 
 | #endif | #endif | 
 |  |  | 
| Line 161  void *fontmng_create(int size, UINT type | Line 164  void *fontmng_create(int size, UINT type | 
 | lf.lfWidth = 0; | lf.lfWidth = 0; | 
 | lf.lfEscapement = FW_DONTCARE; | lf.lfEscapement = FW_DONTCARE; | 
 | lf.lfOrientation = FW_DONTCARE; | lf.lfOrientation = FW_DONTCARE; | 
| #ifdef _WIN32_WCE | #if !defined(_WIN32_WCE) | 
| lf.lfWeight = (type & FDAT_BOLD)?FW_BOLD:FW_THIN; |  | 
| #else |  | 
 | lf.lfWeight = (type & FDAT_BOLD)?FW_BOLD:FW_REGULAR; | lf.lfWeight = (type & FDAT_BOLD)?FW_BOLD:FW_REGULAR; | 
 |  | #else | 
 |  | lf.lfWeight = (type & FDAT_BOLD)?FW_BOLD:FW_THIN; | 
 | #endif | #endif | 
 | lf.lfItalic = FALSE; | lf.lfItalic = FALSE; | 
 | lf.lfUnderline = FALSE; | lf.lfUnderline = FALSE; | 
| Line 201  void fontmng_destroy(void *hdl) { | Line 204  void fontmng_destroy(void *hdl) { | 
 | } | } | 
 | } | } | 
 |  |  | 
 | int fontmng_getpoint(void *hdl) { |  | 
 |  |  | 
| if (hdl) { | // ---- | 
| } |  | 
| return(0); |  | 
| } |  | 
 |  |  | 
| #ifdef UNICODE | static void getlength1(FNTMNG fhdl, FNTDAT fdat, | 
| static void getlength1(FNTMNG fhdl, FNTDAT fdat, LPCTSTR string, | const TCHAR *string, int length) { | 
| int tleng, int length) { |  | 
 |  |  | 
 | SIZE    fntsize; | SIZE    fntsize; | 
 |  |  | 
| if ((fhdl->fonttype & FDAT_PROPORTIONAL) && | if (GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize)) { | 
| (GetTextExtentPoint32(fhdl->hdcimage, string, tleng, &fntsize))) { |  | 
 | if (fhdl->fonttype & FDAT_ALIAS) { | if (fhdl->fonttype & FDAT_ALIAS) { | 
 | fntsize.cx = min(fntsize.cx, fhdl->bmpwidth); | fntsize.cx = min(fntsize.cx, fhdl->bmpwidth); | 
 | fdat->width = (fntsize.cx + 1) >> 1; | fdat->width = (fntsize.cx + 1) >> 1; | 
 | fdat->pitch = fntsize.cx >> 1; | fdat->pitch = fntsize.cx >> 1; | 
 | fdat->height = fhdl->bmpheight >> 1; |  | 
 | } | } | 
 | else { | else { | 
| #if 1           // PocketPCのみ戻り値が変らしい? | #if !defined(_WIN32_WCE)        // PocketPCのみ戻り値が変らしい? | 
 | fdat->width = min(fntsize.cx, fhdl->bmpwidth); | fdat->width = min(fntsize.cx, fhdl->bmpwidth); | 
 | #else | #else | 
 | fdat->width = min(fntsize.cx + 1, fhdl->bmpwidth); | fdat->width = min(fntsize.cx + 1, fhdl->bmpwidth); | 
 | #endif | #endif | 
 | fdat->pitch = min(fntsize.cx, fhdl->bmpwidth); | fdat->pitch = min(fntsize.cx, fhdl->bmpwidth); | 
 | fdat->height = fhdl->bmpheight; |  | 
 | } | } | 
 | } | } | 
 | else { | else { | 
 | if (length < 2) { |  | 
 | fdat->pitch = fhdl->fontsize >> 1; |  | 
 | } |  | 
 | else { |  | 
 | fdat->pitch = fhdl->fontsize; |  | 
 | } |  | 
 | if (fhdl->fonttype & FDAT_ALIAS) { | if (fhdl->fonttype & FDAT_ALIAS) { | 
 | fdat->width = fhdl->bmpwidth >> 1; | fdat->width = fhdl->bmpwidth >> 1; | 
 | fdat->height = fhdl->bmpheight >> 1; |  | 
 | } | } | 
 | else { | else { | 
 | fdat->width = fhdl->bmpwidth; | fdat->width = fhdl->bmpwidth; | 
 | fdat->height = fhdl->bmpheight; |  | 
 | } |  | 
 | } |  | 
 | } |  | 
 |  |  | 
 | static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const char *string) { |  | 
 |  |  | 
 | TCHAR   txtwork[4]; |  | 
 | DWORD   len; |  | 
 | int             leng; |  | 
 |  |  | 
 | FillRect(fhdl->hdcimage, &fhdl->rect, |  | 
 | (HBRUSH)GetStockObject(BLACK_BRUSH)); |  | 
 | leng = strlen(string); |  | 
 | len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, string, -1, |  | 
 | txtwork, sizeof(txtwork)/sizeof(TCHAR)) - 1; |  | 
 | ExtTextOut(fhdl->hdcimage, 0, 0, ETO_OPAQUE, NULL, |  | 
 | txtwork, len, NULL); |  | 
 | getlength1(fhdl, fdat, txtwork, len, leng); |  | 
 | } |  | 
 |  |  | 
 | BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { |  | 
 |  |  | 
 | TCHAR   txtwork[4]; |  | 
 | char    buf[4]; |  | 
 | _FNTDAT fdat; |  | 
 | int             width; |  | 
 | DWORD   len; |  | 
 | int             leng; |  | 
 |  |  | 
 | if ((hdl == NULL) || (string == NULL)) { |  | 
 | goto fmgs_exit; |  | 
 | } |  | 
 | width = 0; |  | 
 | buf[2] = '\0'; |  | 
 | do { |  | 
 | buf[0] = *string++; |  | 
 | if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { |  | 
 | buf[1] = *string++; |  | 
 | if (buf[1] == '\0') { |  | 
 | break; |  | 
 | } |  | 
 | leng = 2; |  | 
 | } |  | 
 | else if (buf[0]) { |  | 
 | buf[1] = '\0'; |  | 
 | leng = 1; |  | 
 | } |  | 
 | else { |  | 
 | break; |  | 
 | } |  | 
 | len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, buf, -1, |  | 
 | txtwork, sizeof(txtwork)/sizeof(TCHAR)) - 1; |  | 
 | getlength1((FNTMNG)hdl, &fdat, txtwork, len, leng); |  | 
 | width += fdat.pitch; |  | 
 | } while(1); |  | 
 |  |  | 
 | if (pt) { |  | 
 | pt->x = width; |  | 
 | pt->y = ((FNTMNG)hdl)->fontsize; |  | 
 | } |  | 
 | return(SUCCESS); |  | 
 |  |  | 
 | fmgs_exit: |  | 
 | return(FAILURE); |  | 
 | } |  | 
 |  |  | 
 | BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { |  | 
 |  |  | 
 | TCHAR   txtwork[4]; |  | 
 | char    buf[4]; |  | 
 | _FNTDAT fdat; |  | 
 | int             width; |  | 
 | int             posx; |  | 
 | DWORD   len; |  | 
 | int             leng; |  | 
 |  |  | 
 | if ((hdl == NULL) || (string == NULL)) { |  | 
 | goto fmgds_exit; |  | 
 | } |  | 
 |  |  | 
 | width = 0; |  | 
 | posx = 0; |  | 
 | buf[2] = '\0'; |  | 
 | do { |  | 
 | buf[0] = *string++; |  | 
 | if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { |  | 
 | buf[1] = *string++; |  | 
 | if (buf[1] == '\0') { |  | 
 | break; |  | 
 | } |  | 
 | leng = 2; |  | 
 | } |  | 
 | else if (buf[0]) { |  | 
 | buf[1] = '\0'; |  | 
 | leng = 1; |  | 
 | } |  | 
 | else { |  | 
 | break; |  | 
 | } | } | 
| len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, buf, -1, | fdat->pitch = (fhdl->fontsize + 1) >> 1; | 
| txtwork, sizeof(txtwork)/sizeof(TCHAR)) - 1; |  | 
| getlength1((FNTMNG)hdl, &fdat, txtwork, len, leng); |  | 
| width = posx + max(fdat.width, fdat.pitch); |  | 
| posx += fdat.pitch; |  | 
| } while(1); |  | 
|  |  | 
| if (pt) { |  | 
| pt->x = width; |  | 
| pt->y = ((FNTMNG)hdl)->fontsize; |  | 
 | } | } | 
| return(SUCCESS); | if (fhdl->fonttype & FDAT_ALIAS) { | 
|  | fdat->height = fhdl->bmpheight >> 1; | 
| fmgds_exit: |  | 
| return(FAILURE); |  | 
| } |  | 
|  |  | 
| #else |  | 
|  |  | 
| static void getlength1(FNTMNG fhdl, FNTDAT fdat, |  | 
| const char *string, int length) { |  | 
|  |  | 
| SIZE    fntsize; |  | 
|  |  | 
| if ((fhdl->fonttype & FDAT_PROPORTIONAL) && |  | 
| (GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize))) { |  | 
| if (fhdl->fonttype & FDAT_ALIAS) { |  | 
| fntsize.cx = min(fntsize.cx, fhdl->bmpwidth); |  | 
| fdat->width = (fntsize.cx + 1) >> 1; |  | 
| fdat->pitch = fntsize.cx >> 1; |  | 
| fdat->height = fhdl->bmpheight >> 1; |  | 
| } |  | 
| else { |  | 
| fntsize.cx = min(fntsize.cx, fhdl->bmpwidth); |  | 
| fdat->width = fntsize.cx; |  | 
| fdat->pitch = fntsize.cx; |  | 
| fdat->height = fhdl->bmpheight; |  | 
| } |  | 
 | } | } | 
 | else { | else { | 
| if (length < 2) { | fdat->height = fhdl->bmpheight; | 
| fdat->pitch = fhdl->fontsize >> 1; |  | 
| } |  | 
| else { |  | 
| fdat->pitch = fhdl->fontsize; |  | 
| } |  | 
| if (fhdl->fonttype & FDAT_ALIAS) { |  | 
| fdat->width = fhdl->bmpwidth >> 1; |  | 
| fdat->height = fhdl->bmpheight >> 1; |  | 
| } |  | 
| else { |  | 
| fdat->width = fhdl->bmpwidth; |  | 
| fdat->height = fhdl->bmpheight; |  | 
| } |  | 
 | } | } | 
 | } | } | 
 |  |  | 
| static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, const char *string) { | static void fontmng_getchar(FNTMNG fhdl, FNTDAT fdat, | 
|  | const TCHAR *string, int length) { | 
| int             leng; |  | 
 |  |  | 
 | FillRect(fhdl->hdcimage, &fhdl->rect, | FillRect(fhdl->hdcimage, &fhdl->rect, | 
 | (HBRUSH)GetStockObject(BLACK_BRUSH)); | (HBRUSH)GetStockObject(BLACK_BRUSH)); | 
| leng = strlen(string); | TextOut(fhdl->hdcimage, 0, 0, string, length); | 
| TextOut(fhdl->hdcimage, 0, 0, string, leng); | getlength1(fhdl, fdat, string, length); | 
| getlength1(fhdl, fdat, string, leng); |  | 
 | } | } | 
 |  |  | 
| BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getsize(void *hdl, const OEMCHAR *string, POINT_T *pt) { | 
 |  |  | 
 | char    buf[4]; |  | 
 | _FNTDAT fdat; | _FNTDAT fdat; | 
 | int             width; | int             width; | 
 | int             leng; | int             leng; | 
| Line 425  BOOL fontmng_getsize(void *hdl, const ch | Line 264  BOOL fontmng_getsize(void *hdl, const ch | 
 | goto fmgs_exit; | goto fmgs_exit; | 
 | } | } | 
 |  |  | 
| buf[2] = '\0'; | while(1) { | 
| do { | leng = milstr_charsize(string); | 
| buf[0] = *string++; | if (!leng) { | 
| if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { |  | 
| buf[1] = *string++; |  | 
| if (buf[1] == '\0') { |  | 
| break; |  | 
| } |  | 
| leng = 2; |  | 
| } |  | 
| else if (buf[0]) { |  | 
| buf[1] = '\0'; |  | 
| leng = 1; |  | 
| } |  | 
| else { |  | 
 | break; | break; | 
 | } | } | 
| getlength1((FNTMNG)hdl, &fdat, buf, leng); | #if defined(UNICODE) && defined(OSLANG_UTF8) | 
|  | UINT16 unistr[2]; | 
|  | codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | 
|  | getlength1((FNTMNG)hdl, &fdat, unistr, 1); | 
|  | #else | 
|  | getlength1((FNTMNG)hdl, &fdat, string, leng); | 
|  | #endif | 
|  | string += leng; | 
 | width += fdat.pitch; | width += fdat.pitch; | 
| } while(1); | } | 
 |  |  | 
 | if (pt) { | if (pt) { | 
 | pt->x = width; | pt->x = width; | 
| Line 456  fmgs_exit: | Line 290  fmgs_exit: | 
 | return(FAILURE); | return(FAILURE); | 
 | } | } | 
 |  |  | 
| BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getdrawsize(void *hdl, const OEMCHAR *string, POINT_T *pt) { | 
 |  |  | 
 | char    buf[4]; |  | 
 | _FNTDAT fdat; | _FNTDAT fdat; | 
 | int             width; | int             width; | 
 | int             posx; | int             posx; | 
| Line 470  BOOL fontmng_getdrawsize(void *hdl, cons | Line 303  BOOL fontmng_getdrawsize(void *hdl, cons | 
 |  |  | 
 | width = 0; | width = 0; | 
 | posx = 0; | posx = 0; | 
| buf[2] = '\0'; | while(1) { | 
| do { | leng = milstr_charsize(string); | 
| buf[0] = *string++; | if (!leng) { | 
| if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { |  | 
| buf[1] = *string++; |  | 
| if (buf[1] == '\0') { |  | 
| break; |  | 
| } |  | 
| leng = 2; |  | 
| } |  | 
| else if (buf[0]) { |  | 
| buf[1] = '\0'; |  | 
| leng = 1; |  | 
| } |  | 
| else { |  | 
 | break; | break; | 
 | } | } | 
| getlength1((FNTMNG)hdl, &fdat, buf, leng); | #if defined(UNICODE) && defined(OSLANG_UTF8) | 
|  | UINT16 unistr[2]; | 
|  | codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | 
|  | getlength1((FNTMNG)hdl, &fdat, unistr, 1); | 
|  | #else | 
|  | getlength1((FNTMNG)hdl, &fdat, string, leng); | 
|  | #endif | 
|  | string += leng; | 
 | width = posx + max(fdat.width, fdat.pitch); | width = posx + max(fdat.width, fdat.pitch); | 
 | posx += fdat.pitch; | posx += fdat.pitch; | 
| } while(1); | } | 
|  |  | 
 | if (pt) { | if (pt) { | 
 | pt->x = width; | pt->x = width; | 
 | pt->y = ((FNTMNG)hdl)->fontsize; | pt->y = ((FNTMNG)hdl)->fontsize; | 
| Line 501  BOOL fontmng_getdrawsize(void *hdl, cons | Line 328  BOOL fontmng_getdrawsize(void *hdl, cons | 
 | fmgds_exit: | fmgds_exit: | 
 | return(FAILURE); | return(FAILURE); | 
 | } | } | 
 | #endif |  | 
 |  |  | 
 | static void fontmng_setpat(FNTMNG fhdl, FNTDAT fdat) { | static void fontmng_setpat(FNTMNG fhdl, FNTDAT fdat) { | 
 |  |  | 
| DWORD   remx; | UINT    remx; | 
| DWORD   remy; | UINT    remy; | 
| BYTE    *src; | UINT8   *src; | 
| BYTE    *dst; | UINT8   *dst; | 
| BYTE    *s1, *s2; | UINT8   *s1; | 
| BYTE    bit; | UINT8   *s2; | 
| BYTE    b1, b2; | UINT8   bit; | 
|  | UINT    b1; | 
|  | UINT    b2; | 
 | int             align; | int             align; | 
 | int             c; | int             c; | 
 |  |  | 
| Line 521  static void fontmng_setpat(FNTMNG fhdl, | Line 349  static void fontmng_setpat(FNTMNG fhdl, | 
 | goto fmsp_end; | goto fmsp_end; | 
 | } | } | 
 |  |  | 
| dst = (BYTE *)(fdat + 1); | dst = (UINT8 *)(fdat + 1); | 
 | align *= -1; | align *= -1; | 
 |  |  | 
 | if (fhdl->fonttype & FDAT_ALIAS) { | if (fhdl->fonttype & FDAT_ALIAS) { | 
| Line 553  static void fontmng_setpat(FNTMNG fhdl, | Line 381  static void fontmng_setpat(FNTMNG fhdl, | 
 | c += (FDAT_DEPTH - TEXTALPHABASE); | c += (FDAT_DEPTH - TEXTALPHABASE); | 
 | } | } | 
 | if (c) { | if (c) { | 
| *dst++ = (BYTE)(TEXTALPHABASE + (c / 4)); | *dst++ = (UINT8)(TEXTALPHABASE + (c / 4)); | 
 | } | } | 
 | else { | else { | 
 | *dst++ = 0; | *dst++ = 0; | 
| Line 586  fmsp_end: | Line 414  fmsp_end: | 
 | return; | return; | 
 | } | } | 
 |  |  | 
| FNTDAT fontmng_get(void *hdl, const char *string) { | FNTDAT fontmng_get(void *hdl, const OEMCHAR *string) { | 
 |  |  | 
 | FNTMNG  fhdl; | FNTMNG  fhdl; | 
 | FNTDAT  fdat; | FNTDAT  fdat; | 
| Line 599  FNTDAT fontmng_get(void *hdl, const char | Line 427  FNTDAT fontmng_get(void *hdl, const char | 
 | #if defined(FONTMNG_CACHE) | #if defined(FONTMNG_CACHE) | 
 | { | { | 
 | FNTCTBL *fct; | FNTCTBL *fct; | 
| DWORD   str; | UINT    str; | 
| DWORD   pos; | UINT    pos; | 
| DWORD   prev; | UINT    prev; | 
| DWORD   cnt; | UINT    cnt; | 
|  |  | 
| str = string[0] & 0xff; | #if defined(OSLANG_SJIS) || defined(OSLANG_UTF8) | 
| str |= (string[1] & 0xff) << 8; | int len; | 
|  | len = milstr_charsize(string); | 
|  | str = (UINT8)string[0]; | 
|  | if (len >= 2) { | 
|  | str |= ((UINT8)string[1]) << 8; | 
|  | } | 
|  | if (len >= 3) { | 
|  | str |= ((UINT8)string[2]) << 16; | 
|  | } | 
|  | if (len >= 4) { | 
|  | str |= ((UINT8)string[3]) << 24; | 
|  | } | 
|  | #else | 
|  | str = (UINT)string[0]; | 
|  | #endif | 
 |  |  | 
 | fct = fhdl->cache; | fct = fhdl->cache; | 
 | cnt = fhdl->caches; | cnt = fhdl->caches; | 
| Line 619  FNTDAT fontmng_get(void *hdl, const char | Line 461  FNTDAT fontmng_get(void *hdl, const char | 
 | } | } | 
 | if (prev < FONTMNG_CACHE) { | if (prev < FONTMNG_CACHE) { | 
 | fct[prev].next = fct[pos].next; | fct[prev].next = fct[pos].next; | 
| fct[pos].next = (UINT16)fhdl->cachehead; | fct[pos].next = fhdl->cachehead; | 
 | fhdl->cachehead = pos; | fhdl->cachehead = pos; | 
 | } | } | 
| return((FNTDAT)(((BYTE *)(fhdl + 1)) + (pos * fhdl->fontalign))); | return((FNTDAT)(((UINT8 *)(fhdl + 1)) + (pos * fhdl->fontalign))); | 
 | } | } | 
 | if (fhdl->caches < FONTMNG_CACHE) { | if (fhdl->caches < FONTMNG_CACHE) { | 
 | prev = fhdl->caches; | prev = fhdl->caches; | 
 | fhdl->caches++; | fhdl->caches++; | 
 | } | } | 
| fct[prev].str = (UINT16)str; | fct[prev].str = str; | 
| fct[prev].next = (UINT16)fhdl->cachehead; | fct[prev].next = fhdl->cachehead; | 
 | fhdl->cachehead = prev; | fhdl->cachehead = prev; | 
| fdat = (FNTDAT)(((BYTE *)(fhdl + 1)) + (prev * fhdl->fontalign)); | fdat = (FNTDAT)(((UINT8 *)(fhdl + 1)) + (prev * fhdl->fontalign)); | 
 | } | } | 
 | #else | #else | 
 | fdat = (FNTDAT)(fhdl + 1); | fdat = (FNTDAT)(fhdl + 1); | 
 | #endif | #endif | 
 |  |  | 
| fontmng_getchar(fhdl, fdat, string); | #if defined(UNICODE) && defined(OSLANG_UTF8) | 
|  | UINT16 unistr[2]; | 
|  | codecnv_utf8toucs2(unistr, NELEMENTS(unistr), string, (UINT)-1); | 
|  | fontmng_getchar(fhdl, fdat, unistr, 1); | 
|  | #else | 
|  | fontmng_getchar(fhdl, fdat, string, milstr_charsize(string)); | 
|  | #endif | 
 | fontmng_setpat(fhdl, fdat); | fontmng_setpat(fhdl, fdat); | 
 | return(fdat); | return(fdat); | 
 |  |  |