gbranden pushed a commit to branch master
in repository groff.

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

    [troff]: Slighty refactor (boolify, rename) (2/5).
    
    * src/roff/troff/node.cpp (class tfont): Demote return type of
      `get_constant_space()` member function from `int` to `bool` and rename
      to `is_constantly_spaced()`.
    
      (tfont::get_constant_space): Same for function definition, renaming
      this...
      (tfont::is_constantly_spaced): ...to this.  Return Boolean instead of
      integer literals.
    
      (composite_node::width)
      (glyph_node::tprint)
      (glyph_node::zero_width_tprint)
      (composite_node::tprint): Update call sites.
---
 ChangeLog               | 16 ++++++++++++++++
 src/roff/troff/node.cpp | 16 ++++++++--------
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9b747b6cf..03f8da68d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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_constant_space()` member function from `int` to `bool` and
+       rename to `is_constantly_spaced()`.
+       (tfont::get_constant_space): Same for function definition,
+       renaming this...
+       (tfont::is_constantly_spaced): ...to this.  Return Boolean
+       instead of integer literals.
+       (composite_node::width)
+       (glyph_node::tprint)
+       (glyph_node::zero_width_tprint)
+       (composite_node::tprint): Update call sites.
+
 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 5473b896b..b60ec8e7c 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -210,7 +210,7 @@ public:
   int contains(charinfo *);
   hunits get_width(charinfo *c);
   bool is_emboldened(hunits *); // "by how many hunits?" in argument
-  int get_constant_space(hunits *);
+  bool is_constantly_spaced(hunits *); // "by how many hunits?" in arg
   hunits get_track_kern();
   tfont *get_plain();
   font_size get_size();
@@ -601,14 +601,14 @@ inline bool tfont::is_emboldened(hunits *res)
     return false;
 }
 
-inline int tfont::get_constant_space(hunits *res)
+inline bool tfont::is_constantly_spaced(hunits *res)
 {
   if (is_constant_spaced) {
     *res = constant_space_width;
-    return 1;
+    return true;
   }
   else
-    return 0;
+    return false;
 }
 
 inline hunits tfont::get_track_kern()
@@ -4653,7 +4653,7 @@ node *composite_node::copy()
 hunits composite_node::width()
 {
   hunits x;
-  if (tf->get_constant_space(&x))
+  if (tf->is_constantly_spaced(&x))
     return x;
   x = H0;
   for (node *tem = nodes; tem; tem = tem->next)
@@ -5014,7 +5014,7 @@ void glyph_node::tprint(troff_output_file *out)
     hunits w = ptf->get_width(ci);
     hunits k = H0;
     hunits x;
-    int cs = tf->get_constant_space(&x);
+    bool cs = tf->is_constantly_spaced(&x);
     if (cs) {
       x -= w;
       if (bold)
@@ -5039,7 +5039,7 @@ void glyph_node::zero_width_tprint(troff_output_file *out)
   hunits offset;
   int bold = tf->is_emboldened(&offset);
   hunits x;
-  int cs = tf->get_constant_space(&x);
+  int cs = tf->is_constantly_spaced(&x);
   if (cs) {
     x -= ptf->get_width(ci);
     if (bold)
@@ -5287,7 +5287,7 @@ void composite_node::tprint(troff_output_file *out)
   int is_bold = tf->is_emboldened(&bold_offset);
   hunits track_kern = tf->get_track_kern();
   hunits constant_space;
-  int is_constant_spaced = tf->get_constant_space(&constant_space);
+  int is_constant_spaced = tf->is_constantly_spaced(&constant_space);
   hunits x = H0;
   if (is_constant_spaced) {
     x = constant_space;

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

Reply via email to