aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ps.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-28 22:46:21 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-28 22:46:21 +0000
commit7e1ed558d5e8927b3247d0f3d61fc05fb041fe09 (patch)
treeaa773e94e78e29e0d27812e787bea713f85f0a1e /term_ps.c
parent73266d633e50a3e89302fd69beaabdfacbe14a5d (diff)
downloadmandoc-7e1ed558d5e8927b3247d0f3d61fc05fb041fe09.tar.gz
mandoc-7e1ed558d5e8927b3247d0f3d61fc05fb041fe09.tar.zst
mandoc-7e1ed558d5e8927b3247d0f3d61fc05fb041fe09.zip
This enables variable glyph-width output. The checkin will be followed
by a [functionless] clean-up in term_ps.c, but this makes the appropriate changes to "enable" initial proportional-width functionality in term.c and fixes some areas of term_ps.c that were causing errors.
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/term_ps.c b/term_ps.c
index fbe4d0c5..00bede51 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.13 2010/06/28 13:45:28 kristaps Exp $ */
+/* $Id: term_ps.c,v 1.14 2010/06/28 22:46:21 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -387,9 +387,7 @@ ps_alloc(void)
if (NULL == (p = term_alloc(TERMENC_ASCII)))
return(NULL);
- p->defrmargin = 78;
- p->tabwidth = 5;
-
+ p->defrmargin = 612 - (PS_CHAR_LEFT * 2);
p->type = TERMTYPE_PS;
p->letter = ps_letter;
p->begin = ps_begin;
@@ -551,6 +549,7 @@ ps_begin(struct termp *p)
static void
ps_pletter(struct termp *p, int c)
{
+ int f;
/*
* If we're not in a PostScript "word" context, then open one
@@ -585,21 +584,17 @@ ps_pletter(struct termp *p, int c)
/* Write the character and adjust where we are on the page. */
- /*
- * FIXME: at this time we emit only blacnks on non-ASCII
- * letters.
- */
+ f = (int)p->engine.ps.lastf;
- if (c < 32 || (c - 32 > MAXCHAR)) {
+ if (c <= 32 || (c - 32 > MAXCHAR)) {
ps_putchar(p, ' ');
- p->engine.ps.pscol +=
- (fonts[p->engine.ps.lastf].gly[32].wx / 100);
+ p->engine.ps.pscol += (fonts[f].gly[0].wx / 100);
return;
}
ps_putchar(p, c);
- p->engine.ps.pscol +=
- (fonts[p->engine.ps.lastf].gly[(int)c - 32].wx / 100);
+ c -= 32;
+ p->engine.ps.pscol += (fonts[f].gly[c].wx / 100);
}
@@ -709,8 +704,7 @@ ps_advance(struct termp *p, size_t len)
*/
ps_fclose(p);
- p->engine.ps.pscol += 0 == len ? 0 :
- len * (fonts[p->engine.ps.lastf].gly[0].wx / 100);
+ p->engine.ps.pscol += len;
}
@@ -763,5 +757,9 @@ static size_t
ps_width(const struct termp *p, char c)
{
- return(1);
+ if (c <= 32 || c - 32 >= MAXCHAR)
+ return(fonts[(int)TERMFONT_NONE].gly[0].wx / 100);
+
+ c -= 32;
+ return(fonts[(int)TERMFONT_NONE].gly[(int)c].wx / 100);
}