gbranden pushed a commit to branch master
in repository groff.
commit df0f037eba362d516f8c7f59e16b51543a785c09
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jul 13 12:50:37 2026 -0500
[tmac,troff]: Fix Savannah #68345.
Warn about a deprecated font name only if it isn't translated to a non-
deprecated name.
* tmac/ps.tmac: Drop font translations of deprecated names; leave it up
to the user to do this.
* src/roff/troff/env.cpp (environment::select_font): Look up the font's
translated name using "node.cpp"'s `get_font_translation()`. Move
check for deprecated font name to follow font translation.
* src/roff/troff/node.cpp (get_font_translation): Drop `static` linkage;
as noted above, the function needs external visibility now. Annotate
planned future reversal of this change.
* src/roff/troff/node.h: Declare `get_font_translation`. Annotate
planned future reversal of this change.
Fixes <https://savannah.gnu.org/bugs/?68345>. Thanks to Deri James for
prompting this (IMO) superior direction for font name deprecation to
take.
---
ChangeLog | 22 ++++++++++++++++++++++
src/roff/troff/env.cpp | 6 +++---
src/roff/troff/node.cpp | 4 +++-
src/roff/troff/node.h | 3 +++
tmac/ps.tmac | 22 ----------------------
5 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0f581f05c..92b9dfebb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2026-07-13 G. Branden Robinson <[email protected]>
+
+ [tmac,troff]: Warn about a deprecated font name only if it isn't
+ translated to a non-deprecated name.
+
+ * tmac/ps.tmac: Drop font translations of deprecated names;
+ leave it up to the user to do this.
+
+ * src/roff/troff/env.cpp (environment::select_font): Look up the
+ font's translated name using "node.cpp"'s
+ `get_font_translation()`. Move check for deprecated font name
+ to follow font translation.
+ * src/roff/troff/node.cpp (get_font_translation): Drop `static`
+ linkage; as noted above, the function needs external visibility
+ now. Annotate planned future reversal of this change.
+ * src/roff/troff/node.h: Declare `get_font_translation`.
+ Annotate planned future reversal of this change.
+
+ Fixes <https://savannah.gnu.org/bugs/?68345>. Thanks to Deri
+ James for prompting this (IMO) superior direction for font name
+ deprecation to take.
+
2026-07-13 G. Branden Robinson <[email protected]>
* src/devices/grohtml/post-html.cpp
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index d82a2f6f1..37ff2056a 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -628,9 +628,6 @@ bool environment::select_font(symbol nm)
{
if (was_line_interrupted)
return false;
- // TODO: Kill this off in groff 1.24.0 release + 2 years.
- if (is_device_ps_or_pdf)
- warn_if_font_name_deprecated(nm);
if (nm == symbol("P") || nm.is_empty()) {
if (family->resolve(prev_fontno) == FONT_NOT_MOUNTED)
return false;
@@ -641,6 +638,9 @@ bool environment::select_font(symbol nm)
else {
prev_fontno = fontno;
int n = mounting_position_of_font(nm);
+ symbol translated_font_name = get_font_translation(nm);
+ if (is_device_ps_or_pdf)
+ warn_if_font_name_deprecated(translated_font_name);
if (n < 0) {
n = next_available_font_mounting_position();
if (!mount_font_at_position(nm, n))
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 64b190853..b12d0a0d9 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6664,7 +6664,9 @@ static void grow_font_table(int n)
dictionary font_translation_dictionary(17);
-static symbol get_font_translation(symbol nm)
+// TODO: Make this static (again) in groff 1.24.0 release + 2 years.
+// See input.cpp.
+symbol get_font_translation(symbol nm)
{
void *p = font_translation_dictionary.lookup(nm);
return p ? symbol(static_cast<char *>(p)) : nm;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index f165eaf93..fdb2ff6d0 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -762,6 +762,9 @@ extern void dump_node_list_in_reverse(node *);
extern search_path include_search_path;
extern const int FONT_NOT_MOUNTED;
+// TODO: Kill off the following in groff 1.24.0 release + 2 years. See
+// input.cpp.
+symbol get_font_translation(symbol nm);
// Local Variables:
// fill-column: 72
diff --git a/tmac/ps.tmac b/tmac/ps.tmac
index 2ad3433f9..a5d395512 100644
--- a/tmac/ps.tmac
+++ b/tmac/ps.tmac
@@ -3,28 +3,6 @@
.do nr *groff_ps_tmac_C \n[.cp]
.cp 0
.
-.\" These font translations will be withdrawn sometime after groff 1.24.
-.ftr AX ABI
-.ftr KR BMR
-.ftr KI BMI
-.ftr KB BMB
-.ftr KX BMBI
-.ftr CW CR
-.ftr CO CI
-.ftr CX CBI
-.ftr H HR
-.ftr HO HI
-.ftr HX HBI
-.ftr Hr HNR
-.ftr Hi HNI
-.ftr Hb HNB
-.ftr Hx HNBI
-.ftr NX NBI
-.ftr PA PR
-.ftr PX PBI
-.ftr ZI ZCMI
-.ftr C CR
-.
.cflags 8 \[an]
.
.char \[radicalex] \h'-\w'\[sr]'u'\[radicalex]\h'\w'\[sr]'u'
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit