gbranden pushed a commit to branch master
in repository groff.
commit 3e3e457a182efe2eabe036bf4bf39b6bffdf0bde
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 22 16:34:09 2026 -0600
[troff]: `pftr` request accepts arguments (1/2).
* src/roff/troff/node.cpp (print_font_translation_request): Accept
arguments; interpret each as a font identifier, and report the
translation thereof if it is not the identity mapping.
Begins fixing <https://savannah.gnu.org/bugs/?68948>.
This commit omits an indentation update to clarify the logic change.
---
ChangeLog | 7 +++++++
src/roff/troff/node.cpp | 25 ++++++++++++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4996ba6a8..a7ddfdcfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-11-22 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp (print_font_translation_request):
+ Accept arguments; interpret each as a font identifier, and
+ report the translation thereof if it is not the identity
+ mapping.
+
2026-11-22 G. Branden Robinson <[email protected]>
* src/roff/troff/node.cpp (print_font_translation_request): Fix
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 92f1d36e9..5e5bdae36 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6861,16 +6861,35 @@ static void translate_font_request() // .ftr
skip_line();
}
-// TODO: Support reading a list of font identifiers as arguments, like
-// `pnr` and `pm`. Will need to reject nonnegative integers.
static void print_font_translation_request() // .pftr
{
- dictionary_iterator iter(font_translation_dictionary);
symbol from, to;
+ if (has_arg()) {
+ do {
+ from = read_identifier();
+ if (from.is_null()) {
+ skip_rest_of_argument();
+ continue;
+ }
+ if (is_nonnegative_integer(from.contents())) {
+ error("font translation applies to a font identifier,"
+ " not a mounting position (%1)", from.contents());
+ continue;
+ }
+ to = get_font_translation(from);
+ // If the name translates to itself, there is no translation; the
+ // `from` font might not even exist.
+ if (strcmp(from.contents(), to.contents()) != 0)
+ errprint("%1\t%2\n", from.contents(), to.contents());
+ } while (has_arg());
+ }
+ else {
+ dictionary_iterator iter(font_translation_dictionary);
// We must use the nuclear `reinterpret_cast` operator because GNU
// troff's dictionary types use a pre-STL approach to containers.
while (iter.get(&from, reinterpret_cast<void **>(&to)))
errprint("%1\t%2\n", from.contents(), to.contents());
+ }
fflush(stderr);
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit