summaryrefslogtreecommitdiffstats
path: root/term_ps.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-14 17:54:42 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-14 17:54:42 +0000
commitc6f3075846c286cebabf731303d52660dd30afe8 (patch)
tree7fc3844d639c5d82fd378b30e3461c0fc7f04174 /term_ps.c
parent121fc3d4eff42f9400d7e165b83c068757148a7b (diff)
downloadmandoc-c6f3075846c286cebabf731303d52660dd30afe8.tar.gz
Make character engine (-Tascii, -Tpdf, -Tps) ready for Unicode: make buffer
consist of type "int". This will take more work (especially in encode and friends), but this is a strong start. This commit also consists of some harmless lint fixes.
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/term_ps.c b/term_ps.c
index f58db20f..d5d9221f 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -373,14 +373,14 @@ ps_growbuf(struct termp *p, size_t sz)
static double ps_hspan(const struct termp *,
const struct roffsu *);
-static size_t ps_width(const struct termp *, char);
+static size_t ps_width(const struct termp *, int);
static void ps_advance(struct termp *, size_t);
static void ps_begin(struct termp *);
static void ps_closepage(struct termp *);
static void ps_end(struct termp *);
static void ps_endline(struct termp *);
static void ps_fclose(struct termp *);
-static void ps_letter(struct termp *, char);
+static void ps_letter(struct termp *, int);
static void ps_pclose(struct termp *);
static void ps_pletter(struct termp *, int);
static void ps_printf(struct termp *, const char *, ...);
@@ -963,9 +963,12 @@ ps_fclose(struct termp *p)
static void
-ps_letter(struct termp *p, char c)
+ps_letter(struct termp *p, int arg)
{
- char cc;
+ char cc, c;
+
+ /* LINTED */
+ c = arg >= 128 || arg <= 0 ? '?' : arg;
/*
* State machine dictates whether to buffer the last character
@@ -1095,14 +1098,14 @@ ps_setfont(struct termp *p, enum termfont f)
/* ARGSUSED */
static size_t
-ps_width(const struct termp *p, char c)
+ps_width(const struct termp *p, int c)
{
if (c <= 32 || c - 32 >= MAXCHAR)
return((size_t)fonts[(int)TERMFONT_NONE].gly[0].wx);
c -= 32;
- return((size_t)fonts[(int)TERMFONT_NONE].gly[(int)c].wx);
+ return((size_t)fonts[(int)TERMFONT_NONE].gly[c].wx);
}