17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 327c478bd9Sstevel@tonic-gate * The Regents of the University of California 337c478bd9Sstevel@tonic-gate * All Rights Reserved 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 377c478bd9Sstevel@tonic-gate * contributors. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * t6.c 42*2bc98732SRichard Lowe * 437c478bd9Sstevel@tonic-gate * width functions, sizes and fonts 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #include "tdef.h" 477c478bd9Sstevel@tonic-gate #include "dev.h" 487c478bd9Sstevel@tonic-gate #include <ctype.h> 497c478bd9Sstevel@tonic-gate #include "ext.h" 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* fitab[f][c] is 0 if c is not on font f */ 527c478bd9Sstevel@tonic-gate /* if it's non-zero, c is in fontab[f] at position 537c478bd9Sstevel@tonic-gate * fitab[f][c]. 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate extern struct Font *fontbase[NFONT+1]; 567c478bd9Sstevel@tonic-gate extern char *codetab[NFONT+1]; 577c478bd9Sstevel@tonic-gate extern int nchtab; 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate int fontlab[NFONT+1]; 607c478bd9Sstevel@tonic-gate short *pstab; 617c478bd9Sstevel@tonic-gate int cstab[NFONT+1]; 627c478bd9Sstevel@tonic-gate int ccstab[NFONT+1]; 637c478bd9Sstevel@tonic-gate int bdtab[NFONT+1]; 647c478bd9Sstevel@tonic-gate int sbold = 0; 657c478bd9Sstevel@tonic-gate 66e5190c10Smuffin int 677c478bd9Sstevel@tonic-gate width(j) 68e5190c10Smuffin tchar j; 697c478bd9Sstevel@tonic-gate { 70e5190c10Smuffin int i, k; 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate if (j & (ZBIT|MOT)) { 737c478bd9Sstevel@tonic-gate if (iszbit(j)) 747c478bd9Sstevel@tonic-gate return(0); 757c478bd9Sstevel@tonic-gate if (isvmot(j)) 767c478bd9Sstevel@tonic-gate return(0); 777c478bd9Sstevel@tonic-gate k = absmot(j); 787c478bd9Sstevel@tonic-gate if (isnmot(j)) 797c478bd9Sstevel@tonic-gate k = -k; 807c478bd9Sstevel@tonic-gate return(k); 817c478bd9Sstevel@tonic-gate } 827c478bd9Sstevel@tonic-gate i = cbits(j); 837c478bd9Sstevel@tonic-gate if (i < ' ') { 847c478bd9Sstevel@tonic-gate if (i == '\b') 857c478bd9Sstevel@tonic-gate return(-widthp); 867c478bd9Sstevel@tonic-gate if (i == PRESC) 877c478bd9Sstevel@tonic-gate i = eschar; 887c478bd9Sstevel@tonic-gate else if (iscontrol(i)) 897c478bd9Sstevel@tonic-gate return(0); 907c478bd9Sstevel@tonic-gate } 917c478bd9Sstevel@tonic-gate if (i==ohc) 927c478bd9Sstevel@tonic-gate return(0); 937c478bd9Sstevel@tonic-gate i = trtab[i]; 947c478bd9Sstevel@tonic-gate if (i < 32) 957c478bd9Sstevel@tonic-gate return(0); 967c478bd9Sstevel@tonic-gate if (sfbits(j) == oldbits) { 977c478bd9Sstevel@tonic-gate xfont = pfont; 987c478bd9Sstevel@tonic-gate xpts = ppts; 99*2bc98732SRichard Lowe } else 1007c478bd9Sstevel@tonic-gate xbits(j, 0); 1017c478bd9Sstevel@tonic-gate if (widcache[i-32].fontpts == (xfont<<8) + xpts && !setwdf) 1027c478bd9Sstevel@tonic-gate k = widcache[i-32].width; 1037c478bd9Sstevel@tonic-gate else { 1047c478bd9Sstevel@tonic-gate k = getcw(i-32); 1057c478bd9Sstevel@tonic-gate if (bd) 1067c478bd9Sstevel@tonic-gate k += (bd - 1) * HOR; 1077c478bd9Sstevel@tonic-gate if (cs) 1087c478bd9Sstevel@tonic-gate k = cs; 1097c478bd9Sstevel@tonic-gate } 1107c478bd9Sstevel@tonic-gate widthp = k; 1117c478bd9Sstevel@tonic-gate return(k); 1127c478bd9Sstevel@tonic-gate } 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * clear width cache-- s means just space 1167c478bd9Sstevel@tonic-gate */ 117e5190c10Smuffin int 1187c478bd9Sstevel@tonic-gate zapwcache(s) 1197c478bd9Sstevel@tonic-gate { 120e5190c10Smuffin int i; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate if (s) { 1237c478bd9Sstevel@tonic-gate widcache[0].fontpts = 0; 124e5190c10Smuffin return (0); 1257c478bd9Sstevel@tonic-gate } 1267c478bd9Sstevel@tonic-gate for (i=0; i<NWIDCACHE; i++) 1277c478bd9Sstevel@tonic-gate widcache[i].fontpts = 0; 128e5190c10Smuffin 129e5190c10Smuffin return (0); 1307c478bd9Sstevel@tonic-gate } 1317c478bd9Sstevel@tonic-gate 132e5190c10Smuffin int 1337c478bd9Sstevel@tonic-gate getcw(i) 134e5190c10Smuffin int i; 1357c478bd9Sstevel@tonic-gate { 136e5190c10Smuffin int k; 137e5190c10Smuffin char *p; 138e5190c10Smuffin int x, j; 1397c478bd9Sstevel@tonic-gate int nocache = 0; 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate bd = 0; 1427c478bd9Sstevel@tonic-gate if (i >= nchtab + 128-32) { 1437c478bd9Sstevel@tonic-gate j = abscw(i + 32 - (nchtab+128)); 1447c478bd9Sstevel@tonic-gate goto g0; 1457c478bd9Sstevel@tonic-gate } 1467c478bd9Sstevel@tonic-gate if (i == 0) { /* a blank */ 1477c478bd9Sstevel@tonic-gate k = (fontab[xfont][0] * spacesz + 6) / 12; 1487c478bd9Sstevel@tonic-gate /* this nonsense because .ss cmd uses 1/36 em as its units */ 1497c478bd9Sstevel@tonic-gate /* and default is 12 */ 1507c478bd9Sstevel@tonic-gate goto g1; 1517c478bd9Sstevel@tonic-gate } 1527c478bd9Sstevel@tonic-gate if ((j = fitab[xfont][i] & BYTEMASK) == 0) { /* it's not on current font */ 1537c478bd9Sstevel@tonic-gate /* search through search list of xfont 1547c478bd9Sstevel@tonic-gate * to see what font it ought to be on. 1557c478bd9Sstevel@tonic-gate * searches S, then remaining fonts in wraparound order. 1567c478bd9Sstevel@tonic-gate */ 1577c478bd9Sstevel@tonic-gate nocache = 1; 1587c478bd9Sstevel@tonic-gate if (smnt) { 1597c478bd9Sstevel@tonic-gate int ii, jj; 1607c478bd9Sstevel@tonic-gate for (ii=smnt, jj=0; jj < nfonts; jj++, ii=ii % nfonts + 1) { 1617c478bd9Sstevel@tonic-gate j = fitab[ii][i] & BYTEMASK; 1627c478bd9Sstevel@tonic-gate if (j != 0) { 1637c478bd9Sstevel@tonic-gate p = fontab[ii]; 1647c478bd9Sstevel@tonic-gate k = *(p + j); 1657c478bd9Sstevel@tonic-gate if (xfont == sbold) 1667c478bd9Sstevel@tonic-gate bd = bdtab[ii]; 1677c478bd9Sstevel@tonic-gate if (setwdf) 1687c478bd9Sstevel@tonic-gate numtab[CT].val |= kerntab[ii][j]; 1697c478bd9Sstevel@tonic-gate goto g1; 1707c478bd9Sstevel@tonic-gate } 1717c478bd9Sstevel@tonic-gate } 1727c478bd9Sstevel@tonic-gate } 1737c478bd9Sstevel@tonic-gate k = fontab[xfont][0]; /* leave a space-size space */ 1747c478bd9Sstevel@tonic-gate goto g1; 1757c478bd9Sstevel@tonic-gate } 1767c478bd9Sstevel@tonic-gate g0: 1777c478bd9Sstevel@tonic-gate p = fontab[xfont]; 1787c478bd9Sstevel@tonic-gate if (setwdf) 1797c478bd9Sstevel@tonic-gate numtab[CT].val |= kerntab[xfont][j]; 1807c478bd9Sstevel@tonic-gate k = *(p + j); 1817c478bd9Sstevel@tonic-gate g1: 1827c478bd9Sstevel@tonic-gate if (!bd) 1837c478bd9Sstevel@tonic-gate bd = bdtab[xfont]; 1847c478bd9Sstevel@tonic-gate if (cs = cstab[xfont]) { 1857c478bd9Sstevel@tonic-gate nocache = 1; 1867c478bd9Sstevel@tonic-gate if (ccs = ccstab[xfont]) 187*2bc98732SRichard Lowe x = ccs; 188*2bc98732SRichard Lowe else 1897c478bd9Sstevel@tonic-gate x = xpts; 1907c478bd9Sstevel@tonic-gate cs = (cs * EMPTS(x)) / 36; 1917c478bd9Sstevel@tonic-gate } 1927c478bd9Sstevel@tonic-gate k = ((k&BYTEMASK) * xpts + (Unitwidth / 2)) / Unitwidth; 1937c478bd9Sstevel@tonic-gate if (nocache|bd) 1947c478bd9Sstevel@tonic-gate widcache[i].fontpts = 0; 1957c478bd9Sstevel@tonic-gate else { 1967c478bd9Sstevel@tonic-gate widcache[i].fontpts = (xfont<<8) + xpts; 1977c478bd9Sstevel@tonic-gate widcache[i].width = k; 1987c478bd9Sstevel@tonic-gate } 1997c478bd9Sstevel@tonic-gate return(k); 2007c478bd9Sstevel@tonic-gate /* Unitwidth is Units/Point, where 2017c478bd9Sstevel@tonic-gate * Units is the fundamental digitization 2027c478bd9Sstevel@tonic-gate * of the character set widths, and 2037c478bd9Sstevel@tonic-gate * Point is the number of goobies in a point 2047c478bd9Sstevel@tonic-gate * e.g., for cat, Units=36, Point=6, so Unitwidth=36/6=6 2057c478bd9Sstevel@tonic-gate * In effect, it's the size at which the widths 2067c478bd9Sstevel@tonic-gate * translate directly into units. 2077c478bd9Sstevel@tonic-gate */ 2087c478bd9Sstevel@tonic-gate } 2097c478bd9Sstevel@tonic-gate 210e5190c10Smuffin int 2117c478bd9Sstevel@tonic-gate abscw(n) /* return index of abs char n in fontab[], etc. */ 212e5190c10Smuffin { int i, ncf; 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate ncf = fontbase[xfont]->nwfont & BYTEMASK; 2157c478bd9Sstevel@tonic-gate for (i = 0; i < ncf; i++) 2167c478bd9Sstevel@tonic-gate if (codetab[xfont][i] == n) 2177c478bd9Sstevel@tonic-gate return i; 2187c478bd9Sstevel@tonic-gate return 0; 2197c478bd9Sstevel@tonic-gate } 2207c478bd9Sstevel@tonic-gate 221e5190c10Smuffin int 2227c478bd9Sstevel@tonic-gate xbits(i, bitf) 223e5190c10Smuffin tchar i; 2247c478bd9Sstevel@tonic-gate { 225e5190c10Smuffin int k; 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate xfont = fbits(i); 2287c478bd9Sstevel@tonic-gate k = sbits(i); 2297c478bd9Sstevel@tonic-gate if (k) { 2307c478bd9Sstevel@tonic-gate xpts = pstab[--k]; 2317c478bd9Sstevel@tonic-gate oldbits = sfbits(i); 2327c478bd9Sstevel@tonic-gate pfont = xfont; 2337c478bd9Sstevel@tonic-gate ppts = xpts; 234e5190c10Smuffin return (0); 2357c478bd9Sstevel@tonic-gate } 2367c478bd9Sstevel@tonic-gate switch (bitf) { 2377c478bd9Sstevel@tonic-gate case 0: 2387c478bd9Sstevel@tonic-gate xfont = font; 2397c478bd9Sstevel@tonic-gate xpts = pts; 2407c478bd9Sstevel@tonic-gate break; 2417c478bd9Sstevel@tonic-gate case 1: 2427c478bd9Sstevel@tonic-gate xfont = pfont; 2437c478bd9Sstevel@tonic-gate xpts = ppts; 2447c478bd9Sstevel@tonic-gate break; 2457c478bd9Sstevel@tonic-gate case 2: 2467c478bd9Sstevel@tonic-gate xfont = mfont; 2477c478bd9Sstevel@tonic-gate xpts = mpts; 2487c478bd9Sstevel@tonic-gate } 249e5190c10Smuffin 250e5190c10Smuffin return (0); 2517c478bd9Sstevel@tonic-gate } 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate tchar setch() 2557c478bd9Sstevel@tonic-gate { 256e5190c10Smuffin int j; 2577c478bd9Sstevel@tonic-gate char temp[10]; 258e5190c10Smuffin char *s; 2597c478bd9Sstevel@tonic-gate extern char *chname; 2607c478bd9Sstevel@tonic-gate extern short *chtab; 2617c478bd9Sstevel@tonic-gate extern int nchtab; 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate s = temp; 2647c478bd9Sstevel@tonic-gate if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0) 2657c478bd9Sstevel@tonic-gate return(0); 2667c478bd9Sstevel@tonic-gate *s = '\0'; 2677c478bd9Sstevel@tonic-gate for (j = 0; j < nchtab; j++) 2687c478bd9Sstevel@tonic-gate if (strcmp(&chname[chtab[j]], temp) == 0) 2697c478bd9Sstevel@tonic-gate return(j + 128 | chbits); 2707c478bd9Sstevel@tonic-gate return(0); 2717c478bd9Sstevel@tonic-gate } 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate tchar setabs() /* set absolute char from \C'...' */ 2747c478bd9Sstevel@tonic-gate { 2757c478bd9Sstevel@tonic-gate int i, n, nf; 2767c478bd9Sstevel@tonic-gate extern int nchtab; 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate getch(); 2797c478bd9Sstevel@tonic-gate n = 0; 2807c478bd9Sstevel@tonic-gate n = inumb(&n); 2817c478bd9Sstevel@tonic-gate getch(); 2827c478bd9Sstevel@tonic-gate if (nonumb) 2837c478bd9Sstevel@tonic-gate return 0; 2847c478bd9Sstevel@tonic-gate return n + nchtab + 128; 2857c478bd9Sstevel@tonic-gate } 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate 289e5190c10Smuffin int 2907c478bd9Sstevel@tonic-gate findft(i) 291e5190c10Smuffin int i; 2927c478bd9Sstevel@tonic-gate { 293e5190c10Smuffin int k; 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate if ((k = i - '0') >= 0 && k <= nfonts && k < smnt) 2967c478bd9Sstevel@tonic-gate return(k); 2977c478bd9Sstevel@tonic-gate for (k = 0; fontlab[k] != i; k++) 2987c478bd9Sstevel@tonic-gate if (k > nfonts) 2997c478bd9Sstevel@tonic-gate return(-1); 3007c478bd9Sstevel@tonic-gate return(k); 3017c478bd9Sstevel@tonic-gate } 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate 304e5190c10Smuffin int 3057c478bd9Sstevel@tonic-gate caseps() 3067c478bd9Sstevel@tonic-gate { 307e5190c10Smuffin int i; 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate if (skip()) 3107c478bd9Sstevel@tonic-gate i = apts1; 3117c478bd9Sstevel@tonic-gate else { 3127c478bd9Sstevel@tonic-gate noscale++; 3137c478bd9Sstevel@tonic-gate i = inumb(&apts); /* this is a disaster for fractional point sizes */ 3147c478bd9Sstevel@tonic-gate noscale = 0; 3157c478bd9Sstevel@tonic-gate if (nonumb) 316e5190c10Smuffin return (0); 3177c478bd9Sstevel@tonic-gate } 3187c478bd9Sstevel@tonic-gate casps1(i); 319e5190c10Smuffin 320e5190c10Smuffin return (0); 3217c478bd9Sstevel@tonic-gate } 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate 324e5190c10Smuffin int 3257c478bd9Sstevel@tonic-gate casps1(i) 326e5190c10Smuffin int i; 3277c478bd9Sstevel@tonic-gate { 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate /* 3307c478bd9Sstevel@tonic-gate * in olden times, it used to ignore changes to 0 or negative. 3317c478bd9Sstevel@tonic-gate * this is meant to allow the requested size to be anything, 3327c478bd9Sstevel@tonic-gate * in particular so eqn can generate lots of \s-3's and still 3337c478bd9Sstevel@tonic-gate * get back by matching \s+3's. 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate if (i <= 0) 336e5190c10Smuffin return (0); 3377c478bd9Sstevel@tonic-gate */ 3387c478bd9Sstevel@tonic-gate apts1 = apts; 3397c478bd9Sstevel@tonic-gate apts = i; 3407c478bd9Sstevel@tonic-gate pts1 = pts; 3417c478bd9Sstevel@tonic-gate pts = findps(i); 3427c478bd9Sstevel@tonic-gate mchbits(); 343e5190c10Smuffin 344e5190c10Smuffin return (0); 3457c478bd9Sstevel@tonic-gate } 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate 348e5190c10Smuffin int 3497c478bd9Sstevel@tonic-gate findps(i) 350e5190c10Smuffin int i; 3517c478bd9Sstevel@tonic-gate { 352e5190c10Smuffin int j, k; 3537c478bd9Sstevel@tonic-gate 3547c478bd9Sstevel@tonic-gate for (j=k=0 ; pstab[j] != 0 ; j++) 3557c478bd9Sstevel@tonic-gate if (abs(pstab[j]-i) < abs(pstab[k]-i)) 3567c478bd9Sstevel@tonic-gate k = j; 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate return(pstab[k]); 3597c478bd9Sstevel@tonic-gate } 3607c478bd9Sstevel@tonic-gate 3617c478bd9Sstevel@tonic-gate 362e5190c10Smuffin int 3637c478bd9Sstevel@tonic-gate mchbits() 3647c478bd9Sstevel@tonic-gate { 365e5190c10Smuffin int i, j, k; 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate i = pts; 3687c478bd9Sstevel@tonic-gate for (j = 0; i > (k = pstab[j]); j++) 3697c478bd9Sstevel@tonic-gate if (!k) { 3707c478bd9Sstevel@tonic-gate k = pstab[--j]; 3717c478bd9Sstevel@tonic-gate break; 3727c478bd9Sstevel@tonic-gate } 3737c478bd9Sstevel@tonic-gate chbits = 0; 3747c478bd9Sstevel@tonic-gate setsbits(chbits, ++j); 3757c478bd9Sstevel@tonic-gate setfbits(chbits, font); 3767c478bd9Sstevel@tonic-gate sps = width(' ' | chbits); 3777c478bd9Sstevel@tonic-gate zapwcache(1); 378e5190c10Smuffin 379e5190c10Smuffin return (0); 3807c478bd9Sstevel@tonic-gate } 3817c478bd9Sstevel@tonic-gate 382e5190c10Smuffin int 3837c478bd9Sstevel@tonic-gate setps() 3847c478bd9Sstevel@tonic-gate { 385e5190c10Smuffin int i, j; 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate i = cbits(getch()); 3887c478bd9Sstevel@tonic-gate if (ischar(i) && isdigit(i)) { /* \sd or \sdd */ 3897c478bd9Sstevel@tonic-gate i -= '0'; 3907c478bd9Sstevel@tonic-gate if (i == 0) /* \s0 */ 3917c478bd9Sstevel@tonic-gate j = apts1; 3927c478bd9Sstevel@tonic-gate else if (i <= 3 && ischar(j = cbits(ch = getch())) && 3937c478bd9Sstevel@tonic-gate isdigit(j)) { /* \sdd */ 3947c478bd9Sstevel@tonic-gate j = 10 * i + j - '0'; 3957c478bd9Sstevel@tonic-gate ch = 0; 3967c478bd9Sstevel@tonic-gate } else /* \sd */ 3977c478bd9Sstevel@tonic-gate j = i; 3987c478bd9Sstevel@tonic-gate } else if (i == '(') { /* \s(dd */ 3997c478bd9Sstevel@tonic-gate j = cbits(getch()) - '0'; 4007c478bd9Sstevel@tonic-gate j = 10 * j + cbits(getch()) - '0'; 4017c478bd9Sstevel@tonic-gate if (j == 0) /* \s(00 */ 4027c478bd9Sstevel@tonic-gate j = apts1; 4037c478bd9Sstevel@tonic-gate } else if (i == '+' || i == '-') { /* \s+, \s- */ 4047c478bd9Sstevel@tonic-gate j = cbits(getch()); 4057c478bd9Sstevel@tonic-gate if (ischar(j) && isdigit(j)) { /* \s+d, \s-d */ 4067c478bd9Sstevel@tonic-gate j -= '0'; 4077c478bd9Sstevel@tonic-gate } else if (j == '(') { /* \s+(dd, \s-(dd */ 4087c478bd9Sstevel@tonic-gate j = cbits(getch()) - '0'; 4097c478bd9Sstevel@tonic-gate j = 10 * j + cbits(getch()) - '0'; 4107c478bd9Sstevel@tonic-gate } 4117c478bd9Sstevel@tonic-gate if (i == '-') 4127c478bd9Sstevel@tonic-gate j = -j; 4137c478bd9Sstevel@tonic-gate j += apts; 4147c478bd9Sstevel@tonic-gate } 4157c478bd9Sstevel@tonic-gate casps1(j); 416e5190c10Smuffin 417e5190c10Smuffin return (0); 4187c478bd9Sstevel@tonic-gate } 4197c478bd9Sstevel@tonic-gate 4207c478bd9Sstevel@tonic-gate 4217c478bd9Sstevel@tonic-gate tchar setht() /* set character height from \H'...' */ 4227c478bd9Sstevel@tonic-gate { 4237c478bd9Sstevel@tonic-gate int n; 4247c478bd9Sstevel@tonic-gate tchar c; 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate getch(); 4277c478bd9Sstevel@tonic-gate n = inumb(&apts); 4287c478bd9Sstevel@tonic-gate getch(); 4297c478bd9Sstevel@tonic-gate if (n == 0 || nonumb) 4307c478bd9Sstevel@tonic-gate n = apts; /* does this work? */ 4317c478bd9Sstevel@tonic-gate c = CHARHT; 4327c478bd9Sstevel@tonic-gate c |= ZBIT; 4337c478bd9Sstevel@tonic-gate setsbits(c, n); 4347c478bd9Sstevel@tonic-gate return(c); 4357c478bd9Sstevel@tonic-gate } 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate tchar setslant() /* set slant from \S'...' */ 4387c478bd9Sstevel@tonic-gate { 4397c478bd9Sstevel@tonic-gate int n; 4407c478bd9Sstevel@tonic-gate tchar c; 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate getch(); 4437c478bd9Sstevel@tonic-gate n = 0; 4447c478bd9Sstevel@tonic-gate n = inumb(&n); 4457c478bd9Sstevel@tonic-gate getch(); 4467c478bd9Sstevel@tonic-gate if (nonumb) 4477c478bd9Sstevel@tonic-gate n = 0; 4487c478bd9Sstevel@tonic-gate c = SLANT; 4497c478bd9Sstevel@tonic-gate c |= ZBIT; 4507c478bd9Sstevel@tonic-gate setsfbits(c, n+180); 4517c478bd9Sstevel@tonic-gate return(c); 4527c478bd9Sstevel@tonic-gate } 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gate 455e5190c10Smuffin int 4567c478bd9Sstevel@tonic-gate caseft() 4577c478bd9Sstevel@tonic-gate { 4587c478bd9Sstevel@tonic-gate skip(); 4597c478bd9Sstevel@tonic-gate setfont(1); 460e5190c10Smuffin 461e5190c10Smuffin return (0); 4627c478bd9Sstevel@tonic-gate } 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate 465e5190c10Smuffin int 4667c478bd9Sstevel@tonic-gate setfont(a) 4677c478bd9Sstevel@tonic-gate int a; 4687c478bd9Sstevel@tonic-gate { 469e5190c10Smuffin int i, j; 4707c478bd9Sstevel@tonic-gate 4717c478bd9Sstevel@tonic-gate if (a) 4727c478bd9Sstevel@tonic-gate i = getrq(); 473*2bc98732SRichard Lowe else 4747c478bd9Sstevel@tonic-gate i = getsn(); 4757c478bd9Sstevel@tonic-gate if (!i || i == 'P') { 4767c478bd9Sstevel@tonic-gate j = font1; 4777c478bd9Sstevel@tonic-gate goto s0; 4787c478bd9Sstevel@tonic-gate } 4797c478bd9Sstevel@tonic-gate if (i == 'S' || i == '0') 480e5190c10Smuffin return (0); 4817c478bd9Sstevel@tonic-gate if ((j = findft(i)) == -1) 4827c478bd9Sstevel@tonic-gate if ((j = setfp(0, i, 0)) == -1) /* try to put it in position 0 */ 483e5190c10Smuffin return (0); 4847c478bd9Sstevel@tonic-gate s0: 4857c478bd9Sstevel@tonic-gate font1 = font; 4867c478bd9Sstevel@tonic-gate font = j; 4877c478bd9Sstevel@tonic-gate mchbits(); 488e5190c10Smuffin 489e5190c10Smuffin return (0); 4907c478bd9Sstevel@tonic-gate } 4917c478bd9Sstevel@tonic-gate 4927c478bd9Sstevel@tonic-gate 493e5190c10Smuffin int 4947c478bd9Sstevel@tonic-gate setwd() 4957c478bd9Sstevel@tonic-gate { 496e5190c10Smuffin int base, wid; 497e5190c10Smuffin tchar i; 4987c478bd9Sstevel@tonic-gate int delim, emsz, k; 4997c478bd9Sstevel@tonic-gate int savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1; 5007c478bd9Sstevel@tonic-gate 501*2bc98732SRichard Lowe base = numtab[ST].val = wid = numtab[CT].val = 0; 5027c478bd9Sstevel@tonic-gate if (ismot(i = getch())) 503e5190c10Smuffin return (0); 5047c478bd9Sstevel@tonic-gate delim = cbits(i); 5057c478bd9Sstevel@tonic-gate savhp = numtab[HP].val; 5067c478bd9Sstevel@tonic-gate numtab[HP].val = 0; 5077c478bd9Sstevel@tonic-gate savapts = apts; 5087c478bd9Sstevel@tonic-gate savapts1 = apts1; 5097c478bd9Sstevel@tonic-gate savfont = font; 5107c478bd9Sstevel@tonic-gate savfont1 = font1; 5117c478bd9Sstevel@tonic-gate savpts = pts; 5127c478bd9Sstevel@tonic-gate savpts1 = pts1; 5137c478bd9Sstevel@tonic-gate setwdf++; 5147c478bd9Sstevel@tonic-gate while (cbits(i = getch()) != delim && !nlflg) { 5157c478bd9Sstevel@tonic-gate k = width(i); 5167c478bd9Sstevel@tonic-gate wid += k; 5177c478bd9Sstevel@tonic-gate numtab[HP].val += k; 5187c478bd9Sstevel@tonic-gate if (!ismot(i)) { 5197c478bd9Sstevel@tonic-gate emsz = POINT * xpts; 5207c478bd9Sstevel@tonic-gate } else if (isvmot(i)) { 5217c478bd9Sstevel@tonic-gate k = absmot(i); 5227c478bd9Sstevel@tonic-gate if (isnmot(i)) 5237c478bd9Sstevel@tonic-gate k = -k; 5247c478bd9Sstevel@tonic-gate base -= k; 5257c478bd9Sstevel@tonic-gate emsz = 0; 526*2bc98732SRichard Lowe } else 5277c478bd9Sstevel@tonic-gate continue; 5287c478bd9Sstevel@tonic-gate if (base < numtab[SB].val) 5297c478bd9Sstevel@tonic-gate numtab[SB].val = base; 5307c478bd9Sstevel@tonic-gate if ((k = base + emsz) > numtab[ST].val) 5317c478bd9Sstevel@tonic-gate numtab[ST].val = k; 5327c478bd9Sstevel@tonic-gate } 5337c478bd9Sstevel@tonic-gate setn1(wid, 0, (tchar) 0); 5347c478bd9Sstevel@tonic-gate numtab[HP].val = savhp; 5357c478bd9Sstevel@tonic-gate apts = savapts; 5367c478bd9Sstevel@tonic-gate apts1 = savapts1; 5377c478bd9Sstevel@tonic-gate font = savfont; 5387c478bd9Sstevel@tonic-gate font1 = savfont1; 5397c478bd9Sstevel@tonic-gate pts = savpts; 5407c478bd9Sstevel@tonic-gate pts1 = savpts1; 5417c478bd9Sstevel@tonic-gate mchbits(); 5427c478bd9Sstevel@tonic-gate setwdf = 0; 543e5190c10Smuffin 544e5190c10Smuffin return (0); 5457c478bd9Sstevel@tonic-gate } 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate 5487c478bd9Sstevel@tonic-gate tchar vmot() 5497c478bd9Sstevel@tonic-gate { 5507c478bd9Sstevel@tonic-gate dfact = lss; 5517c478bd9Sstevel@tonic-gate vflag++; 5527c478bd9Sstevel@tonic-gate return(mot()); 5537c478bd9Sstevel@tonic-gate } 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate tchar hmot() 5577c478bd9Sstevel@tonic-gate { 5587c478bd9Sstevel@tonic-gate dfact = EM; 5597c478bd9Sstevel@tonic-gate return(mot()); 5607c478bd9Sstevel@tonic-gate } 5617c478bd9Sstevel@tonic-gate 5627c478bd9Sstevel@tonic-gate 5637c478bd9Sstevel@tonic-gate tchar mot() 5647c478bd9Sstevel@tonic-gate { 565e5190c10Smuffin int j, n; 566e5190c10Smuffin tchar i; 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate j = HOR; 5697c478bd9Sstevel@tonic-gate getch(); /*eat delim*/ 5707c478bd9Sstevel@tonic-gate if (n = atoi()) { 5717c478bd9Sstevel@tonic-gate if (vflag) 5727c478bd9Sstevel@tonic-gate j = VERT; 5737c478bd9Sstevel@tonic-gate i = makem(quant(n, j)); 5747c478bd9Sstevel@tonic-gate } else 5757c478bd9Sstevel@tonic-gate i = 0; 5767c478bd9Sstevel@tonic-gate getch(); 5777c478bd9Sstevel@tonic-gate vflag = 0; 5787c478bd9Sstevel@tonic-gate dfact = 1; 5797c478bd9Sstevel@tonic-gate return(i); 5807c478bd9Sstevel@tonic-gate } 5817c478bd9Sstevel@tonic-gate 5827c478bd9Sstevel@tonic-gate 5837c478bd9Sstevel@tonic-gate tchar sethl(k) 5847c478bd9Sstevel@tonic-gate int k; 5857c478bd9Sstevel@tonic-gate { 586e5190c10Smuffin int j; 5877c478bd9Sstevel@tonic-gate tchar i; 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gate j = EM / 2; 5907c478bd9Sstevel@tonic-gate if (k == 'u') 5917c478bd9Sstevel@tonic-gate j = -j; 5927c478bd9Sstevel@tonic-gate else if (k == 'r') 5937c478bd9Sstevel@tonic-gate j = -2 * j; 5947c478bd9Sstevel@tonic-gate vflag++; 5957c478bd9Sstevel@tonic-gate i = makem(j); 5967c478bd9Sstevel@tonic-gate vflag = 0; 5977c478bd9Sstevel@tonic-gate return(i); 5987c478bd9Sstevel@tonic-gate } 5997c478bd9Sstevel@tonic-gate 6007c478bd9Sstevel@tonic-gate 6017c478bd9Sstevel@tonic-gate tchar makem(i) 602e5190c10Smuffin int i; 6037c478bd9Sstevel@tonic-gate { 604e5190c10Smuffin tchar j; 6057c478bd9Sstevel@tonic-gate 6067c478bd9Sstevel@tonic-gate if ((j = i) < 0) 6077c478bd9Sstevel@tonic-gate j = -j; 6087c478bd9Sstevel@tonic-gate j |= MOT; 6097c478bd9Sstevel@tonic-gate if (i < 0) 6107c478bd9Sstevel@tonic-gate j |= NMOT; 6117c478bd9Sstevel@tonic-gate if (vflag) 6127c478bd9Sstevel@tonic-gate j |= VMOT; 6137c478bd9Sstevel@tonic-gate return(j); 6147c478bd9Sstevel@tonic-gate } 6157c478bd9Sstevel@tonic-gate 6167c478bd9Sstevel@tonic-gate 6177c478bd9Sstevel@tonic-gate tchar getlg(i) 6187c478bd9Sstevel@tonic-gate tchar i; 6197c478bd9Sstevel@tonic-gate { 6207c478bd9Sstevel@tonic-gate tchar j, k; 621e5190c10Smuffin int lf; 6227c478bd9Sstevel@tonic-gate 6237c478bd9Sstevel@tonic-gate if ((lf = fontbase[fbits(i)]->ligfont) == 0) /* font lacks ligatures */ 6247c478bd9Sstevel@tonic-gate return(i); 6257c478bd9Sstevel@tonic-gate j = getch0(); 6267c478bd9Sstevel@tonic-gate if (cbits(j) == 'i' && (lf & LFI)) 6277c478bd9Sstevel@tonic-gate j = LIG_FI; 6287c478bd9Sstevel@tonic-gate else if (cbits(j) == 'l' && (lf & LFL)) 6297c478bd9Sstevel@tonic-gate j = LIG_FL; 6307c478bd9Sstevel@tonic-gate else if (cbits(j) == 'f' && (lf & LFF)) { 6317c478bd9Sstevel@tonic-gate if ((lf & (LFFI|LFFL)) && lg != 2) { 6327c478bd9Sstevel@tonic-gate k = getch0(); 6337c478bd9Sstevel@tonic-gate if (cbits(k)=='i' && (lf&LFFI)) 6347c478bd9Sstevel@tonic-gate j = LIG_FFI; 6357c478bd9Sstevel@tonic-gate else if (cbits(k)=='l' && (lf&LFFL)) 6367c478bd9Sstevel@tonic-gate j = LIG_FFL; 6377c478bd9Sstevel@tonic-gate else { 6387c478bd9Sstevel@tonic-gate *pbp++ = k; 6397c478bd9Sstevel@tonic-gate j = LIG_FF; 6407c478bd9Sstevel@tonic-gate } 641*2bc98732SRichard Lowe } else 6427c478bd9Sstevel@tonic-gate j = LIG_FF; 6437c478bd9Sstevel@tonic-gate } else { 6447c478bd9Sstevel@tonic-gate *pbp++ = j; 6457c478bd9Sstevel@tonic-gate j = i; 6467c478bd9Sstevel@tonic-gate } 6477c478bd9Sstevel@tonic-gate return(i & SFMASK | j); 6487c478bd9Sstevel@tonic-gate } 6497c478bd9Sstevel@tonic-gate 6507c478bd9Sstevel@tonic-gate 651e5190c10Smuffin int 6527c478bd9Sstevel@tonic-gate caselg() 6537c478bd9Sstevel@tonic-gate { 6547c478bd9Sstevel@tonic-gate 6557c478bd9Sstevel@tonic-gate lg = 1; 6567c478bd9Sstevel@tonic-gate if (skip()) 657e5190c10Smuffin return (0); 6587c478bd9Sstevel@tonic-gate lg = atoi(); 659e5190c10Smuffin 660e5190c10Smuffin return (0); 6617c478bd9Sstevel@tonic-gate } 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gate 664e5190c10Smuffin int 6657c478bd9Sstevel@tonic-gate casefp() 6667c478bd9Sstevel@tonic-gate { 667e5190c10Smuffin int i, j; 668e5190c10Smuffin char *s; 6697c478bd9Sstevel@tonic-gate 6707c478bd9Sstevel@tonic-gate skip(); 6717c478bd9Sstevel@tonic-gate if ((i = cbits(getch()) - '0') <= 0 || i > nfonts) 6727c478bd9Sstevel@tonic-gate errprint(gettext("fp: bad font position %d"), i); 6737c478bd9Sstevel@tonic-gate else if (skip() || !(j = getrq())) 6747c478bd9Sstevel@tonic-gate errprint(gettext("fp: no font name")); 6757c478bd9Sstevel@tonic-gate else if (skip() || !getname()) 6767c478bd9Sstevel@tonic-gate setfp(i, j, 0); 6777c478bd9Sstevel@tonic-gate else /* 3rd argument = filename */ 6787c478bd9Sstevel@tonic-gate setfp(i, j, nextf); 679e5190c10Smuffin 680e5190c10Smuffin return (0); 6817c478bd9Sstevel@tonic-gate } 6827c478bd9Sstevel@tonic-gate 683e5190c10Smuffin int 6847c478bd9Sstevel@tonic-gate setfp(pos, f, truename) /* mount font f at position pos[0...nfonts] */ 6857c478bd9Sstevel@tonic-gate int pos, f; 6867c478bd9Sstevel@tonic-gate char *truename; 6877c478bd9Sstevel@tonic-gate { 688e5190c10Smuffin int k; 6897c478bd9Sstevel@tonic-gate int n; 6907c478bd9Sstevel@tonic-gate char longname[NS], shortname[20]; 6917c478bd9Sstevel@tonic-gate extern int nchtab; 6927c478bd9Sstevel@tonic-gate 6937c478bd9Sstevel@tonic-gate zapwcache(0); 6947c478bd9Sstevel@tonic-gate if (truename) 6957c478bd9Sstevel@tonic-gate strcpy(shortname, truename); 6967c478bd9Sstevel@tonic-gate else { 6977c478bd9Sstevel@tonic-gate shortname[0] = f & BYTEMASK; 6987c478bd9Sstevel@tonic-gate shortname[1] = f >> BYTE; 6997c478bd9Sstevel@tonic-gate shortname[2] = '\0'; 7007c478bd9Sstevel@tonic-gate } 7017c478bd9Sstevel@tonic-gate sprintf(longname, "%s/dev%s/%s.out", fontfile, devname, shortname); 7027c478bd9Sstevel@tonic-gate if ((k = open(longname, 0)) < 0) { 7037c478bd9Sstevel@tonic-gate errprint(gettext("Can't open %s"), longname); 7047c478bd9Sstevel@tonic-gate return(-1); 7057c478bd9Sstevel@tonic-gate } 7067c478bd9Sstevel@tonic-gate n = fontbase[pos]->nwfont & BYTEMASK; 7077c478bd9Sstevel@tonic-gate read(k, (char *) fontbase[pos], 3*n + nchtab + 128 - 32 + sizeof(struct Font)); 7087c478bd9Sstevel@tonic-gate kerntab[pos] = (char *) fontab[pos] + (fontbase[pos]->nwfont & BYTEMASK); 7097c478bd9Sstevel@tonic-gate /* have to reset the fitab pointer because the width may be different */ 7107c478bd9Sstevel@tonic-gate fitab[pos] = (char *) fontab[pos] + 3 * (fontbase[pos]->nwfont & BYTEMASK); 7117c478bd9Sstevel@tonic-gate if ((fontbase[pos]->nwfont & BYTEMASK) > n) { 7127c478bd9Sstevel@tonic-gate errprint(gettext("Font %s too big for position %d"), shortname, 7137c478bd9Sstevel@tonic-gate pos); 7147c478bd9Sstevel@tonic-gate return(-1); 7157c478bd9Sstevel@tonic-gate } 7167c478bd9Sstevel@tonic-gate fontbase[pos]->nwfont = n; /* so can load a larger one again later */ 7177c478bd9Sstevel@tonic-gate close(k); 7187c478bd9Sstevel@tonic-gate if (pos == smnt) { 719*2bc98732SRichard Lowe smnt = 0; 720*2bc98732SRichard Lowe sbold = 0; 7217c478bd9Sstevel@tonic-gate } 7227c478bd9Sstevel@tonic-gate if ((fontlab[pos] = f) == 'S') 7237c478bd9Sstevel@tonic-gate smnt = pos; 7247c478bd9Sstevel@tonic-gate bdtab[pos] = cstab[pos] = ccstab[pos] = 0; 7257c478bd9Sstevel@tonic-gate /* if there is a directory, no place to store its name. */ 7267c478bd9Sstevel@tonic-gate /* if position isn't zero, no place to store its value. */ 7277c478bd9Sstevel@tonic-gate /* only time a FONTPOS is pushed back is if it's a */ 7287c478bd9Sstevel@tonic-gate /* standard font on position 0 (i.e., mounted implicitly. */ 7297c478bd9Sstevel@tonic-gate /* there's a bug here: if there are several input lines */ 7307c478bd9Sstevel@tonic-gate /* that look like .ft XX in short successtion, the output */ 7317c478bd9Sstevel@tonic-gate /* will all be in the last one because the "x font ..." */ 7327c478bd9Sstevel@tonic-gate /* comes out too soon. pushing back FONTPOS doesn't work */ 7337c478bd9Sstevel@tonic-gate /* with .ft commands because input is flushed after .xx cmds */ 7347c478bd9Sstevel@tonic-gate ptfpcmd(pos, shortname); 7357c478bd9Sstevel@tonic-gate if (pos == 0) 7367c478bd9Sstevel@tonic-gate ch = (tchar) FONTPOS | (tchar) f << 16; 7377c478bd9Sstevel@tonic-gate return(pos); 7387c478bd9Sstevel@tonic-gate } 7397c478bd9Sstevel@tonic-gate 7407c478bd9Sstevel@tonic-gate 741e5190c10Smuffin int 7427c478bd9Sstevel@tonic-gate casecs() 7437c478bd9Sstevel@tonic-gate { 744e5190c10Smuffin int i, j; 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate noscale++; 7477c478bd9Sstevel@tonic-gate skip(); 7487c478bd9Sstevel@tonic-gate if (!(i = getrq()) || (i = findft(i)) < 0) 7497c478bd9Sstevel@tonic-gate goto rtn; 7507c478bd9Sstevel@tonic-gate skip(); 7517c478bd9Sstevel@tonic-gate cstab[i] = atoi(); 7527c478bd9Sstevel@tonic-gate skip(); 7537c478bd9Sstevel@tonic-gate j = atoi(); 7547c478bd9Sstevel@tonic-gate if (nonumb) 7557c478bd9Sstevel@tonic-gate ccstab[i] = 0; 7567c478bd9Sstevel@tonic-gate else 7577c478bd9Sstevel@tonic-gate ccstab[i] = findps(j); 7587c478bd9Sstevel@tonic-gate rtn: 7597c478bd9Sstevel@tonic-gate zapwcache(0); 7607c478bd9Sstevel@tonic-gate noscale = 0; 761e5190c10Smuffin 762e5190c10Smuffin return (0); 7637c478bd9Sstevel@tonic-gate } 7647c478bd9Sstevel@tonic-gate 7657c478bd9Sstevel@tonic-gate 766e5190c10Smuffin int 7677c478bd9Sstevel@tonic-gate casebd() 7687c478bd9Sstevel@tonic-gate { 769e5190c10Smuffin int i, j, k; 7707c478bd9Sstevel@tonic-gate 7717c478bd9Sstevel@tonic-gate zapwcache(0); 7727c478bd9Sstevel@tonic-gate k = 0; 7737c478bd9Sstevel@tonic-gate bd0: 7747c478bd9Sstevel@tonic-gate if (skip() || !(i = getrq()) || (j = findft(i)) == -1) { 7757c478bd9Sstevel@tonic-gate if (k) 7767c478bd9Sstevel@tonic-gate goto bd1; 777*2bc98732SRichard Lowe else 778e5190c10Smuffin return (0); 7797c478bd9Sstevel@tonic-gate } 7807c478bd9Sstevel@tonic-gate if (j == smnt) { 7817c478bd9Sstevel@tonic-gate k = smnt; 7827c478bd9Sstevel@tonic-gate goto bd0; 7837c478bd9Sstevel@tonic-gate } 7847c478bd9Sstevel@tonic-gate if (k) { 7857c478bd9Sstevel@tonic-gate sbold = j; 7867c478bd9Sstevel@tonic-gate j = k; 7877c478bd9Sstevel@tonic-gate } 7887c478bd9Sstevel@tonic-gate bd1: 7897c478bd9Sstevel@tonic-gate skip(); 7907c478bd9Sstevel@tonic-gate noscale++; 7917c478bd9Sstevel@tonic-gate bdtab[j] = atoi(); 7927c478bd9Sstevel@tonic-gate noscale = 0; 793e5190c10Smuffin 794e5190c10Smuffin return (0); 7957c478bd9Sstevel@tonic-gate } 7967c478bd9Sstevel@tonic-gate 7977c478bd9Sstevel@tonic-gate 798e5190c10Smuffin int 7997c478bd9Sstevel@tonic-gate casevs() 8007c478bd9Sstevel@tonic-gate { 801e5190c10Smuffin int i; 8027c478bd9Sstevel@tonic-gate 8037c478bd9Sstevel@tonic-gate skip(); 8047c478bd9Sstevel@tonic-gate vflag++; 8057c478bd9Sstevel@tonic-gate dfact = INCH; /* default scaling is points! */ 8067c478bd9Sstevel@tonic-gate dfactd = 72; 8077c478bd9Sstevel@tonic-gate res = VERT; 8087c478bd9Sstevel@tonic-gate i = inumb(&lss); 8097c478bd9Sstevel@tonic-gate if (nonumb) 8107c478bd9Sstevel@tonic-gate i = lss1; 811*2bc98732SRichard Lowe if (i < VERT) 8127c478bd9Sstevel@tonic-gate i = VERT; 8137c478bd9Sstevel@tonic-gate lss1 = lss; 8147c478bd9Sstevel@tonic-gate lss = i; 815e5190c10Smuffin 816e5190c10Smuffin return (0); 8177c478bd9Sstevel@tonic-gate } 8187c478bd9Sstevel@tonic-gate 8197c478bd9Sstevel@tonic-gate 820e5190c10Smuffin int 8217c478bd9Sstevel@tonic-gate casess() 8227c478bd9Sstevel@tonic-gate { 823e5190c10Smuffin int i; 8247c478bd9Sstevel@tonic-gate 8257c478bd9Sstevel@tonic-gate noscale++; 8267c478bd9Sstevel@tonic-gate skip(); 8277c478bd9Sstevel@tonic-gate if (i = atoi()) { 8287c478bd9Sstevel@tonic-gate spacesz = i & 0177; 8297c478bd9Sstevel@tonic-gate zapwcache(0); 8307c478bd9Sstevel@tonic-gate sps = width(' ' | chbits); 8317c478bd9Sstevel@tonic-gate } 8327c478bd9Sstevel@tonic-gate noscale = 0; 833e5190c10Smuffin 834e5190c10Smuffin return (0); 8357c478bd9Sstevel@tonic-gate } 8367c478bd9Sstevel@tonic-gate 8377c478bd9Sstevel@tonic-gate 8387c478bd9Sstevel@tonic-gate tchar xlss() 8397c478bd9Sstevel@tonic-gate { 8407c478bd9Sstevel@tonic-gate /* stores \x'...' into 8417c478bd9Sstevel@tonic-gate * two successive tchars. 8427c478bd9Sstevel@tonic-gate * the first contains HX, the second the value, 8437c478bd9Sstevel@tonic-gate * encoded as a vertical motion. 8447c478bd9Sstevel@tonic-gate * decoding is done in n2.c by pchar(). 8457c478bd9Sstevel@tonic-gate */ 8467c478bd9Sstevel@tonic-gate int i; 8477c478bd9Sstevel@tonic-gate 8487c478bd9Sstevel@tonic-gate getch(); 8497c478bd9Sstevel@tonic-gate dfact = lss; 8507c478bd9Sstevel@tonic-gate i = quant(atoi(), VERT); 8517c478bd9Sstevel@tonic-gate dfact = 1; 8527c478bd9Sstevel@tonic-gate getch(); 8537c478bd9Sstevel@tonic-gate if (i >= 0) 8547c478bd9Sstevel@tonic-gate *pbp++ = MOT | VMOT | i; 8557c478bd9Sstevel@tonic-gate else 8567c478bd9Sstevel@tonic-gate *pbp++ = MOT | VMOT | NMOT | -i; 8577c478bd9Sstevel@tonic-gate return(HX); 8587c478bd9Sstevel@tonic-gate } 859