|
|
| version 1.4, 2005/02/11 21:17:22 | version 1.5, 2005/02/13 05:31:26 |
|---|---|
| Line 220 static void getlength1(FNTMNG fhdl, FNTD | Line 220 static void getlength1(FNTMNG fhdl, FNTD |
| SDL_Surface *text; | SDL_Surface *text; |
| if (fhdl->fonttype & FDAT_PROPORTIONAL) { | if (fhdl->fonttype & FDAT_PROPORTIONAL) { |
| codecnv_sjis2utf(utext, 2, string, length); | codecnv_euctoucs2(utext, NELEMENTS(utext), string, length); |
| text = TTF_RenderUNICODE_Solid(fhdl->ttf_font, utext, white); | text = TTF_RenderUNICODE_Solid(fhdl->ttf_font, utext, white); |
| setfdathead(fhdl, fdat, length, text); | setfdathead(fhdl, fdat, length, text); |
| if (text) { | if (text) { |
| Line 262 static void getfont1(FNTMNG fhdl, FNTDAT | Line 262 static void getfont1(FNTMNG fhdl, FNTDAT |
| int y; | int y; |
| int depth; | int depth; |
| codecnv_sjis2utf(utext, 2, string, length); | codecnv_euctoucs2(utext, NELEMENTS(utext), string, length); |
| text = TTF_RenderUNICODE_Solid(fhdl->ttf_font, utext, white); | text = TTF_RenderUNICODE_Solid(fhdl->ttf_font, utext, white); |
| setfdathead(fhdl, fdat, length, text); | setfdathead(fhdl, fdat, length, text); |
| dst = (UINT8 *)(fdat + 1); | dst = (UINT8 *)(fdat + 1); |
| Line 292 static void getfont1(FNTMNG fhdl, FNTDAT | Line 292 static void getfont1(FNTMNG fhdl, FNTDAT |
| } | } |
| } | } |
| BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { |
| FNTMNG fhdl; | |
| char buf[4]; | |
| _FNTDAT fdat; | |
| int width; | int width; |
| int leng; | int leng; |
| _FNTDAT fdat; | |
| if ((hdl == NULL) || (string == NULL)) { | if ((hdl == NULL) || (string == NULL)) { |
| goto fmgs_exit; | goto fmgs_exit; |
| } | } |
| fhdl = (FNTMNG)hdl; | |
| width = 0; | width = 0; |
| buf[2] = '\0'; | |
| while(1) { | while(1) { |
| buf[0] = *string++; | leng = milstr_charsize(string); |
| if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { | if (!leng) { |
| buf[1] = *string++; | |
| if (buf[1] == '\0') { | |
| break; | |
| } | |
| leng = 2; | |
| } | |
| else if (buf[0]) { | |
| buf[1] = '\0'; | |
| leng = 1; | |
| } | |
| else { | |
| break; | break; |
| } | } |
| getlength1(fhdl, &fdat, buf, leng); | getlength1((FNTMNG)hdl, &fdat, string, leng); |
| string += leng; | |
| width += fdat.pitch; | width += fdat.pitch; |
| } | } |
| if (pt) { | if (pt) { |
| pt->x = width; | pt->x = width; |
| pt->y = fhdl->fontsize; | pt->y = ((FNTMNG)hdl)->fontsize; |
| } | } |
| return(SUCCESS); | return(SUCCESS); |
| Line 336 fmgs_exit: | Line 323 fmgs_exit: |
| return(FAILURE); | return(FAILURE); |
| } | } |
| BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { |
| FNTMNG fhdl; | |
| char buf[4]; | |
| _FNTDAT fdat; | |
| int width; | int width; |
| int leng; | |
| int posx; | int posx; |
| int leng; | |
| _FNTDAT fdat; | |
| if ((hdl == NULL) || (string == NULL)) { | if ((hdl == NULL) || (string == NULL)) { |
| goto fmgds_exit; | goto fmgds_exit; |
| } | } |
| fhdl = (FNTMNG)hdl; | |
| width = 0; | width = 0; |
| posx = 0; | posx = 0; |
| buf[2] = '\0'; | |
| while(1) { | while(1) { |
| buf[0] = *string++; | leng = milstr_charsize(string); |
| if ((((buf[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) { | if (!leng) { |
| buf[1] = *string++; | |
| if (buf[1] == '\0') { | |
| break; | |
| } | |
| leng = 2; | |
| } | |
| else if (buf[0]) { | |
| buf[1] = '\0'; | |
| leng = 1; | |
| } | |
| else { | |
| break; | break; |
| } | } |
| getlength1(fhdl, &fdat, buf, leng); | getlength1((FNTMNG)hdl, &fdat, string, leng); |
| string += leng; | |
| width = posx + max(fdat.width, fdat.pitch); | width = posx + max(fdat.width, fdat.pitch); |
| posx += fdat.pitch; | posx += fdat.pitch; |
| } | } |
| if (pt) { | if (pt) { |
| pt->x = width; | pt->x = width; |
| pt->y = fhdl->fontsize; | pt->y = ((FNTMNG)hdl)->fontsize; |
| } | } |
| return(SUCCESS); | return(SUCCESS); |
| Line 402 FNTDAT fontmng_get(void *hdl, const char | Line 375 FNTDAT fontmng_get(void *hdl, const char |
| fdat = (FNTDAT)(fhdl + 1); | fdat = (FNTDAT)(fhdl + 1); |
| #endif | #endif |
| leng = 1; | leng = milstr_charsize(string); |
| if (((((string[0] ^ 0x20) - 0xa1) & 0xff) < 0x3c) && | |
| (string[1] != '\0')) { | |
| leng = 2; | |
| } | |
| getfont1(fhdl, fdat, string, leng); | getfont1(fhdl, fdat, string, leng); |
| return(fdat); | return(fdat); |
| Line 526 const UINT8 *src; | Line 495 const UINT8 *src; |
| } | } |
| } | } |
| BOOL fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getsize(void *hdl, const char *string, POINT_T *pt) { |
| FNTMNG fhdl; | FNTMNG fhdl; |
| char buf[4]; | char buf[4]; |
| Line 570 fmgs_exit: | Line 539 fmgs_exit: |
| return(FAILURE); | return(FAILURE); |
| } | } |
| BOOL fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { | BRESULT fontmng_getdrawsize(void *hdl, const char *string, POINT_T *pt) { |
| FNTMNG fhdl; | FNTMNG fhdl; |
| char buf[4]; | char buf[4]; |