gbranden pushed a commit to branch master
in repository groff.

commit 46af4c7d6bb1171bdb1c3cdd83f18c14bfac99fe
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Nov 24 12:14:30 2026 -0600

    [libgroff,troff]: Trivially refactor.
    
    Rename "character type" in function names (and one local variable) to
    "character extent".
    
    * src/include/font.h (class font):  Update declaration:
      `get_character_type()` -> `get_character_extent()`.
    
    * src/libs/libgroff/font.cpp (font::get_character_type): Rename this...
      (font::get_character_extent): ...to this.
    
    * src/roff/troff/env.cpp (environment::width_registers): Rename local
      `character_type` to `character_extent`.
    
    * src/roff/troff/node.h
      (struct node):
      (class zero_width_node):
      (class left_italic_corrected_node): Update declaration
      `character_type()` -> `character_extent()`.
    
    * src/roff/troff/node.cpp:
    
      (class tfont): Update declaration: `get_character_type()` ->
      `get_character_extent()`.
    
      (tfont::get_character_type): Rename this...
      (tfont::get_character_extent): ...to this.
    
      (class glyph_node): Update declaration `character_type()` ->
      `character_extent()`.
    
      (glyph_node::character_type): Rename this...
      (glyph_node::character_extent): ...to this.
    
      (class italic_corrected_node): Update declaration `character_type()`
      -> `character_extent()`.
    
      (italic_corrected_node::character_type): Rename this...
      (italic_corrected_node::character_extent): ...to this.
    
      (class break_char_node): Update declaration `character_type()` ->
      `character_extent()`.
    
      (break_char_node::character_type): Rename this...
      (break_char_node::character_extent): ...to this.
    
      (node_list_character_type): Rename this...
      (node_list_character_extent): ...to this.
    
      (zero_width_node::character_type): Rename this...
      (zero_width_node::character_extent): ...to this.
    
      (node:character_type): Rename this...
      (node:character_extent): ...to this.
    
      (left_italic_corrected_node::character_type): Rename this...
      (left_italic_corrected_node::character_extent): ...to this.
---
 ChangeLog                  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/include/font.h         |  3 ++-
 src/libs/libgroff/font.cpp |  3 ++-
 src/roff/troff/env.cpp     |  6 +++---
 src/roff/troff/node.cpp    | 46 +++++++++++++++++++++++++++-------------------
 src/roff/troff/node.h      |  6 +++---
 6 files changed, 81 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5ea98637b..0be2f4a5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2026-11-24  G. Branden Robinson <[email protected]>
+
+       [libgroff,troff]: Trivially refactor.  Rename "character type"
+       in function names (and one local variable) to "character
+       extent".
+
+       * src/include/font.h (class font): Update declaration:
+       `get_character_type()` -> `get_character_extent()`.
+       * src/libs/libgroff/font.cpp (font::get_character_type): Rename
+       this...
+       (font::get_character_extent): ...to this.
+       * src/roff/troff/env.cpp (environment::width_registers): Rename
+       local `character_type` to `character_extent`.
+       * src/roff/troff/node.h
+       (struct node):
+       (class zero_width_node):
+       (class left_italic_corrected_node): Update declaration
+       `character_type()` -> `character_extent()`.
+       * src/roff/troff/node.cpp:
+       (class tfont): Update declaration: `get_character_type()` ->
+       `get_character_extent()`.
+       (tfont::get_character_type): Rename this...
+       (tfont::get_character_extent): ...to this.
+       (class glyph_node): Update declaration `character_type()` ->
+       `character_extent()`.
+       (glyph_node::character_type): Rename this...
+       (glyph_node::character_extent): ...to this.
+       (class italic_corrected_node): Update declaration
+       `character_type()` -> `character_extent()`.
+       (italic_corrected_node::character_type): Rename this...
+       (italic_corrected_node::character_extent): ...to this.
+       (class break_char_node): Update declaration `character_type()`
+       -> `character_extent()`.
+       (break_char_node::character_type): Rename this...
+       (break_char_node::character_extent): ...to this.
+       (node_list_character_type): Rename this...
+       (node_list_character_extent): ...to this.
+       (zero_width_node::character_type): Rename this...
+       (zero_width_node::character_extent): ...to this.
+       (node:character_type): Rename this...
+       (node:character_extent): ...to this.
+       (left_italic_corrected_node::character_type): Rename this...
+       (left_italic_corrected_node::character_extent): ...to this.
+
 2026-11-24  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (class font_info, class tfont_spec):
diff --git a/src/include/font.h b/src/include/font.h
index 85bae6719..1e4109f66 100644
--- a/src/include/font.h
+++ b/src/include/font.h
@@ -134,7 +134,8 @@ public:
                        // this value is positive.
   int get_space_width(int);    // Return the normal width of a space at the
                        // given point size.
-  int get_character_type(glyph *);     // Return a bit mask describing the
+// TODO: retype to an enum
+  int get_character_extent(glyph *);   // Return a bit mask describing the
                        // shape of the given glyph.  Bit 0 is set if the
                        // character has a descender.  Bit 1 is set if the
                        // character has a tall glyph.  See groff manual,
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index 362abf527..b908e9221 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -642,7 +642,8 @@ bool font::has_ligature(int mask)
   return (bool) (mask & ligatures);
 }
 
-int font::get_character_type(glyph *g)
+// TODO: retype to an enum
+int font::get_character_extent(glyph *g)
 {
   int idx = glyph_to_index(g);
   assert(idx >= 0);
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index ec10f15cf..b858309c5 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1286,7 +1286,7 @@ void environment::width_registers()
 {
   // this is used to implement \w; it sets the st, sb, ct registers
   vunits min = 0, max = 0, cur = 0;
-  int character_type = 0;
+  int character_extent = 0; // TODO: retype to an enum
   ssc_reg_contents = line ? line->subscript_correction().to_units() : 0;
   skw_reg_contents = line ? line->skew().to_units() : 0;
   line = reverse_node_list(line);
@@ -1305,14 +1305,14 @@ void environment::width_registers()
       min = cur;
     else if (cur > max)
       max = cur;
-    character_type |= tem->character_type();
+    character_extent |= tem->character_extent();
   }
   line = reverse_node_list(line);
   st_reg_contents = -min.to_units();
   sb_reg_contents = -max.to_units();
   rst_reg_contents = -real_min.to_units();
   rsb_reg_contents = -real_max.to_units();
-  ct_reg_contents = character_type;
+  ct_reg_contents = character_extent;
 }
 
 node *environment::extract_output_line()
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 91f208afb..79ae27246 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -239,7 +239,7 @@ public:
   charinfo *get_lig(charinfo *c1, charinfo *c2);
   bool is_kerned(charinfo *c1, charinfo *c2, hunits *res);
   int get_input_position();
-  int get_character_type(charinfo *);
+  int get_character_extent(charinfo *); // TODO: retype to an enum
   int get_height();
   int get_slant();
   vunits get_char_height(charinfo *);
@@ -636,9 +636,10 @@ inline int tfont::contains(charinfo *ci)
   return metrics->contains(ci->as_glyph());
 }
 
-inline int tfont::get_character_type(charinfo *ci)
+// TODO: retype to an enum
+inline int tfont::get_character_extent(charinfo *ci)
 {
-  return metrics->get_character_type(ci->as_glyph());
+  return metrics->get_character_extent(ci->as_glyph());
 }
 
 inline bool tfont::is_emboldened(hunits *res)
@@ -2045,7 +2046,7 @@ public:
   node *add_self(node *, hyphen_list **);
   void ascii_print(ascii_output_file *);
   void asciify(macro *);
-  int character_type();
+  int character_extent(); // TODO: retype to an enum
   bool is_same_as(node *);
   const char *type();
   bool causes_tprint();
@@ -2189,9 +2190,10 @@ node *glyph_node::merge_self(node *nd)
   return nd->merge_glyph_node(this);
 }
 
-int glyph_node::character_type()
+// TODO: retype to an enum
+int glyph_node::character_extent()
 {
-  return tf->get_character_type(ci);
+  return tf->get_character_extent(ci);
 }
 
 node *glyph_node::add_self(node *n, hyphen_list **p)
@@ -2924,7 +2926,7 @@ public:
   hyphenation_type get_hyphenation_type();
   tfont *get_tfont();
   hyphen_list *get_hyphen_list(hyphen_list *, int *);
-  int character_type();
+  int character_extent(); // TODO: retype to an enum
   void tprint(troff_output_file *);
   hunits subscript_correction();
   hunits skew();
@@ -3047,9 +3049,10 @@ hyphen_list 
*italic_corrected_node::get_hyphen_list(hyphen_list *tail,
   return nodes->get_hyphen_list(tail, count);
 }
 
-int italic_corrected_node::character_type()
+// TODO: retype to an enum
+int italic_corrected_node::character_extent()
 {
-  return nodes->character_type();
+  return nodes->character_extent();
 }
 
 class break_char_node : public container_node {
@@ -3067,7 +3070,7 @@ public:
   hunits width();
   vunits vertical_width();
   node *last_char_node();
-  int character_type();
+  int character_extent(); // TODO: retype to an enum
   int ends_sentence();
   node *add_self(node *, hyphen_list **);
   hyphen_list *get_hyphen_list(hyphen_list *, int *);
@@ -3132,9 +3135,10 @@ node *break_char_node::last_char_node()
   return nodes->last_char_node();
 }
 
-int break_char_node::character_type()
+// TODO: retype to an enum
+int break_char_node::character_extent()
 {
-  return nodes->character_type();
+  return nodes->character_extent();
 }
 
 int break_char_node::ends_sentence()
@@ -3405,17 +3409,19 @@ node *zero_width_node::copy()
                             div_nest_level);
 }
 
-static int node_list_character_type(node *p)
+// TODO: retype to an enum
+static int node_list_character_extent(node *p)
 {
   int t = 0;
   for (; p != 0 /* nullptr */; p = p->next)
-    t |= p->character_type();
+    t |= p->character_extent();
   return t;
 }
 
-int zero_width_node::character_type()
+// TODO: retype to an enum
+int zero_width_node::character_extent()
 {
-  return node_list_character_type(nodes);
+  return node_list_character_extent(nodes);
 }
 
 static void node_list_vertical_extent(node *p, vunits *min, vunits *max)
@@ -3776,7 +3782,8 @@ bool node::set_unformat_flag()
   return true;
 }
 
-int node::character_type()
+// TODO: retype to an enum
+int node::character_extent()
 {
   return 0;
 }
@@ -6298,9 +6305,10 @@ node *left_italic_corrected_node::add_self(node *nd, 
hyphen_list **p)
   }
 }
 
-int left_italic_corrected_node::character_type()
+// TODO: retype to an enum
+int left_italic_corrected_node::character_extent()
 {
-  return (nodes != 0 /* nullptr */) ? nodes->character_type() : 0;
+  return (nodes != 0 /* nullptr */) ? nodes->character_extent() : 0;
 }
 
 bool overstrike_node::is_same_as(node *nd)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 9a042ee05..830496335 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -81,7 +81,7 @@ struct node {
   virtual vunits vertical_width();
   virtual node *last_char_node();
   virtual void vertical_extent(vunits *, vunits *);
-  virtual int character_type();
+  virtual int character_extent(); // TODO: retype to an enum
   virtual void set_vertical_size(vertical_size *);
   virtual int ends_sentence();
   virtual node *merge_self(node *);
@@ -510,7 +510,7 @@ public:
   bool causes_tprint();
   bool is_tag();
   void append(node *);
-  int character_type();
+  int character_extent(); // TODO: retype to an enum
   void vertical_extent(vunits *, vunits *);
 };
 
@@ -536,7 +536,7 @@ public:
   bool overlaps_vertically();
   hyphenation_type get_hyphenation_type();
   tfont *get_tfont();
-  int character_type();
+  int character_extent(); // TODO: retype to an enum
   hunits skew();
   hunits italic_correction();
   hunits subscript_correction();

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

Reply via email to