ref: 7b4bb892da4ef601a97b40c3082320662dac2cb5
parent: 7e4c525d86df55de3f726b5718c739d4bb0dce5c
author: Ali Gholami Rudi <ali@rudi.ir>
date: Mon Mar 10 19:25:12 EDT 2014
out: simply ignore unknown characters Unknown characters used to be sent to neatpost and their widths were assumed to be SC_DW.
--- a/out.c
+++ b/out.c
@@ -125,16 +125,19 @@
static void outc(char *c)
{
struct glyph *g = dev_glyph(c, o_f);
- int cwid = charwid(o_f, o_s, g ? g->wid : SC_DW);
- int bwid = DEVWID(o_s, g ? g->wid : SC_DW);
- if (g && font_mapped(g->font, c))
+ int cwid, bwid;
+ if (!g)
+ return;
+ cwid = charwid(o_f, o_s, g->wid);
+ bwid = DEVWID(o_s, g->wid);
+ if (font_mapped(g->font, c))
c = g->name;
if (dev_getcs(o_f))
outnn("h%d", (cwid - bwid) / 2);
- outg(c, g ? dev_fontpos(g->font) : o_f);
+ outg(c, dev_fontpos(g->font));
if (dev_getbd(o_f)) {
outnn("h%d", dev_getbd(o_f) - 1);
- outg(c, g ? dev_fontpos(g->font) : o_f);
+ outg(c, dev_fontpos(g->font));
outnn("h%d", -dev_getbd(o_f) + 1);
}
if (dev_getcs(o_f))
--- a/ren.c
+++ b/ren.c
@@ -259,7 +259,7 @@
static int zwid(void)
{
struct glyph *g = dev_glyph("0", n_f);
- return charwid(n_f, n_s, g ? g->wid : SC_DW);
+ return charwid(n_f, n_s, g ? g->wid : 0);
}
/* append the line number to the output line */
--- a/roff.h
+++ b/roff.h
@@ -51,7 +51,6 @@
#define SC_IN (dev_res) /* inch in units */
#define SC_PT (SC_IN / 72) /* point in units */
#define SC_EM (n_s * SC_IN / 72)
-#define SC_DW (SC_EM / 3) /* default width */
/* escape sequences */
#define ESC_Q "bCDhHlLNoSvwxX" /* \X'ccc' quoted escape sequences */
--- a/wb.c
+++ b/wb.c
@@ -208,7 +208,7 @@
SDEVWID(wb->s, g->lly),
SDEVWID(wb->s, g->urx),
SDEVWID(wb->s, g->ury));
- wb->h += charwid(wb->f, wb->s, g ? g->wid : SC_DW);
+ wb->h += charwid(wb->f, wb->s, g ? g->wid : 0);
wb->ct |= g ? g->type : 0;
wb_stsb(wb);
}
@@ -443,7 +443,7 @@
static int wb_dashwid(struct wb *wb)
{
struct glyph *g = dev_glyph("hy", R_F(wb));
- return charwid(R_F(wb), R_S(wb), g ? g->wid : SC_DW);
+ return charwid(R_F(wb), R_S(wb), g ? g->wid : 0);
}
/* the position marked with \% */