gbranden pushed a commit to branch master
in repository groff.

commit 4242713954e6f59a92a97a054429f40ffe708925
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 21 07:35:55 2025 -0500

    [troff]: Slighty refactor (boolify, rename) (3/5).
    
    * src/roff/troff/node.cpp (class tfont): Demote return type of
      `get_kern()` member function from `int` to `bool` and rename to
      `is_kerned()`.
    
      (tfont::get_kern): Same for function definition, renaming this...
      (tfont::is_kerned): ...to this.  Return Boolean instead of integer
      literals.
    
      (glyph_node::merge_glyph_node): Update call site.
---
 ChangeLog               | 13 +++++++++++++
 src/roff/troff/node.cpp | 14 +++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 03f8da68d..ae6d114db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-04-21  G. Branden Robinson <[email protected]>
+
+       [troff]: Slighty refactor (boolify, rename).
+
+       * src/roff/troff/node.cpp (class tfont): Demote return type of
+       `get_kern()` member function from `int` to `bool` and rename to
+       `is_kerned()`.
+       (tfont::get_kern): Same for function definition, renaming
+       this...
+       (tfont::is_kerned): ...to this.  Return Boolean instead of
+       integer literals.
+       (glyph_node::merge_glyph_node): Update call site.
+
 2025-04-21  G. Branden Robinson <[email protected]>
 
        [troff]: Slighty refactor (boolify, rename).
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index b60ec8e7c..55cd695c5 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -217,7 +217,7 @@ public:
   int get_zoom();
   symbol get_name();
   charinfo *get_lig(charinfo *c1, charinfo *c2);
-  int get_kern(charinfo *c1, charinfo *c2, hunits *res);
+  bool is_kerned(charinfo *c1, charinfo *c2, hunits *res);
   int get_input_position();
   int get_character_type(charinfo *);
   int get_height();
@@ -690,24 +690,24 @@ charinfo *tfont::get_lig(charinfo *c1, charinfo *c2)
   return 0 /* nullptr */;
 }
 
-inline int tfont::get_kern(charinfo *c1, charinfo *c2, hunits *res)
+inline bool tfont::is_kerned(charinfo *c1, charinfo *c2, hunits *res)
 {
   if (kern_mode == 0)
-    return 0;
+    return false;
   else {
     int n = fm->get_kern(c1->as_glyph(),
                         c2->as_glyph(),
                         size.to_scaled_points());
     if (n) {
       *res = hunits(n);
-      return 1;
+      return true;
     }
     else
-      return 0;
+      return false;
   }
 }
 
-tfont *tfont::tfont_list = 0;
+tfont *tfont::tfont_list = 0 /* nullptr */;
 
 tfont::tfont(tfont_spec &spec) : tfont_spec(spec)
 {
@@ -2191,7 +2191,7 @@ node *glyph_node::merge_glyph_node(glyph_node *gn)
                               gn->div_nest_level, next1);
     }
     hunits kern;
-    if (tf->get_kern(ci, gn->ci, &kern)) {
+    if (tf->is_kerned(ci, gn->ci, &kern)) {
       node *next1 = next;
       next = 0 /* nullptr */;
       return new kern_pair_node(kern, this, gn, state,

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

Reply via email to