diff options
author | wlemb <wlemb> | 2001-12-13 22:45:58 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2001-12-13 22:45:58 +0000 |
commit | 744d7091bdde68693542b32822274e7f2de96e58 (patch) | |
tree | 6f6ada219e0b4ad656348673cefa67435dc0f8be | |
parent | 603ad92b926901ecb6cd10a35354a5259c2a8732 (diff) | |
download | groff-744d7091bdde68693542b32822274e7f2de96e58.tar.gz |
Implement new string-valued register `.fn' to return the current
real (internal) font name.
* env.cc (environment::get_font_name_string): New function.
(init_env_requests): Add `.fn' register.
* env.h (environment): Updated.
* node.cc (font_info): Make `get_font_name' a friend.
(get_font_name): New function.
* node.h: Updated.
* man/groff_diff.man, man/groff.man, NEWS: Updated.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | man/groff.man | 11 | ||||
-rw-r--r-- | man/groff_diff.man | 8 | ||||
-rw-r--r-- | src/roff/troff/env.cc | 7 | ||||
-rw-r--r-- | src/roff/troff/env.h | 1 | ||||
-rw-r--r-- | src/roff/troff/node.cc | 10 | ||||
-rw-r--r-- | src/roff/troff/node.h | 1 |
8 files changed, 54 insertions, 1 deletions
@@ -1,3 +1,17 @@ +2001-12-13 Werner LEMBERG <wl@gnu.org> + + Implement new string-valued register `.fn' to return the current + real (internal) font name. + + * env.cc (environment::get_font_name_string): New function. + (init_env_requests): Add `.fn' register. + * env.h (environment): Updated. + * node.cc (font_info): Make `get_font_name' a friend. + (get_font_name): New function. + * node.h: Updated. + + * man/groff_diff.man, man/groff.man, NEWS: Updated. + 2001-12-12 Ralph Corderoy <ralph@inputplus.demon.co.uk> * src/preproc/eqn/main.cc (inline_equation): Fix typos. @@ -39,6 +39,9 @@ o It is now possible to have whitespace between the first and second dot (or . ! .. +o `.fn' is a new string-valued register which returns the (internal) real + font name; style and families are properly concatenated. + o A new escape sequence `\O' is available (mainly for internal use with grohtml). Please see groff_diff.man and groff.texinfo for more details. diff --git a/man/groff.man b/man/groff.man index e1241f6b..a64e9f0e 100644 --- a/man/groff.man +++ b/man/groff.man @@ -2191,6 +2191,14 @@ Overstrike characters .argument c , etc. . +.ESC O 0 +Disable glyph output. +Mainly for internal use. +. +.ESC O 1 +Enable glyph output. +Mainly for internal use. +. .ESC p Break and spread output line. . @@ -2414,7 +2422,8 @@ Current vertical place in current diversion; equal to register .register nl . .REG .ev The name or number of the current environment (string-valued). .REG .f Current font number. -.REG .fam The current font family (string-valued). +.REG .fam The current font family (string-valued). +.REG .fn The current (internal) real font name (string-valued). .REG .fp The number of the next free font position. .REG .g Always 1 in GNU troff. diff --git a/man/groff_diff.man b/man/groff_diff.man index d5170e49..fe3ae95b 100644 --- a/man/groff_diff.man +++ b/man/groff_diff.man @@ -1903,6 +1903,14 @@ The current font family. This is a string-valued register. . .TP +.B \en[.fn] +The current (internal) real font name. +This is a string-valued register. +If the current font is a style, the value of +.B \en[.fn] +is the proper concatenation of family and style name. +. +.TP .B \en[.fp] The number of the next free font position. . diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc index 4e2c5355..a7330ad1 100644 --- a/src/roff/troff/env.cc +++ b/src/roff/troff/env.cc @@ -2956,6 +2956,12 @@ const char *environment::get_font_family_string() return family->nm.contents(); } +const char *environment::get_font_name_string() +{ + symbol f = get_font_name(fontno, this); + return f.contents(); +} + const char *environment::get_name_string() { return name.contents(); @@ -3105,6 +3111,7 @@ void init_env_requests() init_int_env_reg(".ss", get_space_size); init_int_env_reg(".sss", get_sentence_space_size); init_string_env_reg(".fam", get_font_family_string); + init_string_env_reg(".fn", get_font_name_string); init_string_env_reg(".ev", get_name_string); init_int_env_reg(".hy", get_hyphenation_flags); init_int_env_reg(".hlm", get_hyphen_line_max); diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h index 939f1841..91513a7d 100644 --- a/src/roff/troff/env.h +++ b/src/roff/troff/env.h @@ -300,6 +300,7 @@ public: void space(hunits, hunits); void space_newline(); const char *get_font_family_string(); + const char *get_font_name_string(); const char *get_name_string(); const char *get_point_size_string(); const char *get_requested_point_size_string(); diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc index 9102869f..b1bd80dd 100644 --- a/src/roff/troff/node.cc +++ b/src/roff/troff/node.cc @@ -149,6 +149,7 @@ public: int get_bold(hunits *); int is_special(); int is_style(); + friend symbol get_font_name(int, environment *); }; class tfont_spec { @@ -380,6 +381,15 @@ symbol font_info::get_name() return internal_name; } +symbol get_font_name(int fontno, environment *env) +{ + symbol f = font_table[fontno]->get_name(); + if (font_table[fontno]->is_style()) { + return concat(env->get_family()->nm, f); + } + return f; +} + hunits font_info::get_space_width(font_size fs, int space_size) { if (is_constant_spaced == CONSTANT_SPACE_NONE) diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 0d9793c9..48e58570 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -606,3 +606,4 @@ public: }; font_family *lookup_family(symbol); +symbol get_font_name(int, environment *); |