summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2002-11-12 08:49:58 +0000
committerwlemb <wlemb>2002-11-12 08:49:58 +0000
commitbf58bd61420c5408840c46b3dce358b34835d9e6 (patch)
treec5d26a0b8ad3680e9655c6c82af34d37940d07e6
parentdee6a2a67bfae95ed12fa2bcedf39815ecc29f5f (diff)
downloadgroff-bf58bd61420c5408840c46b3dce358b34835d9e6.tar.gz
Added three new requests `schar', `fschar', and `rfschar'. `schar'
defines a glyph which is searched after the check for fonts declared with `.special' (and before the check for all mounted special fonts). `fschar' defines a glyph for a particular font which is searched after the check for fonts declared with `.fspecial' (and before the check for fonts declared with `.special'). `rfschar' removes glyphs defined with `fschar'. * src/roff/troff/token.h (char_mode): New enum. Declare do_define_character. * src/roff/troff/charinfo.h (charinfo): Replace `fallback' with `mode'. (charinfo::is_fallback): Updated. (charinfo::is_special): New method. * src/roff/troff/input.cc (do_define_character): Add and use optional second parameter used as a prefix for font-specific glyph names. (define_character, define_fallback_character): Updated. (define_special_character): New function. (init_input_requests): Add `schar'. (charinfo::charinfo, charinfo::set_macro): Updated. * src/roff/troff/node.cc: Include `stringclass.h'. (make_glyph_node): Handle special glyphs defined with `.schar' and `.fschar'. (define_font_special_character, remove_font_special_character): New functions. (init_node_requests): Sorted. Add `fschar' and `rfschar'. * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo: Document new requests. * font/devhtml/R.proto, font/devutf8/R.proto: Add `va'. * tmac/dvi.tmac: Add `va' for CW and CWI (using `.fschar').
-rw-r--r--ChangeLog36
-rw-r--r--NEWS13
-rw-r--r--doc/groff.texinfo51
-rw-r--r--font/devhtml/R.proto1
-rw-r--r--font/devutf8/R.proto1
-rw-r--r--man/groff.man26
-rw-r--r--man/groff_diff.man185
-rw-r--r--src/roff/troff/charinfo.h14
-rw-r--r--src/roff/troff/input.cc27
-rw-r--r--src/roff/troff/node.cc82
-rw-r--r--src/roff/troff/token.h9
-rw-r--r--tmac/dvi.tmac2
12 files changed, 339 insertions, 108 deletions
diff --git a/ChangeLog b/ChangeLog
index bba17f85..e4dd9973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2002-11-10 Werner LEMBERG <wl@gnu.org>
+
+ Added three new requests `schar', `fschar', and `rfschar'. `schar'
+ defines a glyph which is searched after the check for fonts declared
+ with `.special' (and before the check for all mounted special
+ fonts). `fschar' defines a glyph for a particular font which is
+ searched after the check for fonts declared with `.fspecial' (and
+ before the check for fonts declared with `.special'). `rfschar'
+ removes glyphs defined with `fschar'.
+
+ * src/roff/troff/token.h (char_mode): New enum.
+ Declare do_define_character.
+ * src/roff/troff/charinfo.h (charinfo): Replace `fallback' with
+ `mode'.
+ (charinfo::is_fallback): Updated.
+ (charinfo::is_special): New method.
+ * src/roff/troff/input.cc (do_define_character): Add and use
+ optional second parameter used as a prefix for font-specific glyph
+ names.
+ (define_character, define_fallback_character): Updated.
+ (define_special_character): New function.
+ (init_input_requests): Add `schar'.
+ (charinfo::charinfo, charinfo::set_macro): Updated.
+ * src/roff/troff/node.cc: Include `stringclass.h'.
+ (make_glyph_node): Handle special glyphs defined with `.schar' and
+ `.fschar'.
+ (define_font_special_character, remove_font_special_character): New
+ functions.
+ (init_node_requests): Sorted.
+ Add `fschar' and `rfschar'.
+ * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo:
+ Document new requests.
+
+ * font/devhtml/R.proto, font/devutf8/R.proto: Add `va'.
+ * tmac/dvi.tmac: Add `va' for CW and CWI (using `.fschar').
+
2002-11-08 Werner LEMBERG <wl@gnu.org>
Added new font `SC' (cmtex10) to devdvi.
diff --git a/NEWS b/NEWS
index 3effed76..0eb5a3da 100644
--- a/NEWS
+++ b/NEWS
@@ -41,7 +41,18 @@ o Composite glyphs are now supported. To do this, a subset of the Adobe
for more details.
o The font cmtex10 has been added as the special font `SC' to the DVI fonts.
- It is used for CW and CWI.
+ It is used as a font-specific special font for CW and CWI.
+
+o A new request `fschar' has been added to define font-specific fallback
+ characters. They are searched after the list of fonts declared with the
+ `fspecial' request but before the list of fonts declared with `special'.
+
+o Fallback characters defined with `fschar' can be removed with the
+ new `rfschar' request.
+
+o A new request `schar' has been added to define global fallback
+ characters. They are searched after the list of fonts declared with the
+ `special' request but before the already mounted special fonts.
Grotty
------
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index ed33712e..cf6333d6 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -8091,7 +8091,7 @@ special fonts. Fonts mounted with the @code{fonts} keyword in the
special fonts locally (i.e.@: for a particular font), use the
@code{fspecial} request.
-In summary, @code{gtroff} tries the following to find a given symbol:
+Here the exact rules how @code{gtroff} searches a given symbol:
@itemize @bullet
@item
@@ -8110,10 +8110,17 @@ test all fonts in the order of appearance in the last @code{fspecial}
call if appropriate.
@item
+If the symbol has been defined with the @code{fschar} request for the
+current font, use it.
+
+@item
Check all fonts in the order of appearance in the last @code{special}
call.
@item
+If the symbol has been defined with the @code{schar} request, use it.
+
+@item
As a last resort, consult all fonts loaded up to now for special fonts
and check them, starting with the lowest font number. Note that this can
sometimes lead to surprising results since the @code{fonts} line in the
@@ -8322,9 +8329,14 @@ property).
@endDefreq
@DefreqList {char, g [@Var{string}]}
-@DefreqListEnd {fchar, g [@Var{string}]}
+@DefreqItem {fchar, g [@Var{string}]}
+@DefreqItem {fschar, f g [@Var{string}]}
+@DefreqListEnd {schar, g [@Var{string}]}
@cindex defining character (@code{char})
+@cindex defining fallback character (@code{fchar}, @code{fschar}, @code{schar})
@cindex character, defining (@code{char})
+@cindex character, defining fallback (@code{fchar}, @code{fschar}, @code{schar})
+@cindex fallback character, defining (@code{fchar}, @code{fschar}, @code{schar})
@cindex creating new characters (@code{char})
@cindex defining symbol (@code{char})
@cindex symbol, defining (@code{char})
@@ -8351,7 +8363,7 @@ processed. Any emboldening, constant spacing or track kerning is
applied to this object rather than to individual characters in
@var{string}.
-A glyph defined by this request can be used just
+A glyph defined by these requests can be used just
like a normal glyph provided by the output device. In particular,
other characters can be translated to it with the @code{tr} or
@code{trin} requests; it can be made the leader character by the
@@ -8383,16 +8395,35 @@ The @code{fchar} request defines a fallback glyph:
@code{gtroff} only checks for glyphs defined with @code{fchar}
if it cannot find the glyph in the current font.
@code{gtroff} carries out this test before checking special fonts.
+
+@code{fschar} defines a fallback glyph for font@w{ }@var{f}: @code{gtroff}
+checks for glyphs defined with @code{fschar} after the list of fonts
+declared as font-specific special fonts with the @code{fspecial} request,
+but before the list of fonts declared as global special fonts with the
+@code{special} request.
+
+Finally, the @code{schar} request defines a global fallback glyph:
+@code{gtroff} checks for glyphs defined with @code{schar} after the list
+of fonts declared as global special fonts with the @code{special} request,
+but before the already mounted special fonts.
+
+@xref{Using Symbols}, for a detailed description of the glyph
+searching mechanism in @code{gtroff}.
@endDefreq
-@Defreq {rchar, c1 c2 @dots{}}
-@cindex removing glyph definition (@code{rchar})
-@cindex glyph, removing definition (@code{rchar})
+@DefreqList {rchar, c1 c2 @dots{}}
+@DefreqListEnd {rfschar, f c1 c2 @dots{}}
+@cindex removing glyph definition (@code{rchar}, @code{rfschar})
+@cindex glyph, removing definition (@code{rchar}, @code{rfschar})
+@cindex fallback glyph, removing definition (@code{rchar}, @code{rfschar})
Remove the definitions of glyphs @var{c1}, @var{c2},@w{
-}@enddots{} This undoes the effect of a @code{char} or @code{fchar}
-request.
+}@enddots{} This undoes the effect of a @code{char}, @code{fchar}, or
+@code{schar} request.
It is possible to omit the whitespace between arguments.
+
+The request @code{rfschar} removes glyph definitions defined with
+@code{fschar} for glyph@w{ }f.
@endDefreq
@xref{Special Characters}.
@@ -8422,11 +8453,11 @@ Use the @code{special} request to define special fonts. Initially, this
list is empty.
Use the @code{fspecial} request to designate special fonts only when
-font@w{ }@var{f} font is active. Initially, this list is empty.
+font@w{ }@var{f} is active. Initially, this list is empty.
Previous calls to @code{special} or @code{fspecial} are overwritten;
without arguments, the particular list of special fonts is set to empty.
-Special fonts are then searched in the order of the arguments.
+Special fonts are searched in the order they appear as arguments.
All fonts which appear in a call to @code{special} or @code{fspecial} are
loaded.
diff --git a/font/devhtml/R.proto b/font/devhtml/R.proto
index 6900565d..2a54002c 100644
--- a/font/devhtml/R.proto
+++ b/font/devhtml/R.proto
@@ -321,6 +321,7 @@ ua 24 0 0x2191 &uarr;
-> 24 0 0x2192 &rarr;
da 24 0 0x2193 &darr;
<> 24 0 0x2194 &harr;
+va 24 0 0x2195 &#8597;
lA 24 0 0x21D0 &lArr;
uA 24 0 0x21D1 &uArr;
rA 24 0 0x21D2 &rArr;
diff --git a/font/devutf8/R.proto b/font/devutf8/R.proto
index e62047fc..ec11ffb0 100644
--- a/font/devutf8/R.proto
+++ b/font/devutf8/R.proto
@@ -323,6 +323,7 @@ ua 24 0 0x2191
-> 24 0 0x2192
da 24 0 0x2193
<> 24 0 0x2194
+va 24 0 0x2195
lA 24 0 0x21D0
uA 24 0 0x21D1
rA 24 0 0x21D2
diff --git a/man/groff.man b/man/groff.man
index 66ace56a..8ec485fd 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -1543,10 +1543,18 @@ name to short
name on position
.IR n .
.
+.REQ .fschar f c anything
+Define fallback character
+.I c
+for font
+.I f
+as string
+.IR anything .
+.
.REQ .fspecial font
Reset list of special fonts for
.I font
-to empty.
+to be empty.
.
.REQ .fspecial font s1 s2 .\|.\|.\&
When the current font is
@@ -1944,6 +1952,14 @@ Read insertion.
.REQ .return
Return from a macro.
.
+.REQ .rfschar f c1 c2 .\|.\|.\&
+Remove the definitions of characters
+.IR c1 ,
+.IR c2 ,
+.I .\|.\|.\&
+for font
+.IR f .
+.
.REQ .rj n
Right justify the next
.I n
@@ -1978,6 +1994,12 @@ Return
to marked vertical place (default scaling indicator\~\c
.scaleindicator v ).
.
+.REQ .schar c anything
+Define global fallback character
+.I c
+as string
+.IR anything .
+.
.REQ .shc
Reset soft hyphen character to
.esc (hy .
@@ -2013,7 +2035,7 @@ up or down according to sign of
.scaleindicator v ).
.
.REQ .special
-Reset global list of special fonts to empty.
+Reset global list of special fonts to be empty.
.
.REQ .special s1 s2 .\|.\|.\&
Fonts
diff --git a/man/groff_diff.man b/man/groff_diff.man
index d51c97cc..83d44cf6 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -171,17 +171,17 @@ are described in detail.
.\" --------------------------------------------------------------------
.
The names of number registers, fonts, strings/\:macros/\:diversions,
-special characters, and colors can be of any length.
+special characters (glyphs), and colors can be of any length.
.
In escape sequences, additionally to the classical
.BI ( xx
-construction for a two character name, you can use
+construction for a two-character name, you can use
.BI [ xxx ]
for a name of arbitrary length, for example in
.
.TP \w'\[rs]f[xxx]'u+3n
.BI \[rs][ xxx ]
-Print the special character called
+Print the special character (glyph) called
.IR xxx .
.
.TP
@@ -387,7 +387,7 @@ is empty.
.
.TP
.BI \[rs]C' xxx '
-Typeset character named
+Typeset glyph named
.IR xxx .
Normally it is more convenient to use
.BI \[rs][ xxx ]\f[R].
@@ -463,15 +463,15 @@ switches back to the previous color.
.
.TP
.BI \[rs]N' n '
-Typeset the character with code
+Typeset the glyph with index
.I n
in the current font.
.I n
can be any integer.
.
-Most devices only have characters with codes between 0 and 255.
+Most devices only have glyphs with indices between 0 and 255.
.
-If the current font does not contain a character with that code,
+If the current font does not contain a glyph with that code,
special fonts will
.I not
be searched.
@@ -490,12 +490,12 @@ request, for example
.RE
.
.IP
-The code of each character is given in the fourth column in the font
+The index of each glyph is given in the fourth column in the font
description file after the
.B charset
command.
.
-It is possible to include unnamed characters in the font description
+It is possible to include unnamed glyphs in the font description
file by using a name of
.BR \-\-\- ;
the
@@ -756,9 +756,9 @@ will print\~\c
.
.TP
.B \[rs]/
-This increases the width of the preceding character so that the
-spacing between that character and the following character will be
-correct if the following character is a roman character.
+This increases the width of the preceding glyph so that the
+spacing between that glyph and the following glyph will be
+correct if the following glyph is a roman glyph.
.
.if t \{\
. nop For example, if an italic f is immediately followed by a roman
@@ -773,14 +773,14 @@ correct if the following character is a roman character.
. nop and avoids this problem.
.\}
It is a good idea to use this escape sequence whenever an italic
-character is immediately followed by a roman character without any
+glyph is immediately followed by a roman glyph without any
intervening space.
.
.TP
.B \[rs],
-This modifies the spacing of the following character so that the
-spacing between that character and the preceding character will
-correct if the preceding character is a roman character.
+This modifies the spacing of the following glyph so that the
+spacing between that glyph and the preceding glyph will
+correct if the preceding glyph is a roman glyph.
.
.if t \{\
. nop For example, inserting
@@ -791,7 +791,7 @@ correct if the preceding character is a roman character.
. el \f[R](\^\f[I]f\f[R].
.\}
It is a good idea to use this escape sequence whenever a roman
-character is immediately followed by an italic character without any
+glyph is immediately followed by an italic glyph without any
intervening space.
.
.TP
@@ -1064,11 +1064,11 @@ have this property).
.
.TP
.BI .char\ c\ string
-Define character
+Define glyph
.I c
to be
.IR string .
-Every time character
+Every time glyph
.I c
needs to be printed,
.I string
@@ -1083,12 +1083,12 @@ while
is being processed.
.
Any emboldening, constant spacing or track kerning will be applied to
-this object rather than to individual characters in
+this object rather than to individual glyphs in
.IR string .
.
.IP
-A character defined by this request can be used just like a normal
-character provided by the output device.
+A glyph defined by this request can be used just like a normal
+glyph provided by the output device.
.
In particular other characters can be translated to it with the
.B tr
@@ -1104,18 +1104,18 @@ correctly, if the
request is used to give the character a hyphenation code.
.
.IP
-There is a special anti-recursion feature: use of character within the
-character's definition will be handled like normal characters not
+There is a special anti-recursion feature: Use of glyph within the
+glyph's definition will be handled like normal glyphs not
defined with
.BR char .
.IP
-A character definition can be removed with the
+A glyph definition can be removed with the
.B rchar
request.
.
.TP
.BI .chop\ xx
-Chop the last character off macro, string, or diversion
+Chop the last element off macro, string, or diversion
.IR xx .
This is useful for removing the newline from the end of diversions
that are to be interpolated as strings.
@@ -1350,29 +1350,49 @@ request for more information on font families.
.
.TP
.BI .fchar\ c\ string
-Define fallback character
+Define fallback glyph
.I c
to be
.IR string .
+.
The syntax of this request is the same as the
.B char
-request; the only difference is that a character defined with
+request; the only difference is that a glyph defined with
.B char
hides the glyph with the same name in the current font, whereas a
-character defined with
+glyph defined with
.B fchar
is checked only if the particular glyph isn't found in the current font.
.
This test happens before checking special fonts.
.
.TP
+.BI .fschar\ f\ c\ string
+Define fallback glyph
+.I c
+for font
+.I f
+to be
+.IR string .
+.
+The syntax of this request is the same as the
+.B char
+request (with an additional argument to specify the font); a glyph
+defined with
+.B fschar
+is searched after the list of fonts declared with the
+.B fspecial
+request but before the list of fonts declared with
+.BR special .
+.
+.TP
.BI .fspecial\ f\ s1\ s2\|.\|.\|.\&
When the current font is
.IR f ,
fonts
.IR s1 ,
.IR s2 ,\|.\|.\|.\&
-will be special, that is, they will searched for characters not in
+will be special, that is, they will searched for glyphs not in
the current font.
.
Any fonts specified in the
@@ -1847,7 +1867,7 @@ with a positive value which are applied after the line is output.
.
.TP
.BI .rchar\ c1\ c2\|.\|.\|.\&
-Remove the definitions of characters
+Remove the definitions of glyphs
.IR c1 ,
.IR c2 ,\|.\|.\|.
This undoes the effect of a
@@ -1861,6 +1881,15 @@ Within a macro, return immediately.
No effect otherwise.
.
.TP
+.BI .rfschar\ c1\ c2\|.\|.\|.\&
+Remove the font-specific definitions of glyphs
+.IR c1 ,
+.IR c2 ,\|.\|.\|.
+This undoes the effect of a
+.B fschar
+request.
+.
+.TP
.B .rj
.TQ
.BI .rj \~n
@@ -1889,6 +1918,21 @@ to
.IR yy .
.
.TP
+.BI .schar\ c\ string
+Define global fallback glyph
+.I c
+to be
+.IR string .
+.
+The syntax of this request is the same as the
+.B char
+request; a glyph defined with
+.B schar
+is searched after the list of fonts declared with the
+.B special
+request but before the mounted special fonts.
+.
+.TP
.BI .shc\ c
Set the soft hyphen character to
.IR c .
@@ -1896,11 +1940,11 @@ If
.I c
is omitted, the soft hyphen character will be set to the default
.BR \[rs](hy .
-The soft hyphen character is the character which will be inserted when
+The soft hyphen character is the glyph which will be inserted when
a word is hyphenated at a line break.
.
If the soft hyphen character does not exist in the font of the
-character immediately preceding a potential break point, then the line
+glyph immediately preceding a potential break point, then the line
will not be broken at that point.
.
Neither definitions (specified with the
@@ -1956,7 +2000,7 @@ than a single line.
Fonts
.IR s1 ,
.IR s2 ,
-are special and will be searched for characters not in the current
+are special and will be searched for glyphs not in the current
font.
.
Without arguments, reset the list of special fonts to be empty.
@@ -2068,7 +2112,7 @@ Enable track kerning for font
.IR f .
When the current font is
.I f
-the width of every character will be increased by an amount between
+the width of every glyph will be increased by an amount between
.I n1
and
.IR n2 ;
@@ -2280,7 +2324,7 @@ For example,
.B .warn\~0
will disable all warnings, and
.B .warn\~1
-will disable all warnings except that about missing characters.
+will disable all warnings except that about missing glyphs.
.
If
.I n
@@ -2467,9 +2511,9 @@ The following read-only registers are available:
.
.TP
.B \[rs]n[.cdp]
-The depth of the last character added to the current environment.
+The depth of the last glyph added to the current environment.
.
-It is positive if the character extends below the baseline.
+It is positive if the glyph extends below the baseline.
.
.TP
.B \[rs]n[.ce]
@@ -2479,9 +2523,9 @@ request.
.
.TP
.B \[rs]n[.cht]
-The height of the last character added to the current environment.
+The height of the last glyph added to the current environment.
.
-It is positive if the character extends above the baseline.
+It is positive if the glyph extends above the baseline.
.
.TP
.B \[rs]n[.color]
@@ -2489,12 +2533,12 @@ It is positive if the character extends above the baseline.
.
.TP
.B \[rs]n[.csk]
-The skew of the last character added to the current environment.
+The skew of the last glyph added to the current environment.
.
The
.I skew
-of a character is how far to the right of the center of a character
-the center of an accent over that character should be placed.
+of a glyph is how far to the right of the center of a glyph
+the center of an accent over that glyph should be placed.
.
.TP
.B \[rs]n[.ev]
@@ -2737,19 +2781,19 @@ Like the
.B st
and
.B sb
-registers, but take account of the heights and depths of characters.
+registers, but take account of the heights and depths of glyphs.
.
.TP
.B \[rs]n[ssc]
The amount of horizontal space (possibly negative) that should be
-added to the last character before a subscript.
+added to the last glyph before a subscript.
.
.TP
.B \[rs]n[skw]
-How far to right of the center of the last character in the
+How far to right of the center of the last glyph in the
.B \[rs]w
argument, the center of an accent from a roman font should be placed
-over that character.
+over that glyph.
.
.P
Other available read/write number registers are:
@@ -2864,9 +2908,9 @@ is
.
.P
If the font description file contains pairwise kerning information,
-characters from that font will be kerned.
+glyphs from that font will be kerned.
.
-Kerning between two characters can be inhibited by placing a
+Kerning between two glyphs can be inhibited by placing a
.B \[rs]&
between them.
.
@@ -2936,13 +2980,13 @@ True if there is a color named
.
.TP
.BI .if\ c ch
-True if there is a character
+True if there is a glyph
.IR ch
available;
.I ch
is either an
.SM ASCII
-character or a special character
+character or a glyph (special character)
.BI \[rs]( xx
or
.BI \[rs][ xxx ]\f[R];
@@ -3018,7 +3062,7 @@ command is also in scaled points.
.
.TP
.BI N n
-Print character with index\~\c
+Print glyph with index\~\c
.I n
(a non-negative integer) of the current font.
.
@@ -3031,12 +3075,13 @@ commands.
.TP
.BI t xxx
.I xxx
-is any sequence of characters terminated by a space or a newline; the
-first character should be printed at the current position, the current
-horizontal position should be increased by the width of the first
-character, and so on for each character.
+is any sequence of characters terminated by a space or a newline (to
+be more precise, it is a sequence of glyphs which are accessed with
+the corresponding characters); the first character should be printed at
+the current position, the current horizontal position should be increased
+by the width of the first character, and so on for each character.
.
-The width of the character is that given in the font file,
+The width of the glyph is that given in the font file,
appropriately scaled for the current point size, and rounded so that
it is a multiple of the horizontal resolution.
.
@@ -3056,15 +3101,15 @@ Note that single characters can have the eighth bit set, as can the
names of fonts and special characters.
.
.P
-The names of characters and fonts can be of arbitrary length; drivers
+The names of glyphs and fonts can be of arbitrary length; drivers
should not assume that they will be only two characters long.
.
.P
-When a character is to be printed, that character will always be
+When a glyph is to be printed, that glyph will always be
in the current font.
.
Unlike device-independent troff, it is not necessary for drivers to
-search special fonts to find a character.
+search special fonts to find a glyph.
.
.P
For color support, some new commands have been added:
@@ -3449,10 +3494,10 @@ pointsize will be set to 10\~scaled points.
In
.I groff
mode, there is a fundamental difference between unformatted input
-characters, and formatted output characters.
+characters, and formatted output characters (glyphs).
.
-Everything that affects how an output character will be output is
-stored with the character; once an output character has been
+Everything that affects how a glyph will be output is
+stored with the glyph; once a glyph has been
constructed it is unaffected by any subsequent requests that are
executed, including the
.request bd ,
@@ -3464,16 +3509,20 @@ or
requests.
.
.P
-Normally output characters are constructed from input characters at
-the moment immediately before the character is added to the current
+Normally glyphs are constructed from input characters at
+the moment immediately before the glyph is added to the current
output line.
.
Macros, diversions and strings are all, in fact, the same type of
-object; they contain lists of input characters and output characters
+object; they contain lists of input characters and glyphs
in any combination.
.
.P
-An output character does not behave like an input character for the
+Special characters can be both; before being added to the output, they
+act as input entities, afterwards they denote glyphs.
+.
+.P
+A glyph does not behave like an input character for the
purposes of macro processing; it does not inherit any of the special
properties that the input character from which it was constructed
might have had.
@@ -3500,7 +3549,7 @@ this will be printed as
.esc \[rs] .
So each pair of input backslashes
.squoted \[rs]\[rs]
-is turned into a single output backslash
+is turned into a single output backslash glyph
.squoted \[rs]
and the resulting output backslashes are not interpreted as escape
characters when they are reread.
diff --git a/src/roff/troff/charinfo.h b/src/roff/troff/charinfo.h
index b907ae4f..6e4f1ce2 100644
--- a/src/roff/troff/charinfo.h
+++ b/src/roff/troff/charinfo.h
@@ -37,7 +37,7 @@ class charinfo {
// to transparent throughput
char translate_input; // non-zero means that asciify_code is
// active for .asciify (set by .trin)
- char fallback;
+ char_mode mode;
public:
enum {
ENDS_SENTENCE = 1,
@@ -47,7 +47,7 @@ public:
OVERLAPS_VERTICALLY = 16,
TRANSPARENT = 32,
NUMBERED = 64
- };
+ };
enum {
TRANSLATE_NONE,
TRANSLATE_SPACE,
@@ -77,13 +77,14 @@ public:
void set_flags(unsigned char);
void set_special_translation(int, int);
int get_special_translation(int = 0);
- macro *set_macro(macro *, int = 0);
+ macro *set_macro(macro *, char_mode = CHAR_NORMAL);
macro *get_macro();
int first_time_not_found();
void set_number(int);
int get_number();
int numbered();
int is_fallback();
+ int is_special();
symbol *get_symbol();
};
@@ -128,7 +129,12 @@ inline int charinfo::numbered()
inline int charinfo::is_fallback()
{
- return fallback;
+ return mode == CHAR_FALLBACK;
+}
+
+inline int charinfo::is_special()
+{
+ return mode == CHAR_SPECIAL;
}
inline charinfo *charinfo::get_translation(int transparent_throughput)
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index ad3724e0..ca40448e 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -3868,7 +3868,7 @@ void append_nocomp_string()
do_define_string(DEFINE_APPEND, CALLING_DISABLE_COMP);
}
-void do_define_character(int fallback)
+void do_define_character(char_mode mode, const char *font_name)
{
node *n;
int c;
@@ -3878,6 +3878,13 @@ void do_define_character(int fallback)
skip_line();
return;
}
+ if (font_name) {
+ string s(font_name);
+ s += ' ';
+ s += ci->nm.contents();
+ s += '\0';
+ ci = get_charinfo(symbol(s.contents()));
+ }
tok.next();
if (tok.newline())
c = '\n';
@@ -3902,7 +3909,7 @@ void do_define_character(int fallback)
m->append((unsigned char)c);
c = get_copy(&n);
}
- m = ci->set_macro(m, fallback);
+ m = ci->set_macro(m, mode);
if (m)
delete m;
tok.next();
@@ -3910,12 +3917,17 @@ void do_define_character(int fallback)
void define_character()
{
- do_define_character(0);
+ do_define_character(CHAR_NORMAL);
}
void define_fallback_character()
{
- do_define_character(1);
+ do_define_character(CHAR_FALLBACK);
+}
+
+void define_special_character()
+{
+ do_define_character(CHAR_SPECIAL);
}
static void remove_character()
@@ -7235,6 +7247,7 @@ void init_input_requests()
init_request("return", return_macro_request);
init_request("rm", remove_macro);
init_request("rn", rename_macro);
+ init_request("schar", define_special_character);
init_request("shift", shift);
init_request("so", source);
init_request("spreadwarn", spreadwarn_request);
@@ -7671,7 +7684,7 @@ charinfo::charinfo(symbol s)
: translation(0), mac(0), special_translation(TRANSLATE_NONE),
hyphenation_code(0), flags(0), ascii_code(0), asciify_code(0),
not_found(0), transparent_translate(1), translate_input(0),
- fallback(0), nm(s)
+ mode(CHAR_NORMAL), nm(s)
{
index = next_index++;
}
@@ -7714,11 +7727,11 @@ void charinfo::set_asciify_code(unsigned char c)
asciify_code = c;
}
-macro *charinfo::set_macro(macro *m, int f)
+macro *charinfo::set_macro(macro *m, char_mode cm)
{
macro *tem = mac;
mac = m;
- fallback = f;
+ mode = cm;
return tem;
}
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index af10122b..fe003412 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -38,6 +38,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "input.h"
#include "div.h"
#include "geometry.h"
+#include "stringclass.h"
#include "nonposix.h"
@@ -4501,6 +4502,16 @@ node *make_glyph_node(charinfo *s, environment *env, int no_error_message = 0)
sf = sf->next;
}
if (!found) {
+ symbol f = font_table[fontno]->get_name();
+ string gl(f.contents());
+ gl += ' ';
+ gl += s->nm.contents();
+ gl += '\0';
+ charinfo *ci = get_charinfo(symbol(gl.contents()));
+ if (ci && ci->get_macro())
+ return make_composite_node(ci, env);
+ }
+ if (!found) {
sf = global_special_fonts;
while (sf != 0 && !found) {
fn = sf->n;
@@ -4509,18 +4520,17 @@ node *make_glyph_node(charinfo *s, environment *env, int no_error_message = 0)
sf = sf->next;
}
}
- if (!found
-#if 0
- && global_special_fonts == 0 && font_table[fontno]->sf == 0
-#endif
- ) {
+ if (!found)
+ if (s->is_special())
+ return make_composite_node(s, env);
+ if (!found) {
for (fn = 0; fn < font_table_size; fn++)
if (font_table[fn]
&& font_table[fn]->is_special()
&& font_table[fn]->contains(s)) {
- found = 1;
- break;
- }
+ found = 1;
+ break;
+ }
}
if (!found) {
if (!no_error_message && s->first_time_not_found()) {
@@ -5569,6 +5579,44 @@ int get_underline_fontno()
return underline_fontno;
}
+void define_font_special_character()
+{
+ int n = get_fontno();
+ if (n < 0) {
+ skip_line();
+ return;
+ }
+ symbol f = font_table[n]->get_name();
+ do_define_character(CHAR_FONT_SPECIAL, f.contents());
+}
+
+void remove_font_special_character()
+{
+ int n = get_fontno();
+ if (n < 0) {
+ skip_line();
+ return;
+ }
+ symbol f = font_table[n]->get_name();
+ while (!tok.newline() && !tok.eof()) {
+ if (!tok.space() && !tok.tab()) {
+ charinfo *s = tok.get_char(1);
+ string gl(f.contents());
+ gl += ' ';
+ gl += s->nm.contents();
+ gl += '\0';
+ charinfo *ci = get_charinfo(symbol(gl.contents()));
+ if (!ci)
+ break;
+ macro *m = ci->set_macro(0);
+ if (m)
+ delete m;
+ }
+ tok.next();
+ }
+ skip_line();
+}
+
static void read_special_fonts(special_font_list **sp)
{
special_font_list *s = *sp;
@@ -5878,18 +5926,20 @@ const char *printing_reg::get_string()
void init_node_requests()
{
- init_request("fp", font_position);
- init_request("sty", style);
- init_request("cs", constant_space);
init_request("bd", bold_font);
- init_request("uf", underline_font);
- init_request("lg", ligature);
- init_request("kern", kern_request);
- init_request("tkf", track_kern);
- init_request("special", special_request);
+ init_request("cs", constant_space);
+ init_request("fp", font_position);
+ init_request("fschar", define_font_special_character);
init_request("fspecial", font_special_request);
init_request("ftr", font_translate);
+ init_request("kern", kern_request);
+ init_request("lg", ligature);
+ init_request("rfschar", remove_font_special_character);
init_request("shc", set_soft_hyphen_char);
+ init_request("special", special_request);
+ init_request("sty", style);
+ init_request("tkf", track_kern);
+ init_request("uf", underline_font);
number_reg_dictionary.define(".fp", new next_available_font_position_reg);
number_reg_dictionary.define(".kern",
new constant_int_reg(&global_kern_mode));
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index 59f2aa2d..9f5b069b 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -112,6 +112,15 @@ extern void check_missing_character();
extern void skip_line();
extern void handle_initial_title();
+enum char_mode {
+ CHAR_NORMAL,
+ CHAR_FALLBACK,
+ CHAR_FONT_SPECIAL,
+ CHAR_SPECIAL
+};
+
+extern void do_define_character(char_mode, const char * = 0);
+
struct hunits;
extern void read_title_parts(node **part, hunits *part_width);
diff --git a/tmac/dvi.tmac b/tmac/dvi.tmac
index 9c155fdd..5ab7fe4e 100644
--- a/tmac/dvi.tmac
+++ b/tmac/dvi.tmac
@@ -83,6 +83,8 @@ D\v'-.33m'\s0\v'.33m'
.fchar \[em] --
.fchar \[en] -
.fchar \[hy] -
+.fschar CW \[va] \o'\[ua]\[da]'
+.fschar CWI \[va] \o'\[ua]\[da]'
.
.\" Define some fractions.
.de dvi-frac