Update of bug #68511 (group groff):

                  Status:               Confirmed => Need Info
             Assigned to:                gbranden => barx
                 Summary: [troff] `hcode` doesn't work since commit
994fcce775, 2026-05-24 => [troff] `hcode` doesn't work on ordinary characters
since commit 994fcce775, 2026-05-24

    _______________________________________________________

Follow-up Comment #8:

[comment #2 comment #2:]
> This means no non-ASCII letters can be given a hyphenation code.

Is our test for this invalid?

The test passes on Git HEAD.  (Strictly, this is my working copy, which is ~36
commits ahead of the master branch, but I haven't mucked about...much...with
the formatter this week.[1]


$ ../src/roff/groff/tests/hcode-request-copies-spec-char-code.sh && echo
SUCCESS
<beginning of page>
r<'e><hy>
sum<'e>
r<'e><hy>
sum<'e>
R<'E><hy>
SUM<'E>
SUCCESS


Please have a look at
[https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/groff/tests/hcode-request-copies-spec-char-code.sh?h=1.24.1
that test script] and see if I've hare-brained it.

[1] Full disclosure:


$ git log --oneline --reverse origin..HEAD
a799f4cf0 ChangeLog: Update and correct recent entries.
72a8fe31f ChangeLog: Clarify recent item.
1cd879e91 INSTALL.REPO,NEWS: Document new build dependency.
325c1c714 doc/doc.am: Clean temporary files.
16dd442e0 doc/doc.am: Add and clarify comments.
68e3bda6d doc/doc.am: Add new "texinfo-all" phony target.
0c6a29f89 [doc,man]: Fix content, style, and markup nits.
44ad2f346 [doc,man]: Fix style nits.
9fdfe28ab [doc,man]: Reform terminology.
1cfd10458 doc/groff.texi.in: Improve wording.
52b6637b2 doc/groff.texi.in: Elaborate `ti` applications.
d62cd703e [doc,man]: Clarify meaning of `.in` register.
2d7681288 doc/groff.texi.in: Revise `sizes` req description.
6e9ed1580 [grn]: Boolify.
4a6afac83 [grn]: exit(3) as the grn(1) man page says.
795a9d927 src/preproc/tbl/main.cpp: Improve comment.
98ce8a483 src/roff/groff/groff.cpp: Fix code style nits.
d80997d70 [groff]: Migrate to ISO C++98 `try/new/catch`.
4a657c89a tmac/an.tmac: Trivially refactor.
21da37d2e [groff]: Add unit test for `fzoom` request.
74db765a1 src/roff/troff/node.cpp: Annotate code.
19fa6fb56 src/roff/troff/node.cpp: Fix code nit.
c17da9755 src/roff/troff/node.cpp: Refactor.
5cc404594 groff_man*(7): Fix content and style nits.
ac5cc433c [ms]: Doc `Q`, `U` strings as Berkeley extensions.
1952a7fff [ms]: Tighten discussion of optional macro args.
7d400d0aa doc/ms.ms.in: Fix use of colorized text.
57ce2bb3b doc/ms.ms.in: Fix macro synopsis syntax.
1841b716c doc/ms.ms.in: Swap presentation order of XM, XR.
2ecf0511e [ms]: Prevent "style" warning from issuing.
ec3011e15 [ms]: Use "T-1" as cover page number in PDF.
94aa014cf tmac/s.tmac: Trivially refactor.
b1ab31790 tmac/s.tmac: Fix code style nit.
744cdc553 [ms]: Revise doc abstract and introduction.
d7fd68da3 groff_ms(7): Update "See also" section.
bbdf19f1e (HEAD -> master) doc/ms.ms.in: Define and use `man-ref` macro.

$ diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index f3d41f0f0..ca42ba8a4 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -140,7 +140,7 @@ struct font_lookup_info {
 };
 
 font_lookup_info::font_lookup_info() : position(FONT_NOT_MOUNTED),
-  requested_position(FONT_NOT_MOUNTED), requested_name(0)
+  requested_position(FONT_NOT_MOUNTED), requested_name(0 /* nullptr */)
 {
 }
 
@@ -1692,8 +1692,10 @@ void troff_output_file::trailer(vunits page_length)
 }
 
 troff_output_file::troff_output_file()
-: current_slant(0), current_height(0), current_fill_color(0),
-  current_stroke_color(0), mounting_position_count(10), tbuf_len(0),
+: current_slant(0), current_height(0),
+  current_fill_color(0 /* nullptr */),
+  current_stroke_color(0 /* nullptr */),
+  mounting_position_count(10), tbuf_len(0),
   has_page_begun(false), cur_div_level(0)
 {
   font_mounting_position = new symbol[mounting_position_count];
@@ -4486,8 +4488,8 @@ tfont *device_extension_node::get_tfont()
 /* suppress_node */
 
 suppress_node::suppress_node(int on_or_off, int issue_limits)
-: is_on(on_or_off), emit_limits(issue_limits), filename(0), position(0),
-  image_id(0)
+: is_on(on_or_off), emit_limits(issue_limits),
+  filename(0 /* nullptr */), position('l'), image_id(0)
 {
 }
 
@@ -4971,7 +4973,8 @@ width_list::width_list(hunits w, hunits s)
 }
 
 width_list::width_list(width_list *w)
-: width(w->width), sentence_width(w->sentence_width), next(0)
+: width(w->width), sentence_width(w->sentence_width),
+  next(0 /* nullptr */)
 {
 }
 
@@ -7236,47 +7239,37 @@ static void zoom_font_request() // .fzoom
     skip_line();
     return;
   }
-  symbol font_name = read_identifier();
-  // has_arg()+read_identifier() should ensure the assertion succeeds.
-  assert(font_name != 0 /* nullptr */);
-  if (is_nonnegative_integer(font_name.contents())) {
-    warning(WARN_FONT, "cannot set zoom factor of a font mounting"
-           " position");
+  font_lookup_info finfo;
+  if (!read_font_identifier(&finfo)) {
+    font_lookup_error(finfo, "to set its zoom factor");
     skip_line();
     return;
   }
-  if (!(has_arg())) {
-    warning(WARN_MISSING, "font zoom factor request expects zoom factor"
-           " argument");
+  if (0 /* nullptr */ == finfo.requested_name) {
+    error("applying a zoom factor to a font mounting position"
+         " is not yet supported");
     skip_line();
     return;
   }
   int fpos = next_available_font_mounting_position();
-  if (!(mount_font_at_position(font_name, fpos))) {
+  if (!(mount_font_at_position(finfo.requested_name, fpos))) {
     error("cannot mount font '%1' to set a zoom factor for it",
-         font_name.contents());
+         finfo.requested_name);
     skip_line();
     return;
   }
-#if 0
-  // This would be a good diagnostic to have, but
-  // mount_font_at_position() is too formally complex to make it easy.
-  // Instead it will fail in the above test on a font named "R", for
-  // instance, when that is literally true but might not help users who
-  // don't understand that "R", "I", "B", and "BI" are (by default)
-  // abstract styles, not fonts in the GNU troff sense.  It is a shame
-  // that a lot of our validation functions are willing only to handle
-  // arguments that they eat from the input stream (i.e., you can't pass
-  // them information you obtained elsewhere).  That design also forces
-  // us to validate request arguments in the order they appear in the
-  // input, and seems unnecessarily inflexible to me.  --GBR
   if (font_table[fpos]->is_style()) {
     warning(WARN_FONT, "ignoring request to set font zoom factor on an"
            " abstract style");
     skip_line();
     return;
   }
-#endif
+  if (!(has_arg())) {
+    warning(WARN_MISSING, "font zoom factor request expects zoom factor"
+           " argument");
+    skip_line();
+    return;
+  }
   int zoom = 0;
   read_integer(&zoom);
   if (zoom < 0) {


Those changes don't involve hyphenation codes.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68511>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to