| version 1.1, 2004/08/01 05:31:30 | version 1.4, 2008/06/02 20:07:31 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        "parts.h" | #include        "parts.h" | 
 | #include        "dosio.h" | #include        "dosio.h" | 
 |  | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | 
 |  | #include        "oemtext.h" | 
 |  | #endif | 
 | #include        "fontmng.h" | #include        "fontmng.h" | 
 | #include        "font.h" | #include        "font.h" | 
 | #include        "fontdata.h" | #include        "fontdata.h" | 
| Line 13  typedef struct { | Line 16  typedef struct { | 
 | } JISPAIR; | } JISPAIR; | 
 |  |  | 
 | static const UINT8 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, | 
 | 0x54, 0x5f, 0, | 0x54, 0x5f, 0, | 
| Line 134  const UINT8 *p; | Line 137  const UINT8 *p; | 
 | int             height; | int             height; | 
 | UINT8   bit; | UINT8   bit; | 
 | int             i; | int             i; | 
 |  | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | 
 |  | OEMCHAR oemwork[4]; | 
 |  | #endif | 
 |  |  | 
 | ptr += from * 16; | ptr += from * 16; | 
 | work[1] = '\0'; | work[1] = '\0'; | 
 | while(from < to) { | while(from < to) { | 
 | work[0] = (char)from; | work[0] = (char)from; | 
 |  | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | 
 |  | oemtext_sjis2oem(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); | 
| Line 176  static void setjis(UINT8 *ptr, void *fnt | Line 187  static void setjis(UINT8 *ptr, void *fnt | 
 | const UINT8     *p; | const UINT8     *p; | 
 | UINT    bit; | UINT    bit; | 
 | int             i; | int             i; | 
 |  | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | 
 |  | OEMCHAR oemwork[4]; | 
 |  | #endif | 
 |  |  | 
 | work[2] = '\0'; | work[2] = '\0'; | 
 | for (h=0x21; h<0x7f; h++) { | for (h=0x21; h<0x7f; h++) { | 
| Line 200  const UINT8 *p; | Line 214  const UINT8 *p; | 
 | sjis = jis2sjis(jis); | sjis = jis2sjis(jis); | 
 | work[0] = (char)(sjis >> 8); | work[0] = (char)(sjis >> 8); | 
 | work[1] = (char)sjis; | work[1] = (char)sjis; | 
 |  | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | 
 |  | oemtext_sjis2oem(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); | 
| Line 238  void makex1font(REG8 loading) { | Line 257  void makex1font(REG8 loading) { | 
 | if (work == NULL) { | if (work == NULL) { | 
 | goto mfnt_err2; | goto mfnt_err2; | 
 | } | } | 
| ZeroMemory(work, 0x1000); | if (loading & FONTLOAD_ANK) { | 
| setank(work, fnt, 0x20, 0x7f); | ZeroMemory(work, 0x1000); | 
| setank(work, fnt, 0xa1, 0xe0); | setank(work, fnt, 0x20, 0x7f); | 
| CopyMemory(work + 0x000, defrom_txt, 0x200); | setank(work, fnt, 0xa1, 0xe0); | 
| CopyMemory(work + 0x7f0, defrom_txt + 0x200, 0x210); | CopyMemory(work + 0x000, defrom_txt, 0x200); | 
| CopyMemory(work + 0xe00, defrom_txt + 0x410, 0x200); | CopyMemory(work + 0x7f0, defrom_txt + 0x200, 0x210); | 
| fh = file_create_c(x1ank2tmp); | CopyMemory(work + 0xe00, defrom_txt + 0x410, 0x200); | 
| if (fh != FILEH_INVALID) { | fh = file_create_c(x1ank2tmp); | 
| file_write(fh, work, 0x1000); | if (fh != FILEH_INVALID) { | 
| file_close(fh); | file_write(fh, work, 0x1000); | 
|  | file_close(fh); | 
|  | } | 
 | } | } | 
|  | if (loading & (FONT_KNJ1 | FONT_KNJ2)) { | 
| ZeroMemory(work, 306176); | ZeroMemory(work, 306176); | 
| setjis(work, fnt); | setjis(work, fnt); | 
| fh = file_create_c(x1knjtmp); | fh = file_create_c(x1knjtmp); | 
| if (fh != FILEH_INVALID) { | if (fh != FILEH_INVALID) { | 
| file_write(fh, work, 306176); | file_write(fh, work, 306176); | 
| file_close(fh); | file_close(fh); | 
|  | } | 
 | } | } | 
 | _MFREE(work); | _MFREE(work); | 
 |  |  |