diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-26 18:07:28 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-10-26 18:07:28 +0000 |
commit | dead96d50530a782ee738938c2c911a44e97bede (patch) | |
tree | 6df7784f41fd9f09ae92463e04d382575784394a /chars.c | |
parent | 5faa62e2445541401f9bee1667d1cd2b2e443e53 (diff) | |
download | mandoc-dead96d50530a782ee738938c2c911a44e97bede.tar.gz mandoc-dead96d50530a782ee738938c2c911a44e97bede.tar.zst mandoc-dead96d50530a782ee738938c2c911a44e97bede.zip |
In -Tascii mode, provide approximations even for some Unicode escape
sequences above codepoint 512 by doing a reverse lookup in the
existing mandoc_char(7) character table.
Again, groff isn't smart enough to do this and silently discards such
escape sequences without printing anything.
Diffstat (limited to 'chars.c')
-rw-r--r-- | chars.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.60 2014/10/26 17:12:03 schwarze Exp $ */ +/* $Id: chars.c,v 1.61 2014/10/26 18:07:28 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -149,6 +149,17 @@ mchars_spec2str(const struct mchars *arg, return(ln->ascii); } +const char * +mchars_uc2str(int uc) +{ + int i; + + for (i = 0; i < LINES_MAX; i++) + if (uc == lines[i].unicode) + return(lines[i].ascii); + return("<?>"); +} + static const struct ln * find(const struct mchars *tab, const char *p, size_t sz) { |