*** orig/virfont.c Wed Jun 17 02:22:08 1998 --- virfont.c Fri Jun 19 00:26:18 1998 *************** *** 23,29 **** SCALED_PT, SCALED_PT, PIXEL, PIXEL); long get_nbyte(BUFFER **, int); long signed_get_nbyte(BUFFER **, int); ! SCALED_PT vf_cput(uint, FONT_INFO *, PIXEL, PIXEL); FONT_INFO *set_localfont(FONT_INFO *, int); /* prtinit.c */ --- 23,29 ---- SCALED_PT, SCALED_PT, PIXEL, PIXEL); long get_nbyte(BUFFER **, int); long signed_get_nbyte(BUFFER **, int); ! SCALED_PT vf_cput(uint, FONT_INFO *, SCALED_PT, SCALED_PT, PIXEL, PIXEL); FONT_INFO *set_localfont(FONT_INFO *, int); /* prtinit.c */ *************** *** 46,51 **** --- 46,55 ---- /* getfont */ PREAMBLE *get_font(uint*, FONT_INFO *); + /* pret.c */ + extern char ptex_d; /* ptex direction: 0 = yoko, 1 = tate */ + void rewrite_preamble_ptex(PREAMBLE *, uint); + /* bitmap.c */ void write_font(PIXEL, PIXEL, PREAMBLE *); void write_rule(PIXEL, PIXEL, PIXEL, PIXEL); *************** *** 194,200 **** if (local_font == NULL) return; for (font = local_font; font; font = font->next_font) { if (font->font_type == VIRTUAL_FONT) { ! local_pkbuf_flush(font); } font->pk = NULL; } --- 198,204 ---- if (local_font == NULL) return; for (font = local_font; font; font = font->next_font) { if (font->font_type == VIRTUAL_FONT) { ! local_pkbuf_flush(font->ext.local_font); } font->pk = NULL; } *************** *** 208,214 **** for (font = local_font; font; ) { nfont = font->next_font; if (font->font_type == VIRTUAL_FONT) { ! local_font_flush(font); } if (font->name != NULL) Free(font->name); Free(font); --- 212,218 ---- for (font = local_font; font; ) { nfont = font->next_font; if (font->font_type == VIRTUAL_FONT) { ! local_font_flush(font->ext.local_font); } if (font->name != NULL) Free(font->name); Free(font); *************** *** 224,230 **** if (local_font == NULL) return; for (font = local_font; font; font = font->next_font) { if (font->font_type == VIRTUAL_FONT) { ! local_charinfo_flush(font); } for (i = 0; i < CHAR_ROOT; i++) { font->char_info[i] = NULL; --- 228,234 ---- if (local_font == NULL) return; for (font = local_font; font; font = font->next_font) { if (font->font_type == VIRTUAL_FONT) { ! local_charinfo_flush(font->ext.local_font); } for (i = 0; i < CHAR_ROOT; i++) { font->char_info[i] = NULL; *************** *** 283,288 **** --- 287,294 ---- uint cmd, c, stackp; struct STACK local_stack[LOCALSTACK_SIZE]; #define VF_SCALE(s) mult20(font->size_para, s) + #define MOVE_H(d) {if (!ptex_d) h += d; else v += d;} + #define MOVE_V(d) {if (!ptex_d) v += d; else h -= d;} w = x = y = z = 0; stackp = 0; *************** *** 290,311 **** for (end_pkt = pkt + pl; pkt < end_pkt;) { cmd = get_ubyte(pkt); if (cmd < SET1) { /* set_char */ ! h += vf_cput(cmd, font, sptopixel(h) - H0, vtopixel(v) - V0); } else if (cmd < SET_RULE) { /* set(n) */ c = get_nbyte(&pkt, cmd - SET1 + 1); ! h += vf_cput(c, font, sptopixel(h) - H0, vtopixel(v) - V0); } else if (cmd == SET_RULE || cmd == PUT_RULE) { /* set/put_rule */ a = VF_SCALE(get_long(pkt)); b = VF_SCALE(get_long(pkt)); ! A = vtopixel(a + ((a > 0) ? (v_per_h) : (-v_per_h))); ! B = sptopixel(b + sp_per_h); ! write_rule(sptopixel(h) - H0, vtopixel(v) - V0, A, B); if (cmd == SET_RULE) { ! h += b; } } else if (cmd < PUT_RULE) { /* put(n) */ c = get_nbyte(&pkt, cmd - PUT1 + 1); ! vf_cput(c, font, sptopixel(h) - H0, vtopixel(v) - V0); } else if (cmd < PUSH) { /* nop, bop, eop */ return; } else if (cmd == PUSH) { /* push */ --- 296,326 ---- for (end_pkt = pkt + pl; pkt < end_pkt;) { cmd = get_ubyte(pkt); if (cmd < SET1) { /* set_char */ ! b = vf_cput(cmd, font, h, v, H0, V0); ! MOVE_H(b); } else if (cmd < SET_RULE) { /* set(n) */ c = get_nbyte(&pkt, cmd - SET1 + 1); ! b = vf_cput(c, font, h, v, H0, V0); ! MOVE_H(b); } else if (cmd == SET_RULE || cmd == PUT_RULE) { /* set/put_rule */ a = VF_SCALE(get_long(pkt)); b = VF_SCALE(get_long(pkt)); ! if (!ptex_d) { ! A = vtopixel(a + ((a > 0) ? (v_per_h) : (-v_per_h))); ! B = sptopixel(b + sp_per_h); ! write_rule(sptopixel(h) - H0, vtopixel(v) - V0, A, B); ! } else { ! A = sptopixel(a + ((a > 0) ? (sp_per_h) : (-sp_per_h))); ! B = vtopixel(b + v_per_h); ! write_rule(sptopixel(h) - H0, vtopixel(v) + B - V0, ! B, A); ! } if (cmd == SET_RULE) { ! MOVE_H(b); } } else if (cmd < PUT_RULE) { /* put(n) */ c = get_nbyte(&pkt, cmd - PUT1 + 1); ! vf_cput(c, font, h, v, H0, V0); } else if (cmd < PUSH) { /* nop, bop, eop */ return; } else if (cmd == PUSH) { /* push */ *************** *** 330,359 **** } } else if (cmd < W0) { /* right(n) */ b = VF_SCALE(signed_get_nbyte(&pkt, cmd - RIGHT1 + 1)); ! h += b; } else if (cmd == W0) { /* w0 */ ! h += w; } else if (cmd < X0) { /* w(n) */ w = VF_SCALE(signed_get_nbyte(&pkt, cmd - W0)); ! h += w; } else if (cmd == X0) { /* x0 */ ! h += x; } else if (cmd < DOWN1) { /* x(n) */ x = VF_SCALE(signed_get_nbyte(&pkt, cmd - W0)); ! h += x; } else if (cmd < Y0) { /* down(n) */ a = VF_SCALE(signed_get_nbyte(&pkt, cmd - DOWN1 + 1)); ! v += a; } else if (cmd == Y0) { /* y0 */ ! v += y; } else if (cmd < Z0) { /* y(n) */ y = VF_SCALE(signed_get_nbyte(&pkt, cmd - Y0)); ! v += y; } else if (cmd == Z0) { /* z0 */ ! v += z; } else if (cmd < FNT_NUM_0) { /* z(n) */ z = VF_SCALE(signed_get_nbyte(&pkt, cmd - Z0)); ! v += z; } else if (cmd < FNT1) { /* fnt_num_n */ cmd -= FNT_NUM_0; font = set_localfont(vf->ext.local_font, cmd); --- 345,374 ---- } } else if (cmd < W0) { /* right(n) */ b = VF_SCALE(signed_get_nbyte(&pkt, cmd - RIGHT1 + 1)); ! MOVE_H(b); } else if (cmd == W0) { /* w0 */ ! MOVE_H(w); } else if (cmd < X0) { /* w(n) */ w = VF_SCALE(signed_get_nbyte(&pkt, cmd - W0)); ! MOVE_H(w); } else if (cmd == X0) { /* x0 */ ! MOVE_H(x); } else if (cmd < DOWN1) { /* x(n) */ x = VF_SCALE(signed_get_nbyte(&pkt, cmd - W0)); ! MOVE_H(x); } else if (cmd < Y0) { /* down(n) */ a = VF_SCALE(signed_get_nbyte(&pkt, cmd - DOWN1 + 1)); ! MOVE_V(a); } else if (cmd == Y0) { /* y0 */ ! MOVE_V(y); } else if (cmd < Z0) { /* y(n) */ y = VF_SCALE(signed_get_nbyte(&pkt, cmd - Y0)); ! MOVE_V(y); } else if (cmd == Z0) { /* z0 */ ! MOVE_V(z); } else if (cmd < FNT_NUM_0) { /* z(n) */ z = VF_SCALE(signed_get_nbyte(&pkt, cmd - Z0)); ! MOVE_V(z); } else if (cmd < FNT1) { /* fnt_num_n */ cmd -= FNT_NUM_0; font = set_localfont(vf->ext.local_font, cmd); *************** *** 393,406 **** return d; } ! SCALED_PT vf_cput(uint code, FONT_INFO *font, PIXEL H, PIXEL V) { PREAMBLE *preamble; if (font == NULL) return (0); if (font->name == NULL) return (0); if ((preamble = get_font(&code, font)) == NULL) return (0); ! write_font(H, V, preamble); return (preamble->tfm_width); } --- 408,428 ---- return d; } ! SCALED_PT vf_cput(uint code, FONT_INFO *font, ! SCALED_PT h, SCALED_PT v, PIXEL H0, PIXEL V0) { PREAMBLE *preamble; if (font == NULL) return (0); if (font->name == NULL) return (0); if ((preamble = get_font(&code, font)) == NULL) return (0); ! if (ptex_d) rewrite_preamble_ptex(preamble, code); ! if (font->font_type == VIRTUAL_FONT) { ! pret_vf_packet(font, preamble->raster, preamble->byte_width, ! h, v, H0, V0); ! } else { ! write_font(sptopixel(h) - H0, vtopixel(v) - V0, preamble); ! } return (preamble->tfm_width); }