--- np2/font/fontmake.c 2003/10/16 17:58:37 1.1.1.1 +++ np2/font/fontmake.c 2005/04/01 15:06:30 1.7 @@ -1,9 +1,11 @@ #include "compiler.h" #include "bmpdata.h" #include "parts.h" +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) +#include "oemtext.h" +#endif #include "dosio.h" #include "fontmng.h" -#include "memory.h" #include "font.h" #include "fontdata.h" #include "fontmake.h" @@ -15,9 +17,9 @@ typedef struct { } JISPAIR; 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 0x0f, 0x5f, 0, 0x01, 0x10, 0x1a, 0x21, 0x3b, 0x41, 0x5b, 0x5f, 0, @@ -54,7 +56,7 @@ static UINT16 cnvjis(UINT16 jis, const J const JISPAIR *tblterm; - tblterm = (JISPAIR *)(((BYTE *)tbl) + tblsize); + tblterm = (JISPAIR *)(((UINT8 *)tbl) + tblsize); while(tbl < tblterm) { if (jis == tbl->jis1) { return(tbl->jis2); @@ -69,7 +71,7 @@ const JISPAIR *tblterm; static BOOL ispc98jis(UINT16 jis) { -const BYTE *p; +const UINT8 *p; UINT tmp; switch(jis >> 8) { @@ -129,26 +131,34 @@ const BYTE *p; 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]; FNTDAT dat; -const BYTE *p; - BYTE *q; +const UINT8 *p; + UINT8 *q; int width; int height; - BYTE bit; + UINT8 bit; int i; +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + OEMCHAR oemwork[4]; +#endif ptr += (2048 * (2048 / 8)) + from; work[1] = '\0'; while(from < to) { 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); +#endif if (dat) { width = min(dat->width, 8); height = min(dat->height, 16); - p = (BYTE *)(dat + 1); + p = (UINT8 *)(dat + 1); q = ptr; while(height > 0) { height--; @@ -168,7 +178,7 @@ 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 y; @@ -185,7 +195,7 @@ static void patchank(BYTE *ptr, const BY } while(--r); } -static void setjis(BYTE *ptr, void *fnt) { +static void setjis(UINT8 *ptr, void *fnt) { char work[4]; UINT16 h; @@ -193,12 +203,15 @@ static void setjis(BYTE *ptr, void *fnt) UINT16 jis; UINT sjis; FNTDAT dat; -const BYTE *p; - BYTE *q; +const UINT8 *p; + UINT8 *q; int width; int height; UINT16 bit; int i; +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) || defined(OSLANG_UCS2) + OEMCHAR oemwork[4]; +#endif work[2] = '\0'; ptr += ((0x80 - 0x21) * 16 * (2048 / 8)) + 2; @@ -209,13 +222,18 @@ const BYTE *p; jis = cnvjis(jis, jis7883, sizeof(jis7883)); jis = cnvjis(jis, jis8390, sizeof(jis8390)); sjis = jis2sjis(jis); - work[0] = (BYTE)(sjis >> 8); - work[1] = (BYTE)sjis; + work[0] = (UINT8)(sjis >> 8); + 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); +#endif if (dat) { width = min(dat->width, 16); height = min(dat->height, 16); - p = (BYTE *)(dat + 1); + p = (UINT8 *)(dat + 1); q = ptr; while(height > 0) { height--; @@ -226,8 +244,8 @@ const BYTE *p; bit ^= (0x8000 >> i); } } - q[0] = (BYTE)(bit >> 8); - q[1] = (BYTE)bit; + q[0] = (UINT8)(bit >> 8); + q[1] = (UINT8)bit; p += dat->width; } } @@ -238,7 +256,7 @@ 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; @@ -250,7 +268,7 @@ static void patchextank(BYTE *ptr, const } while(--r); } -static void patchextfnt(BYTE *ptr, const BYTE *fnt) { // 2c24-2c6f +static void patchextfnt(UINT8 *ptr, const UINT8 *fnt) { // 2c24-2c6f UINT r; @@ -258,19 +276,19 @@ static void patchextfnt(BYTE *ptr, const r = 0x4c * 16; do { ptr -= (2048 / 8); - ptr[0] = (BYTE)(~fnt[0]); - ptr[1] = (BYTE)(~fnt[1]); + ptr[0] = (UINT8)(~fnt[0]); + ptr[1] = (UINT8)(~fnt[1]); fnt += 2; } while(--r); } -void makepc98bmp(const char *filename) { +void makepc98bmp(const OEMCHAR *filename) { void *fnt; BMPFILE bf; UINT size; BMPINFO bi; - BYTE *ptr; + UINT8 *ptr; FILEH fh; BOOL r; @@ -280,12 +298,12 @@ void makepc98bmp(const char *filename) { } size = bmpdata_setinfo(&bi, &fntinf); bmpdata_sethead(&bf, &bi); - ptr = (BYTE *)_MALLOC(size, filename); + ptr = (UINT8 *)_MALLOC(size, filename); if (ptr == NULL) { goto mfnt_err2; } FillMemory(ptr, size, 0xff); - setank(ptr, fnt, 0x20, 0x80); + setank(ptr, fnt, 0x20, 0x7f); setank(ptr, fnt, 0xa1, 0xe0); patchank(ptr, fontdata_16 + 0*32*16, 0x00); patchank(ptr, fontdata_16 + 1*32*16, 0x80);