=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.148 retrieving revision 1.149 diff -u -p -r1.148 -r1.149 --- mandoc/term.c 2010/06/19 20:46:28 1.148 +++ mandoc/term.c 2010/06/25 18:53:14 1.149 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.148 2010/06/19 20:46:28 kristaps Exp $ */ +/* $Id: term.c,v 1.149 2010/06/25 18:53:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -87,9 +87,7 @@ term_alloc(enum termenc enc) exit(EXIT_FAILURE); } - p->tabwidth = 5; p->enc = enc; - p->defrmargin = 78; return(p); } @@ -626,8 +624,28 @@ encode(struct termp *p, const char *word, size_t sz) size_t -term_vspan(const struct roffsu *su) +term_len(const struct termp *p, size_t sz) { + + return((*p->width)(p, ' ') * sz); +} + + +size_t +term_strlen(const struct termp *p, const char *cp) +{ + size_t sz; + + for (sz = 0; *cp; cp++) + sz += (*p->width)(p, *cp); + + return(sz); +} + + +size_t +term_vspan(const struct termp *p, const struct roffsu *su) +{ double r; switch (su->unit) { @@ -662,7 +680,7 @@ term_vspan(const struct roffsu *su) size_t -term_hspan(const struct roffsu *su) +term_hspan(const struct termp *p, const struct roffsu *su) { double r;