gbranden pushed a commit to branch master
in repository groff.

commit 1ef9c6e4caa9ea80ac978b93f3d5f058919e24dd
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Nov 24 14:04:28 2026 -0600

    src/roff/troff/node.cpp: Add `pft` request.
    
    * src/roff/troff/node.cpp (print_font_properties_request): New function
      reports font properties that are bound to the font itself (globally),
      rather than to the environment (as type size, height, and slant are).
    
      (init_node_requests): Wire up "pft" name to new function.
    
    Begins fixing <https://savannah.gnu.org/bugs/?68522>.
    
    Illustration:
    
    $ for id in 1 R TR S; do echo .pft $id | ./build/test-groff; done
    font mounting position 1 resolves to mounting position 5
            identifier: TR
            description file name: TR
            marked as special in description file: no
            zoom factor: 0 (none)
            emboldening: none
    font 'R' resolves to mounting position 5
            identifier: TR
            description file name: TR
            marked as special in description file: no
            zoom factor: 0 (none)
            emboldening: none
    font 'TR'
            identifier: TR
            description file name: TR
            marked as special in description file: no
            zoom factor: 0 (none)
            emboldening: none
    font 'S'
            identifier: S
            description file name: S
            marked as special in description file: yes
            zoom factor: 0 (none)
            emboldening: none
---
 ChangeLog               | 10 ++++++++++
 src/roff/troff/node.cpp | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index a55665734..7e8074ff1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-11-24  G. Branden Robinson <[email protected]>
+
+       [troff]: Add `pft` request.
+
+       * src/roff/troff/node.cpp (print_font_properties_request): New
+       function reports font properties that are bound to the font
+       itself (globally), rather than to the environment (as type size,
+       height, and slant are).
+       (init_node_requests): Wire up "pft" name to new function.
+
 2026-11-24  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (font_lookup_error)
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 9410fba4c..a4fb2904e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7695,6 +7695,37 @@ static void constantly_space_font_request() // .cs
   skip_line();
 }
 
+static void print_font_properties_request() // .pft
+{
+  if (!has_arg()) {
+    warning(WARN_MISSING, "font property report request"
+           " expects arguments");
+    skip_line();
+    return;
+  }
+  font_lookup_info finfo;
+  int mp, ump;
+  do {
+    if (!read_and_resolve_font_identifier(&finfo)) {
+      skip_rest_of_argument();
+      continue;
+    }
+    errprint("font");
+    mp = finfo.position;
+    ump = finfo.unresolved_position;
+    if (finfo.requested_name != 0 /* nullptr */)
+      errprint(" '%1'", finfo.requested_name);
+    else
+      errprint(" mounting position %1", ump);
+    if (mp != ump)
+      errprint(" resolves to mounting position %1", mp);
+    errprint("\n");
+    mounted_font[mp]->dump();
+  } while (has_arg());
+  fflush(stderr);
+  skip_line();
+}
+
 static void set_ligature_mode_request() // .lg
 {
   int lig;
@@ -7783,6 +7814,7 @@ void init_node_requests()
   init_request("kern", set_kerning_mode_request);
   init_request("lg", set_ligature_mode_request);
   init_request("pfp", print_font_mounting_position_request);
+  init_request("pft", print_font_properties_request);
   init_request("pftr", print_font_translation_request);
   init_request("rfschar", remove_font_specific_character_request);
   init_request("shc", soft_hyphen_character_request);

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

Reply via email to