gbranden pushed a commit to branch master
in repository groff.
commit e4d1217ba450cf30e0d6a291ec7fcb0e5313746f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 13 10:04:30 2026 -0500
[troff]: Trivially refactor (1/10).
Rename function to better align with terminology used in our
documentation.
* src/roff/troff/node.h: Rename declaration of `symbol_fontno()` to
`mounting_position_of_font()`, since it has nothing to do with a
"symbol font" (like "S") as discussed by user-facing documentation.
* src/roff/troff/node.cpp (symbol_fontno): Rename this...
(mounting_position_of_font): ...to this.
* src/roff/troff/env.cpp (environment::set_font):
* src/roff/troff/node.cpp (is_abstract_style)
(font_family::resolve, read_font_identifier): Update call sites.
---
ChangeLog | 15 +++++++++++++++
src/roff/troff/env.cpp | 2 +-
src/roff/troff/node.cpp | 10 +++++-----
src/roff/troff/node.h | 2 +-
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35022101a..fe87408f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-04-13 G. Branden Robinson <[email protected]>
+
+ [troff]: Trivially refactor. Rename function to better align
+ with terminology used in our documentation.
+
+ * src/roff/troff/node.h: Rename declaration of `symbol_fontno()`
+ to `mounting_position_of_font()`, since it has nothing to do
+ with a "symbol font" (like "S") as discussed by user-facing
+ documentation.
+ * src/roff/troff/node.cpp (symbol_fontno): Rename this...
+ (mounting_position_of_font): ...to this.
+ * src/roff/troff/env.cpp (environment::set_font):
+ * src/roff/troff/node.cpp (is_abstract_style)
+ (font_family::resolve, read_font_identifier): Update call sites.
+
2026-04-13 G. Branden Robinson <[email protected]>
* src/roff/troff/node.cpp: Refactor. Take one of
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 5cefbdeef..e59c5d14f 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -642,7 +642,7 @@ bool environment::set_font(symbol nm)
}
else {
prev_fontno = fontno;
- int n = symbol_fontno(nm);
+ int n = mounting_position_of_font(nm);
if (n < 0) {
n = next_available_font_position();
if (!mount_font(n, nm))
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 24b3be6ad..00dadcd45 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6737,7 +6737,7 @@ bool mount_font(int n, symbol name, symbol external_name)
bool is_abstract_style(symbol s)
{
- int i = symbol_fontno(s);
+ int i = mounting_position_of_font(s);
return (i < 0) ? false : font_table[i]->is_style();
}
@@ -6903,8 +6903,8 @@ int font_family::resolve(int mounting_position)
symbol sty = font_table[pos]->get_name();
symbol f = catenate(nm, sty);
int n;
- // Don't use symbol_fontno, because that might return a style and
- // because we don't want to translate the name.
+ // Don't use mounting_position_of_font(), because that might return a
+ // style and because we don't want to translate the name.
for (n = 0; n < font_table_size; n++)
if ((font_table[n] != 0 /* nullptr */) && font_table[n]->is_named(f)
&& !font_table[n]->is_style())
@@ -7009,7 +7009,7 @@ static bool read_font_identifier(font_lookup_info *finfo)
symbol s = read_identifier(true /* want_diagnostic */);
finfo->requested_name = const_cast<char *>(s.contents());
if (!s.is_null()) {
- n = symbol_fontno(s);
+ n = mounting_position_of_font(s);
if (n < 0) {
n = next_available_font_position();
if (mount_font(n, s))
@@ -7230,7 +7230,7 @@ int next_available_font_position()
return i;
}
-int symbol_fontno(symbol s)
+int mounting_position_of_font(symbol s)
{
s = get_font_translation(s);
for (int i = 0; i < font_table_size; i++)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 25567127f..cee9f73ee 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -709,7 +709,7 @@ extern bool is_abstract_style(symbol);
extern bool mount_style(int, symbol);
extern bool is_valid_font_mounting_position(int);
extern bool is_valid_font(int);
-extern int symbol_fontno(symbol);
+extern int mounting_position_of_font(symbol);
extern int next_available_font_position();
extern void init_size_list(int *);
extern int get_underline_fontno();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit