version 1.154, 2010/06/28 23:26:09 |
version 1.158, 2010/07/03 16:02:12 |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "chars.h" |
#include "chars.h" |
#include "out.h" |
#include "out.h" |
|
#include "regs.h" |
#include "term.h" |
#include "term.h" |
#include "main.h" |
#include "main.h" |
|
|
Line 377 res(struct termp *p, const char *word, size_t len) |
|
Line 378 res(struct termp *p, const char *word, size_t len) |
|
size_t sz; |
size_t sz; |
|
|
rhs = chars_a2res(p->symtab, word, len, &sz); |
rhs = chars_a2res(p->symtab, word, len, &sz); |
|
if (NULL == rhs) { |
|
rhs = roff_getstrn(word, len); |
|
if (rhs) |
|
sz = strlen(rhs); |
|
} |
if (rhs) |
if (rhs) |
encode(p, rhs, sz); |
encode(p, rhs, sz); |
} |
} |
Line 653 term_strlen(const struct termp *p, const char *cp) |
|
Line 659 term_strlen(const struct termp *p, const char *cp) |
|
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
size_t |
size_t |
term_vspan(const struct termp *p, const struct roffsu *su) |
term_vspan(const struct termp *p, const struct roffsu *su) |
{ |
{ |
Line 692 term_vspan(const struct termp *p, const struct roffsu |
|
Line 699 term_vspan(const struct termp *p, const struct roffsu |
|
size_t |
size_t |
term_hspan(const struct termp *p, const struct roffsu *su) |
term_hspan(const struct termp *p, const struct roffsu *su) |
{ |
{ |
double r; |
double v; |
|
|
/* XXX: CM, IN, and PT are approximations. */ |
v = ((*p->hspan)(p, su)); |
|
if (v < 0.0) |
switch (su->unit) { |
v = 0.0; |
case (SCALE_CM): |
return((size_t) /* LINTED */ |
r = 4 * su->scale; |
v); |
break; |
|
case (SCALE_IN): |
|
/* XXX: this is an approximation. */ |
|
r = 10 * su->scale; |
|
break; |
|
case (SCALE_PC): |
|
r = (10 * su->scale) / 6; |
|
break; |
|
case (SCALE_PT): |
|
r = (10 * su->scale) / 72; |
|
break; |
|
case (SCALE_MM): |
|
r = su->scale / 1000; /* FIXME: double-check. */ |
|
break; |
|
case (SCALE_VS): |
|
r = su->scale * 2 - 1; /* FIXME: double-check. */ |
|
break; |
|
default: |
|
r = su->scale; |
|
break; |
|
} |
|
|
|
if (r < 0.0) |
|
r = 0.0; |
|
return((size_t)/* LINTED */ |
|
r); |
|
} |
} |
|
|
|
|