|
|
| version 1.2, 2003/10/21 11:22:05 | version 1.7, 2005/04/01 15:06:30 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "bmpdata.h" | #include "bmpdata.h" |
| #include "parts.h" | #include "parts.h" |
| #if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| #include "oemtext.h" | |
| #endif | |
| #include "dosio.h" | #include "dosio.h" |
| #include "fontmng.h" | #include "fontmng.h" |
| #include "font.h" | #include "font.h" |
| Line 14 typedef struct { | Line 17 typedef struct { |
| } JISPAIR; | } JISPAIR; |
| static const BMPDATA fntinf = {2048, 2048, 1}; | static const BMPDATA fntinf = {2048, 2048, 1}; |
| static const BYTE fntpal[8] = {0x00,0x00,0x00,0x00, 0xff,0xff,0xff,0x00}; | static const UINT8 fntpal[8] = {0x00,0x00,0x00,0x00, 0xff,0xff,0xff,0x00}; |
| static const BYTE deltable[] = { | static const UINT8 deltable[] = { |
| // del del del del del | // del del del del del |
| 0x0f, 0x5f, 0, | 0x0f, 0x5f, 0, |
| 0x01, 0x10, 0x1a, 0x21, 0x3b, 0x41, 0x5b, 0x5f, 0, | 0x01, 0x10, 0x1a, 0x21, 0x3b, 0x41, 0x5b, 0x5f, 0, |
| Line 53 static UINT16 cnvjis(UINT16 jis, const J | Line 56 static UINT16 cnvjis(UINT16 jis, const J |
| const JISPAIR *tblterm; | const JISPAIR *tblterm; |
| tblterm = (JISPAIR *)(((BYTE *)tbl) + tblsize); | tblterm = (JISPAIR *)(((UINT8 *)tbl) + tblsize); |
| while(tbl < tblterm) { | while(tbl < tblterm) { |
| if (jis == tbl->jis1) { | if (jis == tbl->jis1) { |
| return(tbl->jis2); | return(tbl->jis2); |
| Line 68 const JISPAIR *tblterm; | Line 71 const JISPAIR *tblterm; |
| static BOOL ispc98jis(UINT16 jis) { | static BOOL ispc98jis(UINT16 jis) { |
| const BYTE *p; | const UINT8 *p; |
| UINT tmp; | UINT tmp; |
| switch(jis >> 8) { | switch(jis >> 8) { |
| Line 128 const BYTE *p; | Line 131 const BYTE *p; |
| return(TRUE); | return(TRUE); |
| } | } |
| static void setank(BYTE *ptr, void *fnt, UINT from, UINT to) { | static void setank(UINT8 *ptr, void *fnt, UINT from, UINT to) { |
| char work[2]; | char work[2]; |
| FNTDAT dat; | FNTDAT dat; |
| const BYTE *p; | const UINT8 *p; |
| BYTE *q; | UINT8 *q; |
| int width; | int width; |
| int height; | int height; |
| BYTE bit; | UINT8 bit; |
| int i; | int i; |
| #if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| OEMCHAR oemwork[4]; | |
| #endif | |
| ptr += (2048 * (2048 / 8)) + from; | ptr += (2048 * (2048 / 8)) + from; |
| work[1] = '\0'; | work[1] = '\0'; |
| while(from < to) { | while(from < to) { |
| work[0] = (char)from; | work[0] = (char)from; |
| #if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| oemtext_sjistooem(oemwork, NELEMENTS(oemwork), work, -1); | |
| dat = fontmng_get(fnt, oemwork); | |
| #else | |
| dat = fontmng_get(fnt, work); | dat = fontmng_get(fnt, work); |
| #endif | |
| if (dat) { | if (dat) { |
| width = min(dat->width, 8); | width = min(dat->width, 8); |
| height = min(dat->height, 16); | height = min(dat->height, 16); |
| p = (BYTE *)(dat + 1); | p = (UINT8 *)(dat + 1); |
| q = ptr; | q = ptr; |
| while(height > 0) { | while(height > 0) { |
| height--; | height--; |
| Line 167 const BYTE *p; | Line 178 const BYTE *p; |
| } | } |
| } | } |
| static void patchank(BYTE *ptr, const BYTE *fnt, UINT from) { | static void patchank(UINT8 *ptr, const UINT8 *fnt, UINT from) { |
| int r; | int r; |
| int y; | int y; |
| Line 184 static void patchank(BYTE *ptr, const BY | Line 195 static void patchank(BYTE *ptr, const BY |
| } while(--r); | } while(--r); |
| } | } |
| static void setjis(BYTE *ptr, void *fnt) { | static void setjis(UINT8 *ptr, void *fnt) { |
| char work[4]; | char work[4]; |
| UINT16 h; | UINT16 h; |
| Line 192 static void setjis(BYTE *ptr, void *fnt) | Line 203 static void setjis(BYTE *ptr, void *fnt) |
| UINT16 jis; | UINT16 jis; |
| UINT sjis; | UINT sjis; |
| FNTDAT dat; | FNTDAT dat; |
| const BYTE *p; | const UINT8 *p; |
| BYTE *q; | UINT8 *q; |
| int width; | int width; |
| int height; | int height; |
| UINT16 bit; | UINT16 bit; |
| int i; | int i; |
| #if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| OEMCHAR oemwork[4]; | |
| #endif | |
| work[2] = '\0'; | work[2] = '\0'; |
| ptr += ((0x80 - 0x21) * 16 * (2048 / 8)) + 2; | ptr += ((0x80 - 0x21) * 16 * (2048 / 8)) + 2; |
| Line 208 const BYTE *p; | Line 222 const BYTE *p; |
| jis = cnvjis(jis, jis7883, sizeof(jis7883)); | jis = cnvjis(jis, jis7883, sizeof(jis7883)); |
| jis = cnvjis(jis, jis8390, sizeof(jis8390)); | jis = cnvjis(jis, jis8390, sizeof(jis8390)); |
| sjis = jis2sjis(jis); | sjis = jis2sjis(jis); |
| work[0] = (BYTE)(sjis >> 8); | work[0] = (UINT8)(sjis >> 8); |
| work[1] = (BYTE)sjis; | work[1] = (UINT8)sjis; |
| #if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| oemtext_sjistooem(oemwork, NELEMENTS(oemwork), work, -1); | |
| dat = fontmng_get(fnt, oemwork); | |
| #else | |
| dat = fontmng_get(fnt, work); | dat = fontmng_get(fnt, work); |
| #endif | |
| if (dat) { | if (dat) { |
| width = min(dat->width, 16); | width = min(dat->width, 16); |
| height = min(dat->height, 16); | height = min(dat->height, 16); |
| p = (BYTE *)(dat + 1); | p = (UINT8 *)(dat + 1); |
| q = ptr; | q = ptr; |
| while(height > 0) { | while(height > 0) { |
| height--; | height--; |
| Line 225 const BYTE *p; | Line 244 const BYTE *p; |
| bit ^= (0x8000 >> i); | bit ^= (0x8000 >> i); |
| } | } |
| } | } |
| q[0] = (BYTE)(bit >> 8); | q[0] = (UINT8)(bit >> 8); |
| q[1] = (BYTE)bit; | q[1] = (UINT8)bit; |
| p += dat->width; | p += dat->width; |
| } | } |
| } | } |
| Line 237 const BYTE *p; | Line 256 const BYTE *p; |
| } | } |
| } | } |
| static void patchextank(BYTE *ptr, const BYTE *fnt, UINT pos) { | static void patchextank(UINT8 *ptr, const UINT8 *fnt, UINT pos) { |
| UINT r; | UINT r; |
| Line 249 static void patchextank(BYTE *ptr, const | Line 268 static void patchextank(BYTE *ptr, const |
| } while(--r); | } while(--r); |
| } | } |
| static void patchextfnt(BYTE *ptr, const BYTE *fnt) { // 2c24-2c6f | static void patchextfnt(UINT8 *ptr, const UINT8 *fnt) { // 2c24-2c6f |
| UINT r; | UINT r; |
| Line 257 static void patchextfnt(BYTE *ptr, const | Line 276 static void patchextfnt(BYTE *ptr, const |
| r = 0x4c * 16; | r = 0x4c * 16; |
| do { | do { |
| ptr -= (2048 / 8); | ptr -= (2048 / 8); |
| ptr[0] = (BYTE)(~fnt[0]); | ptr[0] = (UINT8)(~fnt[0]); |
| ptr[1] = (BYTE)(~fnt[1]); | ptr[1] = (UINT8)(~fnt[1]); |
| fnt += 2; | fnt += 2; |
| } while(--r); | } while(--r); |
| } | } |
| void makepc98bmp(const char *filename) { | void makepc98bmp(const OEMCHAR *filename) { |
| void *fnt; | void *fnt; |
| BMPFILE bf; | BMPFILE bf; |
| UINT size; | UINT size; |
| BMPINFO bi; | BMPINFO bi; |
| BYTE *ptr; | UINT8 *ptr; |
| FILEH fh; | FILEH fh; |
| BOOL r; | BOOL r; |
| Line 279 void makepc98bmp(const char *filename) { | Line 298 void makepc98bmp(const char *filename) { |
| } | } |
| size = bmpdata_setinfo(&bi, &fntinf); | size = bmpdata_setinfo(&bi, &fntinf); |
| bmpdata_sethead(&bf, &bi); | bmpdata_sethead(&bf, &bi); |
| ptr = (BYTE *)_MALLOC(size, filename); | ptr = (UINT8 *)_MALLOC(size, filename); |
| if (ptr == NULL) { | if (ptr == NULL) { |
| goto mfnt_err2; | goto mfnt_err2; |
| } | } |
| FillMemory(ptr, size, 0xff); | FillMemory(ptr, size, 0xff); |
| setank(ptr, fnt, 0x20, 0x80); | setank(ptr, fnt, 0x20, 0x7f); |
| setank(ptr, fnt, 0xa1, 0xe0); | setank(ptr, fnt, 0xa1, 0xe0); |
| patchank(ptr, fontdata_16 + 0*32*16, 0x00); | patchank(ptr, fontdata_16 + 0*32*16, 0x00); |
| patchank(ptr, fontdata_16 + 1*32*16, 0x80); | patchank(ptr, fontdata_16 + 1*32*16, 0x80); |