|
|
| version 1.1, 2003/10/16 17:58:37 | version 1.4, 2005/02/07 14:46:10 |
|---|---|
| Line 3 | Line 3 |
| #include "parts.h" | #include "parts.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "fontmng.h" | #include "fontmng.h" |
| #include "memory.h" | |
| #include "font.h" | #include "font.h" |
| #include "fontdata.h" | #include "fontdata.h" |
| #include "fontmake.h" | #include "fontmake.h" |
| Line 15 typedef struct { | Line 14 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 54 static UINT16 cnvjis(UINT16 jis, const J | Line 53 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 69 const JISPAIR *tblterm; | Line 68 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 129 const BYTE *p; | Line 128 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; |
| ptr += (2048 * (2048 / 8)) + from; | ptr += (2048 * (2048 / 8)) + from; |
| Line 148 const BYTE *p; | Line 147 const BYTE *p; |
| 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 168 const BYTE *p; | Line 167 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 185 static void patchank(BYTE *ptr, const BY | Line 184 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 193 static void setjis(BYTE *ptr, void *fnt) | Line 192 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; |
| Line 209 const BYTE *p; | Line 208 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; |
| dat = fontmng_get(fnt, work); | dat = fontmng_get(fnt, work); |
| 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 226 const BYTE *p; | Line 225 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 238 const BYTE *p; | Line 237 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 250 static void patchextank(BYTE *ptr, const | Line 249 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 258 static void patchextfnt(BYTE *ptr, const | Line 257 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); |
| } | } |
| Line 270 void makepc98bmp(const char *filename) { | Line 269 void makepc98bmp(const char *filename) { |
| 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 280 void makepc98bmp(const char *filename) { | Line 279 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); |