*** xdvi18.vflib.patch.orig Thu May 30 00:15:44 1996 --- xdvi18.vflib.patch Thu May 30 00:19:04 1996 *************** *** 1,142 **** - diff -Ncr xdvi18.original/Imakefile xdvi18/Imakefile - *** xdvi18.original/Imakefile Fri May 6 08:01:18 1994 - --- xdvi18/Imakefile Wed Mar 1 12:39:30 1995 - *************** - *** 2,16 **** - * Imakefile for dvi previewer. - */ - - XCOMM The following five lines are the crucial ones. - ! OSDEFS=-DMSBITFIRST - ! OPTIONDEFS=-DUSE_PK -DBUTTONS -DGREY - ! DEFAULT_FONT_PATH=/usr/local/tex/fonts - DEFAULT_VF_PATH=/usr/local/tex/fonts/vf - DEFAULT_FONT_SIZES=$(SIZES300) - - LOCAL_LIBRARIES_TOOL=$(VARLIBS) XawClientLibs - DEPLIBS_TOOL=$(VARDEPLIBS) XawClientDepLibs - LINTLIBS_TOOL=$(VARLINT) $(LINTXAW) $(LINTXMU) $(LINTXTOOL) \ - $(LINTEXTENSIONLIB) $(LINTXLIB) -lm - - --- 2,57 ---- - * Imakefile for dvi previewer. - */ - - + #define Use_KANJI - + #undef Use_ASCIIDNP - + #define Use_ZEIT - + #define Use_NTTZEIT - + - + #include "XDvi.defs" - + #include "XDvi.rules" - + - XCOMM The following five lines are the crucial ones. - ! TEXLIB=/usr/local/lib/tex - ! TEXFONTS=$(TEXLIB)/fonts /* where jfm files are located */ - ! PKFONTS=$(TEXLIB)/300pk - ! - ! #ifdef Use_ZEIT - ! VFLIB=/usr/local/lib/VFlib-2.16.2/VFlib.a - ! #endif - ! - ! DEFAULT_FONT_PATH=.:/usr/local/lib/nttjtex/pk:$(PKFONTS)/cmfonts:$(TEXLIB)/amspk:$(TEXFONTS) - DEFAULT_VF_PATH=/usr/local/tex/fonts/vf - DEFAULT_FONT_SIZES=$(SIZES300) - - + #ifdef Use_KANJI - + #ifdef Use_ASCIIDNP - + KANJI_DEFS=-DKANJI -DASCIIDNP - + #else - + KANJI_DEFS=-DKANJI - + #endif /* Use_ASCIIDNP */ - + #else - + KANJI_DEFS= - + #endif /* Use_KANJI */ - + - + #ifdef Use_ZEIT - + DEFAULT_FONTCONFDIR=$(DEFAULT_VF_PATH) - + DEFAULT_FONTCONF=$(TEXLIB)/vfonts/FontConf - + #ifdef Use_NTTZEIT - + ZEIT_DEFS=-DUSE_ZEIT -DNTTZEIT -DDEFAULT_FONTCONF=\"$(DEFAULT_FONTCONF)\" - + #else - + ZEIT_DEFS=-DUSE_ZEIT -DDEFAULT_FONTCONF=\"$(DEFAULT_FONTCONF)\" - + #endif /* Use_NTTZEIT */ - + #else - + ZEIT_DEFS= - + #endif /* Use_ZEIT */ - + - + #ifdef Use_ZEIT - + LOCAL_LIBRARIES_TOOL=$(VFLIB) $(VARLIBS) XawClientLibs - + DEPLIBS_TOOL=$(VFLIB) $(VARDEPLIBS)XawClientDepLibs - + #else - LOCAL_LIBRARIES_TOOL=$(VARLIBS) XawClientLibs - DEPLIBS_TOOL=$(VARDEPLIBS) XawClientDepLibs - + #endif - LINTLIBS_TOOL=$(VARLINT) $(LINTXAW) $(LINTXMU) $(LINTXTOOL) \ - $(LINTEXTENSIONLIB) $(LINTXLIB) -lm - - *************** - *** 21,26 **** - --- 62,70 ---- - MATHLIB=-lm - SYS_LIBRARIES=$(MATHLIB) - - + OSDEFS= - + OPTIONDEFS=-DUSE_PK -DUSE_GF -DA4 -DBUTTONS -DGREY -DPS_GS \ - + $(KANJI_DEFS) $(ZEIT_DEFS) - DEFS=$(OSDEFS) $(OPTIONDEFS) - DEFINES=$(DEFS) -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \ - -DDEFAULT_VF_PATH=\"$(DEFAULT_VF_PATH)\" \ - diff -Ncr xdvi18.original/XDvi.defs xdvi18/XDvi.defs - *** xdvi18.original/XDvi.defs Thu Jan 1 09:00:00 1970 - --- xdvi18/XDvi.defs Wed Mar 1 09:26:49 1995 - *************** - *** 0 **** - --- 1,23 ---- - + /* XDvi.defs */ - + - + #ifdef Use_ASCIIDNP - + #ifndef Use_KANJI - + #define Use_KANJI - + #endif - + #ifdef Use_NTTZEIT - + #undef Use_NTTZEIT - + #endif - + #ifdef Use_ZEIT - + #undef Use_ZEIT - + #endif - + #endif /* Use_ASCIIDNP */ - + - + #ifdef Use_NTTZEIT - + #ifndef Use_KANJI - + #define Use_KANJI - + #endif - + #ifndef Use_ZEIT - + #define Use_ZEIT - + #endif - + #endif /* Use_NTTZEIT */ - + - diff -Ncr xdvi18.original/XDvi.rules xdvi18/XDvi.rules - *** xdvi18.original/XDvi.rules Thu Jan 1 09:00:00 1970 - --- xdvi18/XDvi.rules Wed Mar 1 09:27:30 1995 - *************** - *** 0 **** - --- 1,14 ---- - + /* XDvi.rules */ - + - + #ifndef MakeDir - + #define MakeDir(dir) -@if [ -d dir ]; then set +x; \ @@\ - + else (set -x; $(MKDIRHIER) dir); fi - + #endif - + - + #ifndef InstallNonExecFile - + #define InstallNonExecFile(file,dest) @@\ - + install:: file @@\ - + MakeDir($(DESTDIR)dest) @@\ - + $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest - + #endif /* InstallNonExecFile */ - + - diff -Ncr xdvi18.original/dnpzeit.c xdvi18/dnpzeit.c *** xdvi18.original/dnpzeit.c Thu Jan 1 09:00:00 1970 --- xdvi18/dnpzeit.c Wed Mar 1 10:33:25 1995 *************** --- 1,3 ---- *************** *** 313,1403 **** + return(ku * 256 + ten); + } + - diff -Ncr xdvi18.original/dvi.h xdvi18/dvi.h - *** xdvi18.original/dvi.h Sat Mar 28 05:27:15 1992 - --- xdvi18/dvi.h Wed Mar 1 09:29:10 1995 - *************** - *** 4,11 **** - --- 4,17 ---- - - #define SETCHAR0 0 - #define SET1 128 - + #ifdef KANJI - + #define SET2 129 - + #endif /* KANJI */ - #define SETRULE 132 - #define PUT1 133 - + #ifdef KANJI - + #define PUT2 134 - + #endif /* KANJI */ - #define PUTRULE 137 - #define NOP 138 - #define BOP 139 - diff -Ncr xdvi18.original/dvi_draw.c xdvi18/dvi_draw.c - *** xdvi18.original/dvi_draw.c Fri May 27 17:22:24 1994 - --- xdvi18/dvi_draw.c Wed Mar 1 10:37:01 1995 - *************** - *** 363,369 **** - --- 363,373 ---- - } - - static _Xconst char *dvi_table1[] = { - + #ifdef KANJI - + "SET1", "SET2", NULL, NULL, "SETRULE", "PUT1", "PUT2", NULL, - + #else /* KANJI */ - "SET1", NULL, NULL, NULL, "SETRULE", "PUT1", NULL, NULL, - + #endif /* KANJI */ - NULL, "PUTRULE", "NOP", "BOP", "EOP", "PUSH", "POP", "RIGHT1", - "RIGHT2", "RIGHT3", "RIGHT4", "W0", "W1", "W2", "W3", "W4", - "X0", "X1", "X2", "X3", "X4", "DOWN1", "DOWN2", "DOWN3", - *************** - *** 606,617 **** - --- 610,739 ---- - - g->y2 = g->y / shrink_factor; - } - + - + static void - + shrink_glyph_NeXT(g) - + register struct glyph *g; - + { - + int rows_left, rows, init_cols, cols_left; - + register int cols; - + int x, y; - + long thesample; - + BMUNIT *old_ptr; - + - + /* These machinations ensure that the character is shrunk according to - + its hot point, rather than its upper left-hand corner. */ - + g->x2 = g->x / shrink_factor; - + init_cols = g->x - g->x2 * shrink_factor; - + if (init_cols <= 0) init_cols += shrink_factor; - + else ++g->x2; - + g->bitmap2.w = g->x2 + ROUNDUP(g->bitmap.w - g->x, shrink_factor); - + /* include row zero with the positively numbered rows */ - + cols = g->y + 1; /* spare register variable */ - + g->y2 = cols / shrink_factor; - + rows = cols - g->y2 * shrink_factor; - + if (rows <= 0) { - + rows += shrink_factor; - + --g->y2; - + } - + g->bitmap2.h = g->y2 + ROUNDUP(g->bitmap.h - cols, shrink_factor) + 1; - + - + g->image2 = XCreateImage(DISP, DefaultVisualOfScreen(SCRN), - + DefaultDepthOfScreen(SCRN), - + ZPixmap, 0, (char *) NULL, - + g->bitmap2.w, g->bitmap2.h, - + BITS_PER_BMUNIT, 0); - + g->pixmap2 = g->image2->data = xmalloc((unsigned) - + g->image2->bytes_per_line * g->bitmap2.h, - + "character pixmap"); - + - + #ifndef MSBITFIRST - + g->image2->bitmap_bit_order = LSBFirst; - + #else - + g->image2->bitmap_bit_order = MSBFirst; - + #endif - + { - + short endian = MSBFirst << 8 | LSBFirst; - + - + g->image2->byte_order = *((char *) &endian); - + } - + g->image2->bitmap_pad = 32; - + - + old_ptr = (BMUNIT *) g->bitmap.bits; - + rows_left = g->bitmap.h; - + y = 0; - + while (rows_left) { - + x = 0; - + if (rows > rows_left) rows = rows_left; - + cols_left = g->bitmap.w; - + cols = init_cols; - + while (cols_left) { - + if (cols > cols_left) cols = cols_left; - + - + thesample = sample(old_ptr, g->bitmap.bytes_wide, - + g->bitmap.w - cols_left, cols, rows); - + NeXTPutPixel(g->image2, x, y, - + (thesample * 100) / (shrink_factor * shrink_factor)); - + - + cols_left -= cols; - + cols = shrink_factor; - + x++; - + } - + *((char **) &old_ptr) += rows * g->bitmap.bytes_wide; - + rows_left -= rows; - + rows = shrink_factor; - + y++; - + } - + - + while (y < g->bitmap2.h) { - + for (x = 0; x < g->bitmap2.w; x++) - + NeXTPutPixel(g->image2, x, y, 0); - + y++; - + } - + - + g->y2 = g->y / shrink_factor; - + } - + - + static int NeXTd[3] = {15, 30, 50}; - + - + void - + set_NeXTd(s) - + char *s; - + { - + int i; - + - + if (*s == ':') ++s; - + for (i = 0; i < 3; i++) { - + NeXTd[i] = atof(s); - + if ((s = index(s, ':')) == NULL) return; - + ++s; - + } - + } - + - + NeXTPutPixel(image, x, y, percent) - + XImage *image; - + int x, y, percent; - + { - + int pix; - + - + pix = percent < NeXTd[0] ? 0 - + : percent < NeXTd[1] ? 1 : percent < NeXTd[2] ? 2 : 3; - + image->data[y * image->bytes_per_line + x / 4] - + |= pix << (2 * (3 - x % 4)); - + } - #endif /* GREY */ - - /* - * Find font #n. - */ - - + #ifdef ASCIIDNP - + static unsigned int cur_TeXnumber; - + - + extern void define_kanjifont(); - + extern void adj_kanjiwidth(); - + #endif /* ASCIIDNP */ - + - static void - change_font(n) - unsigned long n; - *************** - *** 627,634 **** - --- 749,770 ---- - break; - } - } - + #ifdef ASCIIDNP - + if (currinf.fontp == NULL) { - + if (n >> 24) { - + define_kanjifont(n); - + change_font(n); - + return; - + } - + tell_oops("non-existent font #%d", n); - + } - + #else /* ASCIIDNP */ - if (currinf.fontp == NULL) tell_oops("non-existent font #%d", n); - + #endif /* ASCIIDNP */ - maxchar = currinf.fontp->maxchar; - + #ifdef ASCIIDNP - + cur_TeXnumber = n; - + #endif /* ASCIIDNP */ - currinf.set_char_p = currinf.fontp->set_char_p; - } - - *************** - *** 676,681 **** - --- 812,820 ---- - - if (ch > maxchar) realloc_font(currinf.fontp, WIDENINT ch); - if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) { - + #ifdef NTTZEIT - + if (!(currinf.fontp->flags & FONT_DNP)) { - + #endif /* NTTZEIT */ - if (g->addr == 0) { - if (!hush_chars) - Fprintf(stderr, "Character %d not defined in font %s\n", ch, - *************** - *** 687,693 **** - --- 826,839 ---- - return ERRVAL; /* previously flagged missing char */ - open_font_file(currinf.fontp); - Fseek(currinf.fontp->file, g->addr, 0); - + #ifdef NTTZEIT - + } - + #endif /* NTTZEIT */ - (*currinf.fontp->read_char)(currinf.fontp, ch); - + #ifdef ASCIIDNP - + if (cur_TeXnumber >> 24) - + adj_kanjiwidth(currinf.fontp, cur_TeXnumber >> 24, ch); - + #endif /* ASCIIDNP */ - if (debug & DBG_BITMAP) print_char((ubyte) ch, g); - currinf.fontp->timestamp = ++current_timestamp; - } - *************** - *** 760,765 **** - --- 906,949 ---- - } - - - + #if defined(KANJI) && !defined(ASCIIDNP) - + long - + set_char2(ch) - + int ch; - + { - + register struct glyph *g; - + - + g = currinf.fontp->kglyph[jisindex(ch)]; - + if (g == NULL || g->bitmap.bits == NULL) { - + (*currinf.fontp->read_char)(currinf.fontp, ch); - + g = currinf.fontp->kglyph[jisindex(ch)]; - + } - + if (shrink_factor == 1) - + put_bitmap(&g->bitmap, PXL_H - g->x, PXL_V - g->y); - + else { - + #ifdef GREY - + if (use_grey) { - + if (g->pixmap2 == NULL) - + if (DefaultDepthOfScreen(SCRN) == 2) - + shrink_glyph_NeXT(g); - + else - + shrink_glyph_grey(g); - + put_image(g->image2, PXL_H - g->x2, PXL_V - g->y2); - + } else { - + if (g->bitmap2.bits == NULL) - + shrink_glyph(g); - + put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2); - + } - + #else - + if (g->bitmap2.bits == NULL) - + shrink_glyph(g); - + put_bitmap(&g->bitmap2, PXL_H - g->x2, PXL_V - g->y2); - + #endif - + } - + return g->dvi_adv; - + } - + #endif /* KANJI && !ASCIIDNP */ - + - #ifndef TEXXET - long - load_n_set_char(ch) - *************** - *** 931,936 **** - --- 1115,1168 ---- - applicationDoSpecial(cmd); - } - - + #ifdef ASCIIDNP - + /*** compute_fc : borrowed from jvi2ps1.3j ***/ - + - + static void - + compute_fc(kuten, f, c) - + register unsigned int kuten; - + unsigned int *f, *c; - + { - + register int n; - + register unsigned int ku, ten; - + - + *f = *c = 1; - + ku = kuten / 256; - + ten = kuten % 256; - + if (ku < 0x21 || (0x29 <= ku && ku <= 0x2f) || 0x74 < ku) { - + Fprintf(stderr, "invalid ku in jis (%x, %x)", ku, ten); - + return; - + } - + if (ten < 0x21 || 0x7e < ten) { - + Fprintf(stderr, "invalid ten in jis (%x, %x)", ku, ten); - + return; - + } - + ku -= 0x20; - + ten -= 0x20; - + if (ku == 1) { - + *f = 1; - + *c = ten; - + } else if (ku == 2) { - + *f = 1; - + *c = ten + 100; - + } else if (ku == 3) { - + *f = 2; - + *c = ten + 32; - + } else if (ku <= 8) { - + *f = ku - 1; - + *c = ten; - + } else if (ku <= 47) { /* Daiichi Suijun */ - + n = (ku - 0x10) * 0x5e + ten - 1; - + *f = (n / 256) + 8; - + *c = n % 256; - + } else { /* Daini Suijun */ - + n = (ku - 0x30) * 0x5e + ten - 1; - + *f = (n / 256) + 20; - + *c = n % 256; - + } - + } - + #endif /* ASCIIDNP */ - + - #define xspell_conv(n) spell_conv0(n, current_dimconv) - - static void - *************** - *** 966,973 **** - change_font((unsigned long) (ch - FNTNUM0)); - else { - long a, b; - - ! switch (ch) { - case SET1: - case PUT1: - #ifndef TEXXET - --- 1198,1208 ---- - change_font((unsigned long) (ch - FNTNUM0)); - else { - long a, b; - + #ifdef ASCIIDNP - + unsigned int f, c; - + #endif /* ASCIIDNP */ - - ! switch (ch) { - case SET1: - case PUT1: - #ifndef TEXXET - *************** - *** 978,983 **** - --- 1213,1232 ---- - #endif - break; - - + #ifdef KANJI - + case SET2: - + case PUT2: - + #ifdef ASCIIDNP - + compute_fc(xnum(2), &f, &c); - + if (cur_TeXnumber >> 24 != f) - + change_font((cur_TeXnumber & 0xffffff) | (f << 24)); - + a = (*currinf.set_char_p)(c); - + #else /* ASCIIDNP */ - + a = (*currinf.set_char_p)(xnum(2)); - + #endif /* ASCIIDNP */ - + if (ch != PUT2) DVI_H += a; - + break; - + #endif /* KANJI */ - case SETRULE: - /* Be careful, dvicopy outputs rules with - height = 0x80000000. We don't want any - diff -Ncr xdvi18.original/dvi_init.c xdvi18/dvi_init.c - *** xdvi18.original/dvi_init.c Mon May 16 11:16:57 1994 - --- xdvi18/dvi_init.c Wed Mar 1 11:20:20 1995 - *************** - *** 75,80 **** - --- 75,83 ---- - #define VF_PRE 247 - #define VF_ID_BYTE 202 - #define VF_MAGIC (VF_PRE << 8) + VF_ID_BYTE - + #if defined(KANJI) && !defined(ASCIIDNP) - + #define JFMS_MAGIC 11 - + #endif /* KANJI && !ASCIIDNP */ - - #define dvi_oops(str) (dvi_oops_msg = (str), longjmp(dvi_env, 1)) - - *************** - *** 119,126 **** - --- 122,151 ---- - { - register struct font *f; - register struct glyph *g; - + #if defined(KANJI) && !defined(ASCIIDNP) - + int n, maxchar; - - for (f = font_head; f != NULL; f = f->next) - + if ((f->flags & FONT_LOADED) && !(f->flags & FONT_VIRTUAL)) { - + maxchar = (f->flags & FONT_KANJI) ? KTABLESIZE : f->maxchar; - + for (n = 0; n < maxchar; ++n) { - + g = (f->flags & FONT_KANJI) ? f->kglyph[n] : &f->glyph[n]; - + if (g != NULL) { - + if (g->bitmap2.bits) { - + free(g->bitmap2.bits); - + g->bitmap2.bits = NULL; - + } - + #ifdef GREY - + if (g->pixmap2) { - + XDestroyImage(g->image2); - + g->pixmap2 = NULL; - + } - + #endif - + } - + } - + } - + #else /* KANJI && !ASCIIDNP */ - + for (f = font_head; f != NULL; f = f->next) - if ((f->flags & FONT_LOADED) && !(f->flags & FONT_VIRTUAL)) - for (g = f->glyph; g <= f->glyph + f->maxchar; ++g) { - if (g->bitmap2.bits) { - *************** - *** 134,139 **** - --- 159,165 ---- - } - #endif - } - + #endif /* KANJI && !ASCIIDNP */ - } - - /* - *************** - *** 195,201 **** - --- 221,241 ---- - int magic; - Boolean hushcs = hush_chk; - - + #ifdef ASCIIDNP - + if (iskanjifont(fontp->fontname)) return False; - + #endif /* ASCIIDNP */ - fontp->flags |= FONT_LOADED; - + #ifdef NTTZEIT - + if (isdnpfont(fontp->fontname)) { - + fontp->timestamp = ++current_timestamp; - + fontp->maxchar = maxchar = 255; - + fontp->set_char_p = set_char; - + fontp->file = NULL; - + fontp->flags |= FONT_DNP; - + read_NTT_index(fontp); - + return False; - + } - + #endif /* NTTZEIT */ - fontp->file = font_open(fontp->fontname, &font_found, - fsize, &size_found, fontp->magstepval, &fontp->filename); - if (fontp->file == NULL) { - *************** - *** 216,225 **** - Fprintf(stderr, - "Can't find font %s at %d dpi; using %d dpi instead.\n", - fontp->fontname, dpi, size_found); - - fontp->fsize = size_found; - fontp->timestamp = ++current_timestamp; - fontp->maxchar = maxchar = 255; - fontp->set_char_p = set_char; - magic = two(fontp->file); - #ifdef USE_PK - if (magic == PK_MAGIC) read_PK_index(fontp, WIDENINT hushcs); - --- 256,277 ---- - Fprintf(stderr, - "Can't find font %s at %d dpi; using %d dpi instead.\n", - fontp->fontname, dpi, size_found); - fontp->timestamp = ++current_timestamp; - fontp->maxchar = maxchar = 255; - + #if defined(KANJI) && !defined(ASCIIDNP) - + if (iskanjifont(fontp->fontname)) { - + fontp->flags |= FONT_KANJI; - + fontp->fsize = (float) size_found; - + fontp->set_char_p = set_char2; - + } - + else { - + fontp->fsize = (float) size_found / 5; - + fontp->set_char_p = set_char; - + } - + #else /* KANJI && !ASCIIDNP */ - + fontp->fsize = (float) size_found / 5; - fontp->set_char_p = set_char; - + #endif /* KANJI && !ASCIIDNP */ - magic = two(fontp->file); - #ifdef USE_PK - if (magic == PK_MAGIC) read_PK_index(fontp, WIDENINT hushcs); - *************** - *** 231,236 **** - --- 283,297 ---- - #endif - if (magic == VF_MAGIC) read_VF_index(fontp, WIDENINT hushcs); - else - + #if defined(KANJI) && !defined(ASCIIDNP) - + if (magic == JFMS_MAGIC) { - + #ifdef USE_ZEIT - + read_ZEIT_index(fontp); - + #endif /* USE_ZEIT */ - + return False; - + } - + else - + #endif /* KANJI && !ASCIIDNP */ - oops("Cannot recognize format for font file %s", fontp->filename); - - if (fontp->flags & FONT_VIRTUAL) { - *************** - *** 413,418 **** - --- 474,504 ---- - return fontp; - } - - + #ifdef KANJI - + int - + iskanjifont(font) - + char *font; - + { - + if (strncmp(font, "min", 3) == 0 || strncmp(font, "nmin", 4) == 0) - + return 1; - + if (strncmp(font, "goth", 4) == 0 || strncmp(font, "ngoth", 5) == 0) - + return 2; - + return 0; - + } - + #endif /* KANJI */ - + - + #if defined(ASCIIDNP) || defined(NTTZEIT) - + int - + isdnpfont(font) - + char *font; - + { - + if (strncmp(font, "dmj", 3) == 0) - + return 1; - + if (strncmp(font, "dgj", 3) == 0) - + return 2; - + return 0; - + } - + #endif /* ASCIIDNP || NTTZEIT */ - - /* - * process_preamble reads the information in the preamble and stores - *************** - *** 547,553 **** - --- 633,664 ---- - } - else { - register struct glyph *g; - + #if defined(KANJI) && !defined(ASCIIDNP) - + int n, maxchar; - - + maxchar = (fontp->flags & FONT_KANJI) - + ? KTABLESIZE : fontp->maxchar; - + for (n = 0; n < maxchar; ++n) { - + g = (fontp->flags & FONT_KANJI) - + ? fontp->kglyph[n] : &fontp->glyph[n]; - + if (g != NULL) { - + if (g->bitmap.bits != NULL) - + free(g->bitmap.bits); - + if (g->bitmap2.bits != NULL) - + free(g->bitmap2.bits); - + #ifdef GREY - + if (g->pixmap2 != NULL) - + XDestroyImage(g->image2); - + #endif - + if (fontp->flags & FONT_KANJI) - + free((char *) g); - + } - + } - + if (fontp->flags & FONT_KANJI) - + free((char **) fontp->kglyph); - + else - + free((char *) fontp->glyph); - + #else /* KANJI && !ASCIIDNP */ - for (g = fontp->glyph; - g <= fontp->glyph + fontp->maxchar; ++g) { - if (g->bitmap.bits != NULL) free(g->bitmap.bits); - *************** - *** 557,562 **** - --- 668,674 ---- - #endif - } - free((char *) fontp->glyph); - + #endif /* KANJI && !ASCIIDNP */ - } - free((char *) fontp); - } - *************** - *** 678,680 **** - --- 790,956 ---- - } - return True; - } - + - + #ifdef ASCIIDNP - + static double kanji_width[] = { - + 0.962216, 0.747434, 0.504013, 0.353665, - + 0.962216, 0.747434, 0.504013, 0.353665, - + }; - + - + static char kanji_sym[] = { - + 0,0,2,2,3,3,7,7,7,6,7,3,3,7,7,6,6,0,0,6,0,6,1,1,0,1,0,0,0,0,7,0, - + 0,0,7,7,0,0,7,3,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,0,0,0,0, - + 0,0,0,0,0,0,0,0,1,1,1,2,2,2,0,0,1,1,1,0,0,0,0,0,6,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + }; - + - + static char kanji_hira[] = { - + 0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + }; - + - + static char kanji_kata[] = { - + 0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - + }; - + - + void - + adj_kanjiwidth(fontp, subindex, c) - + struct font *fontp; - + unsigned int subindex; - + ubyte c; - + { - + char *table; - + - + switch (subindex) { - + case 1: - + table = kanji_sym; - + break; - + case 3: - + table = kanji_hira; - + break; - + case 4: - + table = kanji_kata; - + break; - + default: - + fontp->glyph[c].dvi_adv = - + fontp->dimconv * (1 << 20) * kanji_width[0]; - + return; - + } - + fontp->glyph[c].dvi_adv = - + fontp->dimconv * (1 << 20) * kanji_width[table[c]]; - + if (table[c] == 1) - + fontp->glyph[c].x = -fontp->glyph[c].y / 5; - + else if (table[c] >= 4) - + fontp->glyph[c].x = -fontp->glyph[c].y / 10; - + } - + - + /**** jsf_names[] : borrowed from jvi2ps1.3j ****/ - + - + static char *jsf_names[] = { - + "", "jsy", "jroma", "jhira", "jkata", - + "jgreek", "jrussian", "jkeisen", - + "jka", "jkb", "jkc", "jkd", "jke", "jkf", - + "jkg", "jkh", "jki", "jkj", "jkk", "jkl", - + "jkm", "jkn", "jko", "jkp", "jkq", "jkr", - + "jks", "jkt", "jku", "jkv", "jkw", "jkx", - + "jky", "jkz", NULL, - + }; - + - + void - + define_kanjifont(n) - + unsigned int n; - + { - + unsigned int base, index; - + register struct tn *tnp; - + struct font *fontp, *real_fontp; - + float fsize; - + int len; - + char *fontname, *name, *head; - + int size; - + - + base = n & 0xffffff; - + index = n >> 24; - + - + for (tnp = currinf.tn_head; tnp != NULL; tnp = tnp->next) - + if (tnp->TeXnumber == base) { - + real_fontp = tnp->fontp; - + break; - + } - + tnp = (struct tn *) - + xmalloc((unsigned) sizeof(struct tn), "TeXnumber structure"); - + tnp->next = tn_head; - + tn_head = tnp; - + currinf.tn_head = tn_head; - + tnp->TeXnumber = n; - + fsize = real_fontp->fsize; - + name = real_fontp->fontname; - + if (iskanjifont(name) == 1) - + head = "dm"; - + else - + head = "dg"; - + while (!isdigit(*name)) - + name++; - + len = strlen(head) + strlen(jsf_names[index]) + strlen(name); - + fontname = xmalloc((unsigned) len + 1, "font name"); - + Sprintf(fontname, "%s%s%s", head, jsf_names[index], name); - + if (debug & DBG_PK) - + Printf("Define kanjifont \"%s\"\n", fontname); - + /* - + * reuse font if possible - + */ - + for (fontp = font_head;; fontp = fontp->next) { - + if (fontp == NULL) { /* if font doesn't exist yet */ - + if (list_fonts) - + Printf("%s at %d dpi\n", fontname, (int) (fsize + 0.5)); - + fontp = (struct font *) xmalloc((unsigned) sizeof(struct font), - + "font structure"); - + fontp->dimconv = real_fontp->dimconv; - + fontp->fontname = fontname; - + fontp->fsize = fsize; - + fontp->flags = FONT_IN_USE; - + load_font(fontp); - + fontp->next = font_head; - + font_head = fontp; - + break; - + } - + if (strcmp(fontname, fontp->fontname) == 0 - + && size == (int) (5 * fontp->fsize + 0.5)) { - + /* if font already in use */ - + reuse_font(fontp); - + free(fontname); - + break; - + } - + } - + tnp->fontp = fontp; - + if (index == 1) { - + struct glyph *g; - + - + /* dainippon symbol font; Zenkaku blank is not defined in it. */ - + g = &fontp->glyph[1]; - + g->x = 0; - + g->y = 0; - + g->bitmap.w = 1; - + g->bitmap.h = 1; - + alloc_bitmap(&g->bitmap); - + bzero(g->bitmap.bits, g->bitmap.h * g->bitmap.bytes_wide); - + adj_kanjiwidth(fontp, index, 1); - + } - + } - + #endif /* ASCIIDNP */ - diff -Ncr xdvi18.original/font_open.c xdvi18/font_open.c - *** xdvi18.original/font_open.c Mon May 16 11:17:14 1994 - --- xdvi18/font_open.c Wed Mar 1 09:48:16 1995 - *************** - *** 80,85 **** - --- 80,93 ---- - #define DEFAULT_VF_TAIL ":%f.vf" - #endif /* VMS */ - - + #ifdef USE_ZEIT - + #ifndef VMS - + #define DEFAULT_TFM_TAIL "/%f.%p" - + #else /* VMS */ - + #define DEFAULT_TFM_TAIL ":%f.%p" - + #endif /* VMS */ - + #endif /* USE_ZEIT */ - + - #ifdef MAKEPKCMD - #undef MAKEPK - #define MAKEPK - *************** - *** 570,575 **** - --- 578,591 ---- - DEFAULT_TAIL)) != NULL) - return f; - #endif - + #undef FIRST_TRY - + #define FIRST_TRY False - + #ifdef USE_ZEIT - + if (iskanjifont(font)) + if ((f = formatted_open(p, font, "tfm", 0, name, FIRST_TRY, + DEFAULT_TFM_TAIL)) != NULL) + return f; + #endif /* USE_ZEIT */ ! #ifdef SEARCH_SUBDIRECTORIES ! if (next_subdir != NULL && next_subdir->index == p) { ! next_subdir = next_subdir->next; ! *************** ! *** 702,708 **** ! --- 718,728 ---- ! ! #ifdef MAKEPK ! /* Try to create the font. */ ! + #ifdef ASCIIDNP ! + if ((magstepval != NOBUILD) && !isdnpfont(font)) { ! + #else /* ASCIIDNP */ ! if (magstepval != NOBUILD) { ! + #endif /* ASCIIDNP */ ! char mkpk[MKPKSIZE]; ! Boolean used_fontname = False; ! _Xconst char *p; ! diff -Ncr xdvi18.original/jtfm.h xdvi18/jtfm.h ! *** xdvi18.original/jtfm.h Thu Jan 1 09:00:00 1970 ! --- xdvi18/jtfm.h Wed Mar 1 09:50:25 1995 ! *************** ! *** 0 **** ! --- 1,47 ---- ! + /********************************************** ! + * Copyright (C) Atsuo Kawaguchi, 1987. ! + * (atsuo@sanken.osaka-u.junet) ! + * Modified by Y. Hayashi from jxdvi-NEWS ! + * (hayashi@me.aoyama.ac.jp) ! + **********************************************/ ! + #define J_ID 0 /* id */ ! + #define J_NT 1 /* number of words in the char_type table */ ! + #define J_LF 2 /* length of entire file */ ! + #define J_LH 3 /* length of header */ ! + #define J_BC 4 /* smallest char_type */ ! + #define J_EC 5 /* largest char_type */ ! + #define J_NW 6 /* number of width table */ ! + #define J_NH 7 /* number of height table */ ! + #define J_ND 8 /* number of depth table */ ! + #define J_NI 9 /* number of italic correctiuon table */ ! + #define J_NL 10 /* number of glue/kern talbe */ ! + #define J_NK 11 ! + #define J_NG 12 ! + #define J_NP 13 ! + ! + struct jfm_char_type { ! + unsigned short code; /* JIS code */ ! + unsigned short index; /* index to char_info */ ! + }; ! + ! + struct jfm_char_info { ! + unsigned char width_ix; /* index to width */ ! + unsigned char height_depth_ix; /* index to height & depth */ ! + unsigned char italic_ix_tag; /* index to italic & tag */ ! + unsigned char remainder_ix; /* index to remainder */ ! + }; ! + ! + struct jfm { ! + char fn[128]; /* font name (min10, etc.) */ ! + short table[(J_NP+1)]; /* table */ ! + unsigned long check_sum; /* header */ ! + unsigned long design_size; ! + struct jfm_char_type *type; ! + struct jfm_char_info *info; ! + unsigned long *width; ! + unsigned long *height; ! + unsigned long *depth; ! + unsigned long *italic; ! + }; ! + ! + struct jfm *read_jfm(); ! diff -Ncr xdvi18.original/mkconfig xdvi18/mkconfig ! *** xdvi18.original/mkconfig Fri May 6 09:38:57 1994 ! --- xdvi18/mkconfig Wed Mar 1 10:19:59 1995 ! *************** ! *** 21,26 **** ! --- 21,30 ---- ! PSHEADERC='' ! PSHEADERO='' ! PS='' ! + ZEITC='' ! + ZEITO='' ! + NTTZEITC='' ! + NTTZEITO='' ! ! while test $# -gt 0 ! do ! *************** ! *** 33,38 **** ! --- 37,44 ---- ! -DPS_NEWS) NEWSC=psnews.c; NEWSO=psnews.o; ! NEWSLIBS='-u _xv_psview_pkg -lxvps -lxview -lcps -lolgx'; PS=y;; ! -DPS_GS) GSC=psgs.c; GSO=psgs.o; PS=y;; ! + -DUSE_ZEIT) ZEITC=zeit.c; ZEITO=zeit.o;; ! + -DNTTZEIT) NTTZEITC=dnpzeit.c; NTTZEITO=dnpzeit.o;; ! esac ! shift ! done ! *************** ! *** 45,52 **** ! ! if test -n "$PS"; then PSHEADERC=psheader.c; PSHEADERO=psheader.o; fi ! ! ! echo VARSRCS= $PKC $GFC $PSHEADERC $DPSC $NEWSC $GSC > Makefile.cfg ! ! echo VAROBJS= $PKO $GFO $PSHEADERO $DPSO $NEWSO $GSO >> Makefile.cfg ! ! if test $TYPE = "make" ! then ! --- 51,58 ---- ! ! if test -n "$PS"; then PSHEADERC=psheader.c; PSHEADERO=psheader.o; fi ! ! ! echo VARSRCS= $PKC $GFC $PSHEADERC $DPSC $NEWSC $GSC $ZEITC $NTTZEITC > Makefile.cfg ! ! echo VAROBJS= $PKO $GFO $PSHEADERO $DPSO $NEWSO $GSO $ZEITO $NTTZEITO >> Makefile.cfg ! ! if test $TYPE = "make" ! then ! diff -Ncr xdvi18.original/xdvi.c xdvi18/xdvi.c ! *** xdvi18.original/xdvi.c Wed May 25 00:12:25 1994 ! --- xdvi18/xdvi.c Wed Mar 1 11:44:27 1995 ! *************** ! *** 73,78 **** ! --- 73,83 ---- ! #ifndef ALTFONT ! #define ALTFONT "cmr10" ! #endif ! + #ifdef USE_ZEIT ! + #ifndef DEFAULT_FONTCONF ! + #define DEFAULT_FONTCONF "/usr/local/lib/tex/fonts/zeit/FontConf" ! + #endif ! + #endif /* USE_ZEIT */ ! ! #ifndef A4 ! #define DEFAULT_PAPER "us" ! *************** ! *** 211,216 **** ! --- 216,224 ---- ! {"+nogrey", ".grey", XrmoptionNoArg, (caddr_t) "on"}, ! {"-gamma", ".gamma", XrmoptionSepArg, (caddr_t) NULL}, ! #endif ! + #ifdef USE_ZEIT ! + {"-fontconf", ".fontconf", XrmoptionSepArg, (caddr_t) NULL}, ! + #endif /* USE_ZEIT */ ! {"-p", ".pixelsPerInch", XrmoptionSepArg, (caddr_t) NULL}, ! {"-margins", ".Margin", XrmoptionSepArg, (caddr_t) NULL}, ! {"-sidemargin", ".sideMargin", XrmoptionSepArg, (caddr_t) NULL}, ! *************** ! *** 378,383 **** ! --- 386,395 ---- ! {"grey", "Grey", XtRBoolean, sizeof (Boolean), ! offset(_use_grey), XtRString, "true"}, ! #endif ! + #ifdef USE_ZEIT ! + {"fontconf", "FontConf", XtRString, sizeof(char *), ! + offset(fontconf), XtRString, (caddr_t) DEFAULT_FONTCONF}, ! + #endif /* USE_ZEIT */ ! }; ! #undef offset ! ! *************** ! *** 564,569 **** ! --- 576,584 ---- ! {"-gamma", "gamma", SepArg, FloatArg, 1, ! "g", ADDR(_gamma)}, ! #endif ! + #ifdef USE_ZEIT ! + {"-fontconf", ".fontconf", XrmoptionSepArg, (caddr_t) NULL}, ! + #endif /* USE_ZEIT */ ! {"-p", "pixelsPerInch", SepArg, NumberArg, 1, ! "pixels", ADDR(_pixels_per_inch)}, ! {"-margins", "Margin", SepArg, StringArg, 3, ! *************** ! *** 1162,1167 **** ! --- 1177,1186 ---- ! DISP = XtDisplay(top_level); ! SCRN = XtScreen(top_level); ! shrink_factor = resource.shrinkfactor; ! + ! + #ifdef USE_ZEIT ! + VF_Init(NULL); ! + #endif /* USE_ZEIT */ ! ! #else /* !TOOLKIT */ ! ! diff -Ncr xdvi18.original/xdvi.h xdvi18/xdvi.h ! *** xdvi18.original/xdvi.h Sat May 7 05:22:22 1994 ! --- xdvi18/xdvi.h Wed Mar 1 09:59:31 1995 ! *************** ! *** 6,11 **** ! --- 6,32 ---- ! * The C environment * ! *******************************/ ! ! + #ifdef ASCIIDNP ! + #ifndef KANJI ! + #define KANJI ! + #endif ! + #ifdef NTTZEIT ! + #undef NTTZEIT ! + #endif ! + #ifdef USE_ZEIT ! + #undef USE_ZEIT ! + #endif ! + #endif /* ASCIIDNP */ ! + ! + #ifdef NTTZEIT ! + #ifndef KANJI ! + #define KANJI ! + #endif ! + #ifndef USE_ZEIT ! + #define USE_ZEIT ! + #endif ! + #endif /* NTTZEIT */ ! + ! #include /* include Xfuncs.h, if available */ ! #include /* needed for XDestroyImage */ ! #include ! *************** ! *** 143,148 **** ! --- 164,173 ---- ! #define Fclose (void) fclose ! #define Fflush (void) fflush ! #define Strcpy (void) strcpy ! + #if defined(KANJI) && !defined(ASCIIDNP) ! + #define jisindex(c) (((c) < 0x2000 || 0x7d00 < (c)) ? 0 : ((c) - 0x2000)) ! + #define KTABLESIZE 0x5d00 ! + #endif /* KANJI && !ASCIIDNP */ ! ! /******************************** ! * Types and data * ! *************** ! *** 362,367 **** ! --- 387,401 ---- ! struct glyph *glyph; ! /* these fields are used by (loaded) virtual fonts */ ! struct font **vf_table; /* list of fonts used by this vf */ ! + #if defined(KANJI) && !defined(ASCIIDNP) ! + struct glyph **kglyph; ! + #ifdef USE_ZEIT ! + int vf; ! + #ifdef NTTZEIT ! + int index; ! + #endif /* NTTZEIT */ ! + #endif /* USE_ZEIT */ ! + #endif /* KANJI && !ASCIIDNP */ ! struct tn *vf_chain; /* ditto, if TeXnumber >= VFTABLELEN */ ! struct font *first_font; /* first font defined */ ! struct macro *macro; ! *************** ! *** 372,377 **** ! --- 406,417 ---- ! #define FONT_IN_USE 1 /* used for housekeeping */ ! #define FONT_LOADED 2 /* if font file has been read */ ! #define FONT_VIRTUAL 4 /* if font is virtual */ ! + #if defined(KANJI) && !defined(ASCIIDNP) ! + #define FONT_KANJI 8 /* if font is kanji */ ! + #ifdef NTTZEIT ! + #define FONT_DNP 16 /* if font is DNP kanji */ ! + #endif /* NTTZEIT */ ! + #endif /* KANJI && !ASCIIDNP */ ! ! #define TNTABLELEN 30 /* length of TeXnumber array (dvi file) */ ! #define VFTABLELEN 5 /* length of TeXnumber array (virtual fonts) */ ! *************** ! *** 454,459 **** ! --- 494,502 ---- ! #ifdef GREY ! Boolean _use_grey; ! #endif ! + #ifdef USE_ZEIT ! + _Xconst char *fontconf; ! + #endif /* USE_ZEIT */ ! } resource; ! ! /* As a convenience, we define the field names without leading underscores ! *************** ! *** 612,621 **** ! --- 655,670 ---- ! extern void put_border ARGS((int, int, unsigned int, unsigned int, GC)); ! #ifndef TEXXET ! extern long set_char ARGS((wide_ubyte)); ! + #if defined(KANJI) && !defined(ASCIIDNP) ! + extern long set_char2(int); ! + #endif /* KANJI && !ASCIIDNP */ ! extern long load_n_set_char ARGS((wide_ubyte)); ! extern long set_vf_char ARGS((wide_ubyte)); ! #else ! extern void set_char ARGS((wide_ubyte, wide_ubyte)); ! + #if defined(KANJI) && !defined(ASCIIDNP) ! + extern long set_char2(); ! + #endif /* KANJI && !ASCIIDNP */ ! extern void load_n_set_char ARGS((wide_ubyte, wide_ubyte)); ! extern void set_vf_char ARGS((wide_ubyte, wide_ubyte)); ! #endif ! diff -Ncr xdvi18.original/zeit.c xdvi18/zeit.c *** xdvi18.original/zeit.c Thu Jan 1 09:00:00 1970 --- xdvi18/zeit.c Wed Mar 1 10:38:19 1995 *************** --- 174,184 ---- + return(ku * 256 + ten); + } + + if ((f = formatted_open(p, font, "tfm", 0, name, FIRST_TRY, + DEFAULT_TFM_TAIL)) != NULL) + return f; + #endif /* USE_ZEIT */ ! + *** xdvi18.original/zeit.c Thu Jan 1 09:00:00 1970 --- xdvi18/zeit.c Wed Mar 1 10:38:19 1995 ***************