summaryrefslogtreecommitdiffstats
path: root/mandoc.1
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 22:32:45 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 22:32:45 +0000
commit71405e53b941d50754fb4041993c7ef5ad4c5654 (patch)
tree0a18494430e5b8fbe125f79052c2d8ab12d1d87c /mandoc.1
parentae85c53a20e295bcb9eecc8a2d24955c35392839 (diff)
downloadmandoc-71405e53b941d50754fb4041993c7ef5ad4c5654.tar.gz
Locale support. I'm checking this in to clean up fall-out in-tree, but
it looks pretty good. Basically, the -Tlocale option propogates into term_ascii.c, where we set locale-specific console call-backs IFF (1) setlocale() works; (2) locale support is compiled in (see Makefile for -DUSE_WCHAR); (3) the internal structure of wchar_t maps directly to Unicode codepoints as defined by __STDC_ISO_10646__; and (4) the console supports multi-byte characters. To date, this configuration only supports GNU/Linux. OpenBSD doesn't export __STDC_ISO_10646__ although I'm told by stsp@openbsd.org that it should (it has the correct map). Apparently FreeBSD is the same way. NetBSD? Don't know. Apple also supports this, but doesn't define the macro. Special-casing! Benchmark: -Tlocale incurs less than 0.2 factor overhead when run through several thousand manuals when UTF8 output is enabled. Native mode (whether directly -Tascii or through no locale or whatever) is UNCHANGED: the function callbacks are the same as before. Note. If the underlying system does NOT support STDC_ISO_10646, there is a "slow" version possible with iconv or other means of flipping from a Unicode codepoint to a wchar_t.
Diffstat (limited to 'mandoc.1')
-rw-r--r--mandoc.121
1 files changed, 20 insertions, 1 deletions
diff --git a/mandoc.1 b/mandoc.1
index 9626d171..c7c6fcc8 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -158,6 +158,12 @@ utility accepts the following
.Fl T
arguments, which correspond to output modes:
.Bl -tag -width Ds
+.It Fl T Ns Cm locale
+This option encodes output characters using the current
+.Xr locale 1
+configuration.
+See
+.Sx Locale Output .
.It Fl T Ns Cm ascii
Produce 7-bit ASCII output.
This is the default.
@@ -189,6 +195,16 @@ See
.Pp
If multiple input files are specified, these will be processed by the
corresponding filter in-order.
+.Ss Locale Output
+Locale-depending output encoding is triggered with
+.Fl T Ns Cm locale .
+This option is not available on all systems: systems without locale
+support, or those whose internal representation is not natively UCS-4,
+will fall back to
+.Fl T Ns Cm ascii .
+See
+.Sx ASCII Output
+for font style specification and available command-line arguments.
.Ss ASCII Output
Output produced by
.Fl T Ns Cm ascii ,
@@ -209,6 +225,9 @@ Emboldened characters are rendered as
The special characters documented in
.Xr mandoc_char 7
are rendered best-effort in an ASCII equivalent.
+If no equivalent is found,
+.Sq \&?
+is used instead.
.Pp
Output width is limited to 78 visible columns unless literal input lines
exceed this limit.
@@ -460,7 +479,7 @@ Each input and output format is separately noted.
.Ss ASCII Compatibility
.Bl -bullet -compact
.It
-Unicode codepoints specified with
+Unrenderable unicode codepoints specified with
.Sq \e[uNNNN]
escapes are printed as
.Sq \&?