void wide(char *s, char *fn, char *size) { char space[40]; if (point((intptr_t)s)) { fprintf(tabout, "\\w%c", F1); if (*fn>0) putfont(fn); if (*size) putsize(size); fprintf(tabout, "%s", s); if (*fn>0) putfont("P"); if (*size) putsize("0"); fprintf(tabout, "%c",F1); } else fprintf(tabout, "%s", nreg(space, sizeof(space), s, '-')); }
void wide(char *s, char *fn, char *size) { if (point(s)) { Bprint(&tabout, "\\w%c", F1); if (*fn > 0) putfont(fn); if (*size) putsize(size); Bprint(&tabout, "%s", s); if (*fn > 0) putfont("P"); if (*size) putsize("0"); Bprint(&tabout, "%c", F1); } else Bprint(&tabout, "\\n(%c-", (int)(uintptr)s); }
void puttext(char *s, char *fn, char *size) { if (point(s)) { putfont(fn); putsize(size); fprintf(tabout, "%s",s); if (*fn>0) fprintf(tabout, "\\f\\n(%2d", S1); if (size!=0) putsize("0"); } }
static void do_loadfont(int fd, char *inbuf, int width, int height, int hwunit, int fontsize, char *filename) { unsigned char *buf; int i, buflen; int bytewidth = (width+7)/8; int charsize = height * bytewidth; int kcharsize = 32 * bytewidth; int bad_video_erase_char = 0; if (height < 1 || height > 32) { fprintf(stderr, _("Bad character height %d\n"), height); exit(EX_DATAERR); } if (width < 1 || width > 32) { fprintf(stderr, _("Bad character width %d\n"), width); exit(EX_DATAERR); } if (!hwunit) hwunit = height; buflen = kcharsize * ((fontsize < 128) ? 128 : fontsize); buf = xmalloc(buflen); memset(buf,0,buflen); for (i = 0; i < fontsize; i++) memcpy(buf+(i*kcharsize), inbuf+(i*charsize), charsize); /* * Due to a kernel bug, font position 32 is used * to erase the screen, regardless of maps loaded. * So, usually this font position should be blank. */ if (erase_mode) { for (i = 0; i < kcharsize; i++) if (buf[32*kcharsize+i]) bad_video_erase_char = 1; if (bad_video_erase_char) { fprintf(stderr, _("%s: font position 32 is nonblank\n"), progname); switch(erase_mode) { case 3: exit(EX_DATAERR); case 2: for (i = 0; i < kcharsize; i++) buf[32*kcharsize+i] = 0; fprintf(stderr, _("%s: wiped it\n"), progname); break; case 1: fprintf(stderr, _("%s: background will look funny\n"), progname); } fflush(stderr); sleep(2); } } if (verbose) { if (height == hwunit && filename) printf(_("Loading %d-char %dx%d font from file %s\n"), fontsize, width, height, filename); else if (height == hwunit) printf(_("Loading %d-char %dx%d font\n"), fontsize, width, height); else if (filename) printf(_("Loading %d-char %dx%d (%d) font from file %s\n"), fontsize, width, height, hwunit, filename); else printf(_("Loading %d-char %dx%d (%d) font\n"), fontsize, width, height, hwunit); } if (putfont(fd, buf, fontsize, width, hwunit)) exit(EX_OSERR); }
void funnies(int stl, int lin) { /* write out funny diverted things */ int c, s, pl, lwid, dv, lf, ct; char *fn; fprintf(tabout, ".mk ##\n"); /* rmember current vertical position */ fprintf(tabout, ".nr %d \\n(##\n", S1); /* bottom position */ for(c=0; c<ncol; c++) { s = (int)table[lin][c].col; if (point(s)) continue; if (s==0) continue; fprintf(tabout, ".sp |\\n(##u-1v\n"); fprintf(tabout, ".nr %d ", SIND); for(pl=stl; pl>=0 && !isalpha(ct=ctype(pl,c)); pl=prev(pl)) ; switch (ct) { case 'n': case 'c': fprintf(tabout, "(\\n(%du+\\n(%du-\\n(%c-u)/2u\n",c+CLEFT,c-1+ctspan(lin,c)+CRIGHT, s); break; case 'l': fprintf(tabout, "\\n(%du\n",c+CLEFT); break; case 'a': fprintf(tabout, "\\n(%du\n",c+CMID); break; case 'r': fprintf(tabout, "\\n(%du-\\n(%c-u\n", c+CRIGHT, s); break; } fprintf(tabout, ".in +\\n(%du\n", SIND); fn=font[stynum[stl]][c]; putfont(fn); pl = prev(stl); if (stl>0 && pl>=0 && vspen(table[pl][c].col)) { fprintf(tabout, ".sp |\\n(^%cu\n", 'a'+c); if (ctop[stynum[stl]][c]==0) { fprintf(tabout, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n",TMP, 'a'+c, s); fprintf(tabout, ".if \\n(%d>0 .sp \\n(%du/2u\n", TMP, TMP); } } fprintf(tabout, ".%c+\n",s); fprintf(tabout, ".in -\\n(%du\n", SIND); if (*fn>0) putfont("P"); fprintf(tabout, ".mk %d\n", S2); fprintf(tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2); } fprintf(tabout, ".sp |\\n(%du\n", S1); for(c=dv=0; c<ncol; c++) { if (stl+1< nlin && (lf=left(stl,c,&lwid))>=0) { if (dv++ == 0) fprintf(tabout, ".sp -1\n"); tohcol(c); dv++; drawvert(lf, stl, c, lwid); } } if (dv) fprintf(tabout,"\n"); }