summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2004-06-29 07:11:00 +0000
committerwlemb <wlemb>2004-06-29 07:11:00 +0000
commit6e5ac034c3358b9519d887aa71233ddba406d1f9 (patch)
tree3918c663d3516e959782086e1512e89a0e0029e7
parent76b6e459a0510b71d682115440719cc60336ac54 (diff)
downloadgroff-6e5ac034c3358b9519d887aa71233ddba406d1f9.tar.gz
Implement new string-valued register `.sty' to return the current
style name. * env.cpp (environment::get_style_name_string): New function. (init_env_requests): Add `.sty' register. * env.h (environment): Updated. * node.cpp (font_info): Make `get_style_name' a friend. (get_style_name): New function. * node.h: Updated. * man/groff_diff.man, man/groff.man, NEWS, doc/groff.texinfo: Updated.
-rw-r--r--ChangeLog15
-rw-r--r--NEWS6
-rw-r--r--doc/groff.texinfo8
-rw-r--r--man/groff.man25
-rw-r--r--man/groff_diff.man8
-rw-r--r--src/roff/troff/env.cpp7
-rw-r--r--src/roff/troff/env.h1
-rw-r--r--src/roff/troff/node.cpp9
-rw-r--r--src/roff/troff/node.h1
9 files changed, 67 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c016ed58..f81de2a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-06-27 Werner LEMBERG <wl@gnu.org
+
+ Implement new string-valued register `.sty' to return the current
+ style name.
+
+ * env.cpp (environment::get_style_name_string): New function.
+ (init_env_requests): Add `.sty' register.
+ * env.h (environment): Updated.
+ * node.cpp (font_info): Make `get_style_name' a friend.
+ (get_style_name): New function.
+ * node.h: Updated.
+
+ * man/groff_diff.man, man/groff.man, NEWS, doc/groff.texinfo:
+ Updated.
+
2004-06-15 Werner LEMBERG <wl@gnu.org>
* src/preproc/tbl/main.cpp (process_data) <GOT_RIGHT_BRACE>: Handle
diff --git a/NEWS b/NEWS
index 51da56fa..84df4f0c 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ described. There are more details in the man and info pages.
VERSION 1.19.2
==============
+Troff
+-----
+
+o A new read-only, string-valued register `.sty' returns the name of the
+ current style.
+
Gxditview
---------
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 698f85d4..f5fdce39 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -8213,7 +8213,8 @@ special symbols (Greek, mathematics).
@DefreqList {ft, [@Var{font}]}
@DefescItem {\\f, , f, }
@DefescItem {\\f, @lparen{}, fn, }
-@DefescListEnd {\\f, @lbrack{}, font, @rbrack}
+@DefescItem {\\f, @lbrack{}, font, @rbrack}
+@DefregListEnd {.sty}
@cindex changing fonts (@code{ft}, @code{\f})
@cindex fonts, changing (@code{ft}, @code{\f})
@cindex @code{sty} request, and changing fonts
@@ -8262,6 +8263,11 @@ the fly:
.mc \f[I]x\f[]
@endExample
+The current style name is available in the read-only number register
+@samp{.sty} (this is a string-valued register); if the current font
+isn't a style, the empty string is returned. It is associated with
+the current environment.
+
@xref{Font Positions}, for an alternative syntax.
@endDefreq
diff --git a/man/groff.man b/man/groff.man
index 74f26229..0e08c332 100644
--- a/man/groff.man
+++ b/man/groff.man
@@ -2,7 +2,7 @@
.ig
groff.man
-Last update: 04 May 2004
+Last update: 27 Jun 2004
This file is part of groff, the GNU roff type-setting system.
@@ -3221,6 +3221,19 @@ The slant of the current font as set with
The last requested pointsize in points as a decimal fraction
(string-valued).
.
+.REG .ss
+The value of the parameters set by the first argument of the
+.request ss
+request.
+.
+.REG .sss
+The value of the parameters set by the second argument of the
+.request ss
+request.
+.
+.REG .sty
+The current font style (string-valued).
+.
.REG .t
Distance to the next trap.
.
@@ -3251,16 +3264,6 @@ Useful in conjunction with the
.register .ne
register.
.
-.REG .ss
-The value of the parameters set by the first argument of the
-.request ss
-request.
-.
-.REG .sss
-The value of the parameters set by the second argument of the
-.request ss
-request.
-.
.REG .u
Equal to 1 in fill mode and 0 in nofill mode.
.
diff --git a/man/groff_diff.man b/man/groff_diff.man
index 9254df1a..b3ebc940 100644
--- a/man/groff_diff.man
+++ b/man/groff_diff.man
@@ -3,7 +3,7 @@
.ig
groff_diff.man
-Last update : 04 May 2004
+Last update : 27 Jun 2004
This file is part of groff, the GNU roff type-setting system.
It is the source of the man-page groff_diff(7).
@@ -2771,6 +2771,12 @@ arguments of the
request.
.
.TP
+.B \[rs]n[.sty]
+The current font style.
+.
+This is a string-valued register.
+.
+.TP
.B \[rs]n[.tabs]
A string representation of the current tab settings suitable for use
as an argument to the
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index b0234065..f002a28b 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3109,6 +3109,12 @@ const char *environment::get_font_name_string()
return f.contents();
}
+const char *environment::get_style_name_string()
+{
+ symbol f = get_style_name(fontno);
+ return f.contents();
+}
+
const char *environment::get_name_string()
{
return name.contents();
@@ -3271,6 +3277,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(".sr", get_requested_point_size_string);
+ init_string_env_reg(".sty", get_style_name_string);
init_string_env_reg(".tabs", get_tabs);
init_int_env_reg(".u", get_fill);
init_vunits_env_reg(".v", get_vertical_spacing);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index ab71222f..6fb9cbdf 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -309,6 +309,7 @@ public:
const char *get_fill_color_string();
const char *get_font_family_string();
const char *get_font_name_string();
+ const char *get_style_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.cpp b/src/roff/troff/node.cpp
index e3d4d86d..02624a3a 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -151,6 +151,7 @@ public:
int is_special();
int is_style();
friend symbol get_font_name(int, environment *);
+ friend symbol get_style_name(int);
};
class tfont_spec {
@@ -399,6 +400,14 @@ symbol get_font_name(int fontno, environment *env)
return f;
}
+symbol get_style_name(int fontno)
+{
+ if (font_table[fontno]->is_style())
+ return font_table[fontno]->get_name();
+ else
+ return EMPTY_SYMBOL;
+}
+
hunits font_info::get_space_width(font_size fs, int space_sz)
{
if (is_constant_spaced == CONSTANT_SPACE_NONE)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 8da5671b..7baef298 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -596,4 +596,5 @@ public:
font_family *lookup_family(symbol);
symbol get_font_name(int, environment *);
+symbol get_style_name(int);
extern search_path include_search_path;