=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.147 retrieving revision 1.150 diff -u -p -r1.147 -r1.150 --- mandoc/term.c 2010/06/11 07:23:04 1.147 +++ mandoc/term.c 2010/06/26 15:36:37 1.150 @@ -1,6 +1,6 @@ -/* $Id: term.c,v 1.147 2010/06/11 07:23:04 kristaps Exp $ */ +/* $Id: term.c,v 1.150 2010/06/26 15:36:37 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -31,8 +31,6 @@ #include "chars.h" #include "out.h" #include "term.h" -#include "man.h" -#include "mdoc.h" #include "main.h" static void spec(struct termp *, const char *, size_t); @@ -87,9 +85,7 @@ term_alloc(enum termenc enc) exit(EXIT_FAILURE); } - p->tabwidth = 5; p->enc = enc; - p->defrmargin = 78; return(p); } @@ -626,8 +622,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 +678,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;