diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | doc/groff.texinfo | 33 | ||||
-rw-r--r-- | man/groff_diff.man | 9 | ||||
-rw-r--r-- | src/roff/troff/charinfo.h | 11 | ||||
-rw-r--r-- | src/roff/troff/node.cpp | 18 |
6 files changed, 75 insertions, 15 deletions
@@ -1,3 +1,17 @@ +2006-08-11 Werner LEMBERG <wl@gnu.org> + + Add new flag to .cflags to enable hyphenation without looking at + hcode values. + + * src/roff/troff/charinfo.h (charinfo): New enumeration value + `IGNORE_HCODES'. + New member function `ignore_hcodes'. + + * src/roff/troff/node.cpp (break_char_node::add_self, + node::add_char): Updated. + + * doc/groff.texinfo, man/groff_diff.man, NEWS: Document it. + 2006-08-09 Werner LEMBERG <wl@gnu.org> Support composite Unicode characters again. Reported by Colin. @@ -47,6 +47,11 @@ o A new request `fzoom' has been added to adjust the optical size of a The new number register `.zoom' holds the zoom value of the current font, in multiples of 1/1000th. +o The `cflags' request has been extended with a new flag value 64, to be + used in combination with values 2 (break before character) and 4 (break + after character). If set, the hyphenation codes of the surrounding + characters are ignored. + Pic --- diff --git a/doc/groff.texinfo b/doc/groff.texinfo index 641a49f7..5a8eee82 100644 --- a/doc/groff.texinfo +++ b/doc/groff.texinfo @@ -472,7 +472,7 @@ Software Foundation raise funds for GNU development.'' @title groff @subtitle The GNU implementation of @code{troff} @subtitle Edition 1.19.3 -@subtitle Spring 2006 +@subtitle Summer 2006 @author by Trent A.@tie{}Fisher @author and Werner Lemberg (@email{bug-groff@@gnu.org}) @@ -2176,7 +2176,7 @@ relative to the bottom. The default is @minus{}0.5@dmn{i}. @item -rHY=@var{flags} Set hyphenation flags. Possible values are 1@tie{}to hyphenate without -restrictions, 2@tie{} to not hyphenate the last word on a page, +restrictions, 2@tie{}to not hyphenate the last word on a page, 4@tie{}to not hyphenate the last two characters of a word, and 8@tie{}to not hyphenate the first two characters of a word. These values are additive; the default is@tie{}14. @@ -9362,14 +9362,19 @@ property). @item 2 @cindex hyphenating characters @cindex characters, hyphenation -Lines can be broken before the character (initially no characters have -this property). +Lines can be broken before the character (initially no characters have this +property). This only works if both the characters before and after have +non-zero hyphenation codes (as set with the @code{hcode} request). Use +value@tie{}64 to override this behaviour. @item 4 @cindex @code{hy} glyph, and @code{cflags} @cindex @code{em} glyph, and @code{cflags} -Lines can be broken after the character (initially the character -@samp{-} and the symbols @samp{\[hy]} and @samp{\[em]} have this property). +Lines can be broken after the character (initially the character @samp{-} +and the symbols @samp{\[hy]} and @samp{\[em]} have this property). This +only works if both the characters before and after have non-zero hyphenation +codes (as set with the @code{hcode} request). Use value@tie{}64 to override +this behaviour. @item 8 @cindex overlapping characters @@ -9405,6 +9410,22 @@ newline or two spaces; in other words the character is this is the same as having a zero space factor in @TeX{} (initially characters @samp{"')]*} and the symbols @samp{\[dg]} and @samp{\[rq]} have this property). + +@item 64 +Ignore hyphenation code values of the surrounding characters. Use this in +combination with values 2 and@tie{}4 (initially no characters have this +property). For example, if you need an automatic break point after the +hyphen in number ranges like `3000-5000', insert + +@Example +.cflags 68 - +@endExample + +@noindent +into your document. Note, however, that this can lead to bad layout if done +without thinking; in most situations, a better solution instead of changing +the @code{cflags} value is to insert @code{\:} right after the hyphen at the +places which really need a break point. @end table @endDefreq diff --git a/man/groff_diff.man b/man/groff_diff.man index 4cfed149..d33f7b31 100644 --- a/man/groff_diff.man +++ b/man/groff_diff.man @@ -3,7 +3,7 @@ .ig groff_diff.man -Last update : 11 Jul 2006 +Last update : 11 Aug 2006 This file is part of groff, the GNU roff type-setting system. It is the source of the man-page groff_diff(7). @@ -1046,6 +1046,7 @@ Lines can be broken before the character (initially no characters have this property); a line is not broken at a character with this property unless the characters on each side both have non-zero hyphenation codes. +This can be overridden with value 64. . .IP 4 Lines can be broken after the character (initially characters @@ -1053,6 +1054,7 @@ Lines can be broken after the character (initially characters have this property); a line is not broken at a character with this property unless the characters on each side both have non-zero hyphenation codes. +This can be overridden with value 64. . .IP 8 The character overlaps horizontally (initially characters @@ -1072,6 +1074,11 @@ for the purposes of end-of-sentence recognition; this is the same as having a zero space factor in \*[tx] (initially characters .B \[dq]')]*\[rs](dg\[rs](rq have this property). +. +.IP 64 +Ignore hyphenation code values of the surrounding characters. +Use this in combination with values 2 and\~4 (initially no characters have +this property). .RE . .TP diff --git a/src/roff/troff/charinfo.h b/src/roff/troff/charinfo.h index 2d270699..deee2728 100644 --- a/src/roff/troff/charinfo.h +++ b/src/roff/troff/charinfo.h @@ -44,7 +44,8 @@ public: BREAK_AFTER = 4, OVERLAPS_HORIZONTALLY = 8, OVERLAPS_VERTICALLY = 16, - TRANSPARENT = 32 + TRANSPARENT = 32, + IGNORE_HCODES = 64 }; enum { TRANSLATE_NONE, @@ -54,7 +55,7 @@ public: TRANSLATE_HYPHEN_INDICATOR }; symbol nm; - charinfo(symbol s); + charinfo(symbol); glyph *as_glyph(); int ends_sentence(); int overlaps_vertically(); @@ -62,6 +63,7 @@ public: int can_break_before(); int can_break_after(); int transparent(); + int ignore_hcodes(); unsigned char get_hyphenation_code(); unsigned char get_ascii_code(); unsigned char get_asciify_code(); @@ -122,6 +124,11 @@ inline int charinfo::transparent() return flags & TRANSPARENT; } +inline int charinfo::ignore_hcodes() +{ + return flags & IGNORE_HCODES; +} + inline int charinfo::numbered() { return number >= 0; diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index 8e6bb3b9..28ecfaa0 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -2839,15 +2839,19 @@ int break_char_node::ends_sentence() node *break_char_node::add_self(node *n, hyphen_list **p) { assert((*p)->hyphenation_code == 0); - if ((*p)->breakable && (break_code & 1)) { - n = new space_node(H0, col, n); - n->freeze_space(); + if (break_code & 1) { + if ((*p)->breakable || break_code & 4) { + n = new space_node(H0, col, n); + n->freeze_space(); + } } next = n; n = this; - if ((*p)->breakable && (break_code & 2)) { - n = new space_node(H0, col, n); - n->freeze_space(); + if (break_code & 2) { + if ((*p)->breakable || break_code & 4) { + n = new space_node(H0, col, n); + n->freeze_space(); + } } hyphen_list *pp = *p; *p = (*p)->next; @@ -5073,6 +5077,8 @@ node *node::add_char(charinfo *ci, environment *env, break_code = 1; if (ci->can_break_after()) break_code |= 2; + if (ci->ignore_hcodes()) + break_code |= 4; if (break_code) { node *next1 = res->next; res->next = 0; |