gbranden pushed a commit to branch master
in repository groff.
commit 78550de28922fe01369798c99131fa6f9fde68d3
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jun 3 05:34:47 2025 -0500
[troff]: Refactor `\f` handler.
* src/roff/troff/input.cpp (token::next): Replace most of the
`\f` escape sequence handler with a call to `select_font()`.
---
ChangeLog | 5 +++++
src/roff/troff/input.cpp | 20 +-------------------
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c98a0a273..fd08708b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-06-03 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::next): Replace most of the
+ `\f` escape sequence handler with a call to `select_font()`.
+
2025-06-03 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (token::next): Drop dead code from
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 7ce1d83d7..2a2e3123a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2320,25 +2320,7 @@ void token::next()
goto handle_escape_char;
case 'f':
{
- symbol s = read_escape_parameter(ALLOW_EMPTY);
- const char *p;
- for (p = s.contents();
- p != 0 /* nullptr */ && *p != '\0';
- p++)
- if (!csdigit(*p))
- break;
- // environment::set_font warns if a bogus mounting position is
- // requested. We must warn here if a bogus font name is
- // selected.
- if (*p != '\0' || s.is_empty()) {
- if (s == "DESC")
- error("'%1' is not a valid font name", s.contents());
- else if (!curenv->set_font(s))
- warning(WARN_FONT, "cannot select font '%1'",
- s.contents());
- }
- else
- (void) curenv->set_font(atoi(s.contents()));
+ select_font(read_escape_parameter(ALLOW_EMPTY));
if (!want_att_compat)
have_formattable_input = true;
break;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit