gbranden pushed a commit to branch master
in repository groff.

commit 18f224c42aad75020febfa4958e13cc30be111cf
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Jun 4 08:55:30 2025 -0500

    src/roff/troff/node.cpp: Trivially refactor.
    
    ...for clarity.
    
    * src/roff/troff/node.cpp (mount_font_no_translate): Rename argument
      from `external_name` to `filename` for clarity.  This argument only
      ever stores the name of the font description file, which is usually
      also the font identifier in GNU troff (but can differ if the `fp`
      request's three-argument form is used).
    
      (mount_font_at_position): Rename local variable `external_name` to
      `filename` for the same reason.
---
 ChangeLog               | 10 ++++++++++
 src/roff/troff/node.cpp | 24 ++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index af8ff0fa4..fe8ec1551 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -165,6 +165,16 @@
        to `fn` to preƫmpt `-Wshadow` compiler warning with planned
        refactoring of `class font`.
 
+2025-06-04  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp (mount_font_no_translate): Rename
+       argument from `external_name` to `filename` for clarity.  This
+       argument only ever stores the name of the font description file,
+       which is usually also the font identifier in GNU troff (but can
+       differ if the `fp` request's three-argument form is used).
+       (mount_font_at_position): Rename local variable `external_name`
+       to `filename` for the same reason.
+
 2025-06-04  G. Branden Robinson <[email protected]>
 
        * src/devices/grodvi/dvi.cpp
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index de7cb2a48..debd8ddc5 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6500,21 +6500,21 @@ dictionary font_dictionary(50);
 font nonexistent_font = font("\0");
 
 // Mount font at position `n` with troff identifier `name` and
-// description file name `external_name`.  If `check_only`, just look up
-// `name` in the existing list of mounted fonts.
-static bool mount_font_no_translate(int n, symbol name,
-                                   symbol external_name,
+// description file name `filename` (these are often identical).  If
+// `check_only`, just look up `name` in the existing list of mounted
+// fonts.
+static bool mount_font_no_translate(int n, symbol name, symbol filename,
                                    bool check_only = false)
 {
   assert(n >= 0);
   font *fm = 0 /* nullptr */;
-  void *p = font_dictionary.lookup(external_name);
+  void *p = font_dictionary.lookup(filename);
   if (0 /* nullptr */ == p) {
-    fm = font::load_font(external_name.contents(), check_only);
+    fm = font::load_font(filename.contents(), check_only);
     if (check_only)
       return fm != 0 /* nullptr */;
     if (0 /* nullptr */ == fm) {
-      (void) font_dictionary.lookup(external_name, &nonexistent_font);
+      (void) font_dictionary.lookup(filename, &nonexistent_font);
       return false;
     }
     (void) font_dictionary.lookup(name, fm);
@@ -6534,7 +6534,7 @@ static bool mount_font_no_translate(int n, symbol name,
   }
   else if (font_table[n] != 0 /* nullptr */)
     delete font_table[n];
-  font_table[n] = new font_info(name, n, external_name, fm);
+  font_table[n] = new font_info(name, n, filename, fm);
   font_family::invalidate_fontno(n);
   return true;
 }
@@ -6642,11 +6642,11 @@ static void mount_font_at_position()
     else {
       symbol internal_name = get_name(true /* required */);
       if (!internal_name.is_null()) {
-       symbol external_name = get_long_name();
-       if (!mount_font(n, internal_name, external_name)) {
+       symbol filename = get_long_name();
+       if (!mount_font(n, internal_name, filename)) {
          string msg;
-         if (external_name != 0 /* nullptr */)
-           msg += string(" from file '") + external_name.contents()
+         if (filename != 0 /* nullptr */)
+           msg += string(" from file '") + filename.contents()
              + string("'");
          msg += '\0';
          error("cannot load font description '%1'%2 for mounting",

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to