gbranden pushed a commit to branch master
in repository groff.

commit a181396db9e659f750658f2def6ce04c99f2edc9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Nov 24 13:51:24 2026 -0600

    src/roff/troff/node.cpp: Add font info dumper.
    
    * src/roff/troff/node.cpp (class font_info): Declare new public member
      function `dump()`.
    
      (font_info::dump): Define it.
    
    Notes:
    1.  This commit doesn't wire the function up to anything; you'd have to
        execute it from a debugger.
    2.  More work needs to be done to expose additional properties like
        constant spacing, conditional emboldening, and track kerning.
---
 ChangeLog               |  6 ++++++
 src/roff/troff/node.cpp | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0be2f4a5a..f8400f72a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-11-24  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp (class font_info): Add font info
+       dumper.  Declare new public member function `dump()`.
+       (font_info::dump): Define it.
+
 2026-11-24  G. Branden Robinson <[email protected]>
 
        [libgroff,troff]: Trivially refactor.  Rename "character type"
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 79ae27246..85a75f280 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -193,6 +193,7 @@ public:
   void set_zoom(int);
   int get_zoom() const;
   font *get_font() const;
+  void dump() const;
   friend symbol get_font_name(int, environment *);
   friend symbol get_style_name(int);
 };
@@ -308,6 +309,24 @@ font *font_info::get_font() const
   return metrics;
 }
 
+void font_info::dump() const
+{
+  errprint("\tidentifier: %1\n", identifier.contents());
+  errprint("\tdescription file name: %1\n",
+          description_file_name.contents());
+  errprint("\tmarked as special in description file: %1\n",
+          is_special() ? "yes" : "no");
+  // We don't report the `is_style()` property because our caller always
+  // resolves a user-supplied font name or mounting position.
+  int zoom = get_zoom();
+  errprint("\tzoom factor: %1%2\n", zoom, (zoom == 0) ? " (none)" : "");
+  hunits embo;
+  if (is_emboldened(&embo))
+    errprint("\temboldening: %1u\n", embo.to_units());
+  else
+    errprint("\temboldening: none\n");
+}
+
 tfont *make_tfont(tfont_spec &spec)
 {
   for (tfont *p = tfont::tfont_list; p != 0 /* nullptr */; p = p->next)

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

Reply via email to