aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ps.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-25 18:53:14 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-25 18:53:14 +0000
commitd7293bc22cd91ff63e04800adfed0982252d8574 (patch)
tree74bc47d73e12087b65abc5914862898a9dc96a12 /term_ps.c
parenteb93fb04842bea580dd14f70d9688486882b69fe (diff)
downloadmandoc-d7293bc22cd91ff63e04800adfed0982252d8574.tar.gz
mandoc-d7293bc22cd91ff63e04800adfed0982252d8574.tar.zst
mandoc-d7293bc22cd91ff63e04800adfed0982252d8574.zip
Initial chunks for variable-width fonts. Pushes all width calculations
in mdoc_term.c and man_term.c down into term.c. This is still not implemented in term.c, although stubs for width calculations are in place. From now on, offset, rmargin, and other layout variables are abstract screen widths. They will resolve to the the familiar values for -Tascii but -Tps will eventually use points instead of chars.
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/term_ps.c b/term_ps.c
index 56d1be24..7d6891d9 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.10 2010/06/19 20:46:28 kristaps Exp $ */
+/* $Id: term_ps.c,v 1.11 2010/06/25 18:53:14 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -60,6 +60,7 @@ static void ps_end(struct termp *);
static void ps_advance(struct termp *, size_t);
static void ps_endline(struct termp *);
static void ps_fclose(struct termp *);
+static size_t ps_width(const struct termp *, char);
static void ps_pclose(struct termp *);
static void ps_pletter(struct termp *, char);
static void ps_printf(struct termp *, const char *, ...);
@@ -75,12 +76,16 @@ ps_alloc(void)
if (NULL == (p = term_alloc(TERMENC_ASCII)))
return(NULL);
+ p->defrmargin = 78;
+ p->tabwidth = 5;
+
p->type = TERMTYPE_PS;
p->letter = ps_letter;
p->begin = ps_begin;
p->end = ps_end;
p->advance = ps_advance;
p->endline = ps_endline;
+ p->width = ps_width;
return(p);
}
@@ -425,3 +430,10 @@ ps_setfont(struct termp *p, enum termfont f)
p->engine.ps.lastf = f;
}
+
+static size_t
+ps_width(const struct termp *p, char c)
+{
+
+ return(1);
+}