|
|
| version 1.3, 2003/12/01 21:15:13 | version 1.7, 2005/02/11 21:17:23 |
|---|---|
| Line 6 | Line 6 |
| #if defined(FONTMNG_CACHE) | #if defined(FONTMNG_CACHE) |
| typedef struct { | typedef struct { |
| WORD str; | UINT str; |
| WORD next; | UINT next; |
| } FNTCTBL; | } FNTCTBL; |
| #endif | #endif |
| Line 21 typedef struct { | Line 21 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 29 typedef struct { | Line 29 typedef struct { |
| int bmpalign; | int bmpalign; |
| #if defined(FONTMNG_CACHE) | #if defined(FONTMNG_CACHE) |
| DWORD caches; | UINT caches; |
| DWORD cachehead; | UINT cachehead; |
| FNTCTBL cache[FONTMNG_CACHE]; | FNTCTBL cache[FONTMNG_CACHE]; |
| #endif | #endif |
| } _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 | #ifndef _WIN32_WCE |
| #define TEXTALPHABASE (FDAT_DEPTH * 0x60 / 256) | #define TEXTALPHABASE (FDAT_DEPTH * 0x60 / 256) |
| Line 128 void *fontmng_create(int size, UINT type | Line 128 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 201 void fontmng_destroy(void *hdl) { | Line 201 void fontmng_destroy(void *hdl) { |
| } | } |
| } | } |
| int fontmng_getpoint(void *hdl) { | |
| if (hdl) { | // ---- |
| } | |
| return(0); | |
| } | |
| #ifdef _WIN32_WCE | #ifdef UNICODE |
| static void getlength1(FNTMNG fhdl, FNTDAT fdat, LPCTSTR string, | static void getlength1(FNTMNG fhdl, FNTDAT fdat, LPCTSTR string, |
| int tleng, int length) { | int tleng, int length) { |
| Line 223 static void getlength1(FNTMNG fhdl, FNTD | Line 219 static void getlength1(FNTMNG fhdl, FNTD |
| fdat->height = fhdl->bmpheight >> 1; | fdat->height = fhdl->bmpheight >> 1; |
| } | } |
| else { | else { |
| #if 1 // PocketPCのみ戻り値が変らしい? | |
| fdat->width = min(fntsize.cx, fhdl->bmpwidth); | |
| #else | |
| fdat->width = min(fntsize.cx + 1, fhdl->bmpwidth); | fdat->width = min(fntsize.cx + 1, fhdl->bmpwidth); |
| #endif | |
| fdat->pitch = min(fntsize.cx, fhdl->bmpwidth); | fdat->pitch = min(fntsize.cx, fhdl->bmpwidth); |
| fdat->height = fhdl->bmpheight; | fdat->height = fhdl->bmpheight; |
| } | } |
| Line 501 fmgds_exit: | Line 501 fmgds_exit: |
| 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 517 static void fontmng_setpat(FNTMNG fhdl, | Line 519 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 549 static void fontmng_setpat(FNTMNG fhdl, | Line 551 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 582 fmsp_end: | Line 584 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 595 FNTDAT fontmng_get(void *hdl, const char | Line 597 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; |
| #if defined(OSLANG_SJIS) || defined(OSLANG_SJIS) | |
| int len; | |
| len = milstr_charsize(string); | |
| switch(len) { | |
| default: | |
| str = (UINT8)string[0]; | |
| break; | |
| case 2: | |
| str = (UINT8)string[0] + (((UINT8)string[1]) << 8); | |
| break; | |
| case 3: | |
| str = (UINT8)string[0] + (((UINT8)string[1]) << 8) + (((UINT8)string[2]) << 16); | |
| break; | |
| str = string[0] & 0xff; | case 4: |
| str |= (string[1] & 0xff) << 8; | str = (UINT8)string[0] + (((UINT8)string[1]) << 8) + (((UINT8)string[2]) << 16) + (((UINT8)string[2]) << 24); |
| break; | |
| } | |
| #else | |
| str = (UINT)string[0]; | |
| #endif | |
| fct = fhdl->cache; | fct = fhdl->cache; |
| cnt = fhdl->caches; | cnt = fhdl->caches; |
| Line 615 FNTDAT fontmng_get(void *hdl, const char | Line 638 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 = (WORD)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 = (WORD)str; | fct[prev].str = str; |
| fct[prev].next = (WORD)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); |