udvips-5.94a-p1.6.patch teTeX-2.0.2 中の dvipsk-5.92b に、アスキー(株) による日本語サポートパッチ dvipsk-5.92b-p1.6.patch をあてた後でこのパッチをあてて下さい。 udvips において、255 以下のコードの和文フォントの扱いが、より完全に なると共に、dvips, odvips も幾つかのバグがフィックスされ、バージョンが 5.94a なる最新版になります。 オリジナルのアスキーパッチでは、使用していない欧文フォントの定義が出力 されることがありましたが、この不具合が無いように訂正してあります。 2004/06/13 Bug fix. 2003/07/23 Bug fix. 2003/06/16 A. Kakuto diff -Nur dvipsk-askii/afm2tfm.c dvipsk/afm2tfm.c --- dvipsk-askii/afm2tfm.c Tue May 20 20:16:54 2003 +++ dvipsk/afm2tfm.c Sun Jun 13 16:56:45 2004 @@ -208,7 +208,7 @@ FILE *afmin, *vplout, *tfmout ; char inname[200], outname[200] ; /* names of input and output files */ char tmpstr[200] ; /* a buffer for one string */ -#define INBUFSIZE 1014 +#define INBUFSIZE 1024 char buffer[INBUFSIZE+10]; /* input buffer (modified while parsing) */ char obuffer[INBUFSIZE+10] ; /* unmodified copy of input buffer */ char *param ; /* current position in input buffer */ @@ -1483,7 +1483,7 @@ void version P1C(FILE *, f) { extern KPSEDLL char *kpathsea_version_string; - fputs ("afm2tfm(k) (dvips(k) 5.92b) 8.1\n", f); + fputs ("afm2tfm(k) (dvips(k) 5.94a) 8.1\n", f); fprintf (f, "%s\n", kpathsea_version_string); fputs ("Copyright (C) 2002 Radical Eye Software.\n\ There is NO warranty. You may redistribute this software\n\ diff -Nur dvipsk-askii/bbox.c dvipsk/bbox.c --- dvipsk-askii/bbox.c Tue May 20 20:16:54 2003 +++ dvipsk/bbox.c Sun Jun 13 16:51:36 2004 @@ -60,7 +60,11 @@ #ifdef Omega register integer i, j ; #else +#ifdef UDVIPS + register integer i ; +#else register shalfword i ; +#endif shalfword id, nt,lf ; #endif register integer li ; diff -Nur dvipsk-askii/dospecial.c dvipsk/dospecial.c --- dvipsk-askii/dospecial.c Tue May 20 20:16:54 2003 +++ dvipsk/dospecial.c Sun Jun 13 16:51:36 2004 @@ -844,8 +844,15 @@ if (!psfile[0] && maccess(KeyStr)==0) /* yes we can read it */ (void)strcpy(psfile,KeyStr) ; else { - sprintf(errbuf, "Unknown keyword (%s) in \\special will be ignored", + if (strlen(KeyStr) < 40) { + sprintf(errbuf, + "Unknown keyword (%s) in \\special will be ignored", KeyStr) ; + } else { + sprintf(errbuf, + "Unknown keyword (%.40s...) in \\special will be ignored", + KeyStr) ; + } specerror(errbuf) ; } break ; diff -Nur dvipsk-askii/download.c dvipsk/download.c --- dvipsk-askii/download.c Tue May 20 20:16:54 2003 +++ dvipsk/download.c Sun Jun 13 16:58:12 2004 @@ -226,10 +226,15 @@ for (b=0; b<16; b++) if(p->bitmap[b] !=0) non_empty =1; -/* - if(non_empty==0) + +#ifndef Omega + if(non_empty==0 && curfnt->iswide == 0) return; -*/ +#else + if(non_empty==0 && curfnt->iswide == 0 && curfnt->codewidth != 2) + return; +#endif + cmdout(name) ; /* following code re-arranged - Rob Hutchings 1992Apr02 */ c = curfnt->chardesc + 255 ; diff -Nur dvipsk-askii/dvips.c dvipsk/dvips.c --- dvipsk-askii/dvips.c Tue May 20 20:16:54 2003 +++ dvipsk/dvips.c Sun Jun 13 16:51:36 2004 @@ -646,12 +646,12 @@ } else if (strcmp (argv[1], "--version") == 0) { extern KPSEDLL char *kpathsea_version_string; #ifdef Omega - puts ("odvips(k) 5.92b"); + puts ("odvips(k) 5.94a"); #else - puts ("dvips(k) 5.92b"); + puts ("dvips(k) 5.94a"); #endif puts (kpathsea_version_string); - puts ("Copyright (C) 2001 Radical Eye Software.\n\ + puts ("Copyright (C) 2003 Radical Eye Software.\n\ There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License\n\ and the Dvips copyright.\n\ diff -Nur dvipsk-askii/dvips.h dvipsk/dvips.h --- dvipsk-askii/dvips.h Tue May 20 20:16:54 2003 +++ dvipsk/dvips.h Sun Jun 13 17:00:25 2004 @@ -10,6 +10,8 @@ */ /* This file is the header for dvips's global data structures. */ +#define CREATIONDATE + #ifndef Omega #ifdef UDVIPS #define MAX_CODE 65536 @@ -20,13 +22,13 @@ #ifdef Omega #define BANNER \ -"This is (Omega) odvips(k) 5.92b Copyright 2002 Radical Eye Software" +"This is (Omega) odvips(k) 5.94a Copyright 2003 Radical Eye Software" #define BANNER2 "(www.radicaleye.com)" #else #define BANNER \ -"This is dvips(k) 5.92b p1.6 Copyright 2003 ASCII Corp.(www-ptex@ascii.co.jp)" +"This is dvips(k) 5.94a p1.6 Copyright 2003 ASCII Corp.(www-ptex@ascii.co.jp)" #define BANNER2 \ -"based on dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com)" +"based on dvips(k) 5.94a Copyright 2003 Radical Eye Software (www.radicaleye.com)" #define WEBURL "(www.radicaleye.com)" #endif #ifdef KPATHSEA @@ -72,11 +74,7 @@ * of a string that can be handled in specials, so it should not be * set too small. */ -#ifdef Omega #define STRINGSIZE (200000) /* maximum total chars in strings in program */ -#else -#define STRINGSIZE (50000) /* maximum total chars in strings in program */ -#endif #define RASTERCHUNK (8192) /* size of chunk of raster */ #define MINCHUNK (240) /* minimum size char to get own raster */ #define STACKSIZE (500) /* maximum stack size for dvi files */ @@ -212,6 +210,7 @@ #else chardesctype *chardesc ; #endif + int iswide ; } fontdesctype ; /* A fontmap associates a fontdesc with a font number. diff -Nur dvipsk-askii/finclude.c dvipsk/finclude.c --- dvipsk-askii/finclude.c Sun Jan 19 13:30:58 2003 +++ dvipsk/finclude.c Sun Jun 13 16:51:36 2004 @@ -134,7 +134,7 @@ int b, c, d ; int l = strlen(s) ; - if (l>0 && s[l-1]=='\n') + while (l > 0 && (s[l-1] == '\n' || s[l-1] == '\r')) s[--l] = 0 ; if (!ISXDIGIT(s[0]) || !ISXDIGIT(s[1]) || s[2]!=':' || strspn(s+3,"0123456789ABCDEFabcdef") < l-3) { diff -Nur dvipsk-askii/fontdef.c dvipsk/fontdef.c --- dvipsk-askii/fontdef.c Tue May 20 20:16:54 2003 +++ dvipsk/fontdef.c Sun Jun 13 17:01:37 2004 @@ -42,6 +42,7 @@ fp->chardesc = (chardesctype *)mymalloc(256*(integer)sizeof(chardesctype)) ; fp->codewidth = 1 ; #endif + fp->iswide = 0 ; fp->psname = 0 ; fp->loaded = 0 ; fp->checksum = cksum ; diff -Nur dvipsk-askii/output.c dvipsk/output.c --- dvipsk-askii/output.c Tue May 20 20:16:54 2003 +++ dvipsk/output.c Sun Jun 13 16:51:36 2004 @@ -264,7 +264,7 @@ else if (noprocset) {} #endif else - (void)fprintf(bitfile, "%%%%BeginProcSet: %s\n", s) ; + (void)fprintf(bitfile, "%%%%BeginProcSet: %s 0 0\n", s) ; c = getc(f) ; if (c == 0x80) { while (1) { @@ -475,8 +475,56 @@ dosepsend-- ; } } - if (c != '%') - error("! expected to see %%EndBinary at end of data") ; + if (c != '%') { + /* try to find %%EndBinary or %%EndData anywhere + in the rest of the file, and pretend it + worked; this works around various Illustrator + bugs. -tgr, 14 June 2003 */ + char *m1 = "%%EndData" ; + char *m2 = "%%EndBinary" ; + char *p1 = m1 ; + char *p2 = m2 ; + error( + " expected to see %%EndBinary at end of data; struggling on") ; + while (1) { + (void)putc(c, bitfile) ; + if (c == '\r' || c == '\n') { + if (c == '\r') { /* DOS-style text file? */ + c = getc(f); + if (c != '\n') + ungetc(c, f); + else + dosepsend-- ; + } + break ; + } + c = getc(f) ; + dosepsend-- ; + if (c == EOF) + error( + "! premature end of file in binary section") ; + /* + * By the way, this code can be fooled by things like %%%EndBinary + * or even %%EndBi%%EndBinary, but this isn't valid DSC anyway. + * This comment is mainly here to prevent anyone else from emulating + * this code when doing stream-based substring matching. + */ + if (c == *p1) { + p1++ ; + if (*p1 == 0) + break ; + } else { + p1 = m1 ; + } + if (c == *p2) { + p2++ ; + if (*p2 == 0) + break ; + } else { + p2 = m2 ; + } + } + } while (1) { (void)putc(c, bitfile) ; if (c == '\r' || c == '\n') { @@ -1726,12 +1774,7 @@ rhh = hh + c->pixelwidth ; /* rvv = rv */ #else #ifdef UDVIPS - if (cc <256 && strncmp(curfnt->name, "unimin", 6) - && strncmp(curfnt->name, "unigoth", 7) - && strncmp(curfnt->name, "unijmin", 7) - && strncmp(curfnt->name, "unijgoth", 8) - && strncmp(curfnt->name, "cidmin", 6) - && strncmp(curfnt->name, "cidgoth", 7)) { + if (curfnt->iswide == 0) { #else if (cc<256) { #endif diff -Nur dvipsk-askii/pprescan.c dvipsk/pprescan.c --- dvipsk-askii/pprescan.c Tue May 20 20:16:54 2003 +++ dvipsk/pprescan.c Sun Jun 13 17:03:17 2004 @@ -69,7 +69,7 @@ integer mychar ; #endif register frametype *frp = frames ; - + integer rawchar; #ifdef DEBUG if (dd(D_PAGE)) #ifdef SHORTINT @@ -181,6 +181,7 @@ case 134: case 129: cmd = twobytes() ; /* set2 commands drops through */ if (curfnt==NULL) error("! Bad DVI file: no font selected") ; + rawchar = cmd ; #ifndef UDVIPS if (cmd>=256) cmd = ((cmd>>8)-0x21)*94 + (cmd&0xff)-0x21 ; #endif @@ -192,8 +193,10 @@ if (++frp == &frames[MAXFRAME] ) error("! virtual recursion stack overflow") ; cd = curfnt->chardesc + cmd ; - if (cd->packptr == 0) + if (cd->packptr == 0) { + fprintf(stderr, "Wrong char code: %04X\n", rawchar) ; error("! a non-existent virtual char is being used; check vf/tfm files") ; + } curpos = cd->packptr + 2 ; curlim = curpos + (256*(long)(*cd->packptr)+(*(cd->packptr+1))) ; ffont = curfnt->localfonts ; diff -Nur dvipsk-askii/prescan.c dvipsk/prescan.c --- dvipsk-askii/prescan.c Sun Nov 01 12:45:08 1998 +++ dvipsk/prescan.c Sun Jun 13 17:06:23 2004 @@ -57,7 +57,7 @@ num = signedquad() ; den = signedquad() ; if (overridemag > 0) (void)signedquad() ; - else if (overridemag < 0) mag = (mag * signedquad() + 500.0) / 1000.0 ; + else if (overridemag < 0) mag = (mag * signedquad()) / 1000.0 ; else mag = signedquad() ; conv = (real) num * DPI * mag / ( den * 254000000.0 ) ; vconv = (real) num * VDPI * mag / ( den * 254000000.0 ) ; diff -Nur dvipsk-askii/resident.c dvipsk/resident.c --- dvipsk-askii/resident.c Tue May 20 20:16:54 2003 +++ dvipsk/resident.c Sun Jun 13 16:51:36 2004 @@ -462,7 +462,9 @@ * We need to get rid of the newline. */ for (p=was_inline; *p; p++) ; - if (p > was_inline) *(p-1) = 0 ; + while (p > was_inline && (*(p-1) == '\n' || *(p-1) == '\r')) { + *--p = '\0' ; + } if (was_inline[0] != '@') canaddtopaper = 0 ; switch (was_inline[0]) { @@ -508,6 +510,7 @@ ps->xsize = hsiz ; ps->ysize = vsiz ; ps->specdat = nextstring++ ; + *(ps->specdat) = 0 ; canaddtopaper = 1 ; } break ; diff -Nur dvipsk-askii/scanpage.c dvipsk/scanpage.c --- dvipsk-askii/scanpage.c Tue May 20 20:16:54 2003 +++ dvipsk/scanpage.c Sun Jun 13 17:08:05 2004 @@ -137,8 +137,9 @@ integer fnt ; integer mychar ; register frametype *frp = frames ; + integer rawchar ; - if (firstboploc == 0) + if (firstboploc == 0) firstboploc = ftell(dvifile) ; pagecost = 0 ; #ifdef DEBUG @@ -266,6 +267,7 @@ */ if (curfnt==NULL) error("! Bad DVI file: no font selected") ; + rawchar = cmd ; #ifndef UDVIPS if (cmd>256) cmd = ((cmd>>8)-0x21)*94 + (cmd&0xff)-0x21; #endif @@ -277,8 +279,10 @@ if (++frp == &frames[MAXFRAME] ) error("! virtual recursion stack overflow") ; cd = curfnt->chardesc + cmd ; - if (cd->packptr == 0) + if (cd->packptr == 0) { + fprintf(stderr, "Wrong char code: %04X\n", rawchar) ; error("! a non-existent virtual character is being used; check vf/tfm files") ; + } curpos = cd->packptr + 2 ; curlim = curpos + (256*(long)(*cd->packptr)+(*(cd->packptr+1))) ; ffont = curfnt->localfonts ; diff -Nur dvipsk-askii/search.c dvipsk/search.c --- dvipsk-askii/search.c Tue May 20 20:16:54 2003 +++ dvipsk/search.c Sun Jun 13 17:08:36 2004 @@ -90,7 +90,11 @@ /* Most file looked for through here must exist -- the exception is VF's. Bitmap fonts go through pksearch. */ +#ifdef Omega /* do not run mktextfm in the case of Omega */ + found_name = kpse_find_file (file, format, 0); +#else found_name = kpse_find_file (file, format, format != vfpath); +#endif if (found_name) { unsigned len = strlen (found_name); #ifndef AMIGA diff -Nur dvipsk-askii/tfmload.c dvipsk/tfmload.c --- dvipsk-askii/tfmload.c Tue May 20 20:16:54 2003 +++ dvipsk/tfmload.c Sun Jun 13 17:10:16 2004 @@ -121,6 +121,7 @@ integer chardat[65536] ; integer font_level ; integer pretend_no_chars ; + integer id ; #else shalfword bc, ec ; integer scaled[256] ; @@ -136,6 +137,7 @@ */ #ifdef Omega li = tfm16() ; + id = li ; if (li!=0) { font_level = -1 ; hd = tfm16() ; @@ -313,6 +315,10 @@ #else if (ec>=256) curfnt->codewidth = 2 ; /* XXX: 2byte-code can have ec<256 */ #endif + if (id == 9 || id == 11) + curfnt->iswide = 1 ; + else + curfnt->iswide = 0 ; curfnt->loaded = 1 ; return charcount ; } diff -Nur dvipsk-askii/writet1.c dvipsk/writet1.c --- dvipsk-askii/writet1.c Tue May 20 20:16:54 2003 +++ dvipsk/writet1.c Sun Jun 13 16:51:36 2004 @@ -64,10 +64,11 @@ #define t1_scan_keys() #define update_builtin_enc(font, glyph_names) #define embed_all_glyphs(tex_font) false -extern Boolean shiftlowchars; #ifdef SHIFTLOWCHARS +extern Boolean shiftlowchars; #define t1_char(c) T1Char(c) #else /* SHIFTLOWCHARS */ +#define shiftlowchars 0 #define t1_char(c) c #endif /* SHIFTLOWCHARS */ #define extra_charset() dvips_extra_charset @@ -1376,7 +1377,7 @@ } if (is_included(fm_cur) && is_subsetted(fm_cur)) make_subset_tag(fm_cur, t1_fontname_offset); - if (!shiftlowchars && t1_encoding == ENC_STANDARD) + if (shiftlowchars == 0 && t1_encoding == ENC_STANDARD) t1_puts("/Encoding StandardEncoding def\n"); else { t1_puts("/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n");