summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorwl <wl>2010-12-13 15:30:19 +0000
committerwl <wl>2010-12-13 15:30:19 +0000
commitd5d8909e11e0c613f7a1dfba3a20a405ae7b4da4 (patch)
tree88c9d26db241f5a613239e1372eb22ff239070cc /man
parent67525a8a24c8a0a7d6413de6814c8901f9401a39 (diff)
downloadgroff-d5d8909e11e0c613f7a1dfba3a20a405ae7b4da4.tar.gz
Implement support for character classes.
This patch uses standard C++ headers, contrary to the rest of groff. Ideally, everything in groff should be updated to do the same. * src/include/font.h (glyph_to_unicode): New function. * src/libs/libgroff/font.cpp (glyph_to_unicode): Implement it. (font::contains, font::get_code): Use it. * src/roff/troff/charinfo.h: Include <vector> and <utility>. (charinfo): New members `ranges' and `nested_classes'. New member functions `get_unicode_code' and `get_flags'. New member functions `add_to_class', `is_class', and `contains'. (charinfo::overlaps_horizontally, charinfo::overlaps_vertically, charinfo::can_break_before, charinfo::can_break_after, charinfo::can_break_after, charinfo::ends_sentence, charinfo::transparent,, charinfo:ignore_hcodes): Use `get_flags', which handles character classes also. * src/roff/troff/input.cpp (char_class_dictionary): New global variable. (define_class): New function. (init_input_requests): Register `class'. (charinfo::get_unicode_code, charinfo::get_flags, charinfo::contains): Implement it. * NEWS, doc/groff.texinfo (Character Classes), man/groff_diff.man, man/groff.man: Document it.
Diffstat (limited to 'man')
-rw-r--r--man/groff.man11
-rw-r--r--man/groff_diff.man65
2 files changed, 55 insertions, 21 deletions
diff --git a/man/groff.man b/man/groff.man
index c89dcfdd..8ec260c0 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -5,7 +5,7 @@ groff.man
This file is part of groff, the GNU roff type-setting system.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009
+ 2009, 2010
Free Software Foundation, Inc.
written by Bernd Warken <bwarken@mayn.de>
maintained by Werner Lemberg <wl@gnu.org>
@@ -1312,6 +1312,15 @@ Chop the last character off macro, string, or diversion
.IR object .
.
.TPx
+.REQ .class "name c1 c2 .\|.\|.\&"
+Assign a set of characters, character ranges, or classes
+.IR c1 ,
+.IR c2 ,
+.I .\|.\|.\&
+to
+.IR name .
+.
+.TPx
.REQ .close "stream"
Close the
.IR stream .
diff --git a/man/groff_diff.man b/man/groff_diff.man
index 115c6d26..e0d355ea 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -138,7 +138,7 @@ Interpolate string
taking
.IR arg1 ,
.IR arg2 ,
-.I .\|.\|.\&
+.IR .\|.\|. ,
as arguments.
.
.TP
@@ -965,10 +965,11 @@ This is the same as
.BR \[rs]p .
.
.TP
-.BI .cflags\ n\ c1\ c2\|.\|.\|.\&
+.BI .cflags\ "n c1 c2 .\|.\|."
Characters
.IR c1 ,
-.IR c2 ,\|.\|.\|.\&
+.IR c2 ,
+.IR .\|.\|. ,
have properties determined by
.IR n ,
which is ORed from the following:
@@ -1093,6 +1094,21 @@ This is useful for removing the newline from the end of diversions
that are to be interpolated as strings.
.
.TP
+.BI .class\ "name c1 c2 .\|.\|."
+Assign
+.I name
+to a set of characters
+.IR c1 ,
+.IR c2 ,
+.IR .\|.\|. ,
+so that they can be referred to from other requests easily (currently
+.B .cflags
+only).
+Character ranges (indicated by an intermediate `-') and nested classes
+are possible also.
+This is useful to assign properties to a large set of characters.
+.
+.TP
.BI .close\ stream
Close the stream named
.IR stream ;
@@ -1394,12 +1410,13 @@ request but before the list of fonts declared with
.BR .special .
.
.TP
-.BI .fspecial\ f\ s1\ s2\|.\|.\|.\&
+.BI .fspecial\ "f s1 s2 .\|.\|."
When the current font is\~\c
.IR f ,
fonts
.IR s1 ,
-.IR s2 ,\|.\|.\|.\&
+.IR s2 ,
+.IR .\|.\|. ,
are special, that is, they are searched for glyphs not in
the current font.
.
@@ -1470,7 +1487,7 @@ is missing,
switch to the previous glyph color.
.
.TP
-.BI .hcode \ c1\ code1\ c2\ code2\|.\|.\|.\&
+.BI .hcode\ "c1 code1 c2 code2 .\|.\|."
Set the hyphenation code of character
.I c1
to
@@ -1478,7 +1495,8 @@ to
and that of
.I c2
to
-.IR code2 .
+.IR code2 ,
+and so on.
A hyphenation code must be a single input character (not a special
character) other than a digit or a space.
.
@@ -1625,7 +1643,7 @@ except that the hyphenation patterns from
are appended to the patterns already loaded in the current language.
.
.TP
-.BI .hpfcode\ a\ b\ c\ d\ .\|.\|.
+.BI .hpfcode\ "a b c d .\|.\|."
After reading a hyphenation patterns file with the
.B hpf
or
@@ -1930,10 +1948,11 @@ and
with a positive value which are applied after the line is output.
.
.TP
-.BI .rchar\ c1\ c2\|.\|.\|.\&
+.BI .rchar\ "c1 c2 .\|.\|."
Remove the definitions of glyphs
.IR c1 ,
-.IR c2 ,\|.\|.\|.
+.IR c2 ,
+.I .\|.\|.
This undoes the effect of a
.B char
request.
@@ -1948,10 +1967,11 @@ from the macro one level higher.
No effect otherwise.
.
.TP
-.BI .rfschar\ c1\ c2\|.\|.\|.\&
+.BI .rfschar\ "c1 c2 .\|.\|."
Remove the font-specific definitions of glyphs
.IR c1 ,
-.IR c2 ,\|.\|.\|.
+.IR c2 ,
+.I .\|.\|.
This undoes the effect of a
.B fschar
request.
@@ -2039,7 +2059,7 @@ is missing, arguments are shifted by\~1.
Shifting by negative amounts is currently undefined.
.
.TP
-.BI .sizes\ s1\ s2\|.\|.\|.\|sn\ [0]
+.BI .sizes\ s1\ s2\ .\|.\|.\ sn\ [0]
This command is similar to the
.B sizes
command of a
@@ -2048,7 +2068,8 @@ file.
.
It sets the available font sizes for the current font to
.IR s1 ,
-.IR s2 ,\|.\|.\|.\|,\~ sn
+.IR s2 ,
+.IR .\|.\|.\| ,\~ sn
scaled points.
.
The list of sizes can be terminated by an optional\~\c
@@ -2063,10 +2084,11 @@ Contrary to the font file command, the list can't extend over more
than a single line.
.
.TP
-.BI .special\ s1\ s2\|.\|.\|.\&
+.BI .special\ "s1 s2 .\|.\|."
Fonts
.IR s1 ,
-.IR s2 ,\|.\|.\|.\&
+.IR s2 ,
+.IR .\|.\|. ,
are special and are searched for glyphs not in the current
font.
.
@@ -2563,18 +2585,21 @@ In GNU troff, as in UNIX troff, you should always follow a sentence
with either a newline or two spaces.
.
.TP
-.BI .ta\ n1\ n2\|.\|.\|.nn \ T\ r1\ r2\|.\|.\|.\|rn
+.BI .ta\ "n1 n2 .\|.\|. nn " "T " "r1 r2 .\|.\|. rn"
Set tabs at positions
.IR n1 ,
-.IR n2 ,\|.\|.\|.\|,
+.IR n2 ,
+.IR .\|.\|. ,
.I nn
and then set tabs at
.IR nn \|+\| r1 ,
-.IR nn \|+\| r2 ,\|.\|.\|.\|,
+.IR nn \|+\| r2 ,
+.IR .\|.\|. ,
.IR nn \|+\| rn
and then at
.IR nn \|+\| rn \|+\| r1 ,
-.IR nn \|+\| rn \|+\| r2 ,\|.\|.\|.\|,
+.IR nn \|+\| rn \|+\| r2 ,
+.IR .\|.\|. ,
.IR nn \|+\| rn \|+\| rn ,
and so on.
For example,