gbranden pushed a commit to branch master
in repository groff.

commit 8d18d336de19bead469d7bf469f61b5565906ce9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 21 02:28:50 2025 -0500

    [troff]: Slightly refactor.
    
    * src/roff/troff/env.h (get_bold): Rename this declaration...
      (get_emboldening_offset): ...to this.  Change return type from `int`
      to `hunits`.
    * src/roff/troff/env.cpp (get_bold):
      (get_emboldening_offset): Same for definition.
      (init_env_requests): Wire up `.b` register to
      `get_emboldening_offset()` using `init_hunits_env_reg()` instead of
      `init_int_env_reg()`.
    
    * src/roff/troff/node.h (get_bold_fontno): Rename this declaration...
      (env_font_emboldening_offset): ...to this.  Change return type from
      `int` to `hunits`.
---
 ChangeLog               | 18 ++++++++++++++++++
 src/roff/troff/env.cpp  |  6 +++---
 src/roff/troff/env.h    |  2 +-
 src/roff/troff/node.cpp |  3 +--
 src/roff/troff/node.h   |  2 +-
 5 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 633da264a..379d730be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2025-04-21  G. Branden Robinson <[email protected]>
+
+       [troff]: Slightly refactor.
+
+       * src/roff/troff/env.h (get_bold): Rename this declaration...
+       (get_emboldening_offset): ...to this.  Change return type from
+       `int` to `hunits`.
+       * src/roff/troff/env.cpp (get_bold):
+       (get_emboldening_offset): Same for definition.
+       (init_env_requests): Wire up `.b` register to
+       `get_emboldening_offset()` using `init_hunits_env_reg()` instead
+       of `init_int_env_reg()`.
+
+       * src/roff/troff/node.h (get_bold_fontno): Rename this
+       declaration...
+       (env_font_emboldening_offset): ...to this.  Change return type
+       from `int` to `hunits`.
+
 2025-04-21  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (embolden_font): Add diagnostics.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index c1c525053..7a2601692 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1078,9 +1078,9 @@ vunits environment::total_post_vertical_spacing()
   return tem;
 }
 
-int environment::get_bold()
+hunits environment::get_emboldening_offset()
 {
-  return get_bold_fontno(this, fontno);
+  return env_font_emboldening_offset(this, fontno);
 }
 
 hunits environment::get_digit_width()
@@ -4302,7 +4302,7 @@ void init_env_requests()
 #ifdef WIDOW_CONTROL
   init_request("wdc", widow_control_request);
 #endif /* WIDOW_CONTROL */
-  init_int_env_reg(".b", get_bold);
+  init_hunits_env_reg(".b", get_emboldening_offset);
   init_vunits_env_reg(".cdp", get_prev_char_depth);
   init_int_env_reg(".ce", get_centered_line_count);
   init_vunits_env_reg(".cht", get_prev_char_height);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 09823b628..c064ea18a 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -288,7 +288,7 @@ public:
   int get_zoom();                      // .zoom
   int get_numbering_nodes();           // .nm
   font_family *get_family() { return family; }
-  int get_bold();                      // .b
+  hunits get_emboldening_offset();     // .b
   unsigned get_adjust_mode();          // .j
   int get_fill();                      // .u
   hunits get_indent();                 // .i
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 602f3e24e..a5ec036d4 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6964,8 +6964,7 @@ int symbol_fontno(symbol s)
   return FONT_NOT_MOUNTED;
 }
 
-// XXX: This does _not_ return a font "number" (mounting position)!
-int get_bold_fontno(environment *env, int n)
+hunits env_font_emboldening_offset(environment *env, int n)
 {
   if (is_valid_font_mounting_position(n)) {
     hunits offset;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 265e84203..889afb68d 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -676,7 +676,7 @@ node *reverse_node_list(node *);
 void delete_node_list(node *);
 node *copy_node_list(node *);
 
-int get_bold_fontno(environment *, int);
+hunits env_font_emboldening_offset(environment *, int);
 
 inline hyphen_list::hyphen_list(unsigned char code, hyphen_list *p)
 : is_hyphen(false), is_breakable(false), hyphenation_code(code), next(p)

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

Reply via email to