Follow-up Comment #13, bug #66653 (group groff): Hi Deri,
At 2025-08-31T17:31:07-0400, Deri James wrote:
> I like it a lot. One problem outstanding, it does not like your name!
> If I use
>
> this as a test:-
>
> .box DIV
> hello \[u260E] world and G.\& \fBBranden\fP Robinson
> \#hello \[ru] world
> .br
> .box
> .
> .\"pm DIV
> .chop DIV
> .asciify DIV
> .\"pm DIV
> .DIV
> \X'pdf: ignoreme \*[DIV]'
> .pdfinfo /Title "\*[DIV]"
>
> Using:-
>
> test-groff -Tpdf -Z G.trf
>
> You will notice:-
>
> troff:G.trf:12: warning: a node is not encodable in device-independent output
> ('asciify' might help)
> x X ps:exec [/Title (hello \[u260E] world and G.) /DOCINFO pdfmark
>
> Cut off in your prime! However, if you apply:-
>
> --- ../src/roff/troff/node.cpp 2025-08-31 21:06:24.050087492 +0100
> +++ node.cpp 2025-08-31 21:08:58.421762137 +0100
> @@ -3883,7 +3883,8 @@
>
> void node::asciify(macro *m)
> {
> - m->append(this);
> + if (strcmp("dummy_node", this->type()) != 0 && strcmp("tag_node", this-
>> type()) != 0)
> + m->append(this);
> }
The gods of OOP would punish you severely for that! But I like it as a
bug-fix demonstrator. It also prompts me to try sticking a "tag node"
(the name of which itches me) into the diversion and see what blows up.
> The problem (and the error) disappear. This is probably not the best
> way to stop dummy_nodes depositing null chars into c-string (which is
> what causes the truncation), I don't know anything about C++
> inheritance, it might just require a dummy_node::asciify routine which
> does nothing!
You know more about C++ programming than you think! I think your idea
is pretty close to what other classes do when the `asciify` operation
just isn't meaningful for them.
void line_start_node::asciify(macro *)
{
delete this;
}
So I tried this...
$ git diff
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 03bbd5421..f0a555d6b 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4038,6 +4038,11 @@ void vertical_size_node::asciify(macro *)
delete this;
}
+void dummy_node::asciify(macro *)
+{
+ delete this;
+}
+
breakpoint *node::get_breakpoints(hunits /* width */, int /* nspaces */,
breakpoint *rest, bool /* is_inner */)
{
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index a22c2084d..f79204a33 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -466,6 +466,7 @@ public:
class dummy_node : public node {
public:
dummy_node(node * nd = 0 /* nullptr */) : node(nd) {}
+ void asciify(macro *);
node *copy();
bool is_same_as(node *);
const char *type();
...on this...
.box DIV
hello, G.\& Branden Robinson
\#hello \[ru] world
.br
.box
.DIV
.\"pm DIV
.chop DIV
.asciify DIV
.\"pm DIV
.DIV
\X'pdf: ignoreme \*[DIV]'
...and got this.
$ ./build/test-groff -bww -Z ATTIC/dummy-char-in-diversion.groff
x T ps
x res 72000 1 1
x init
p1
x font 5 TR
f5
s10000
md
DFd
V12000
H72000
thello,
wh2500
tJ.
wh2500
tR.
wh2500
Clq
h4440
tBob
Crq
wh6940
tDobbs
wh2500
thello,
wh2500
tJ.
wh2500
tR.
wh2500
Clq
h4440
tBob
Crq
wh6940
tDobbs
V12000
H273940
x X pdf: ignoreme hello, J. R. \[u201C]Bob\[u201D] Dobbs
n12000 0
x trailer
V792000
x stop
So I'll commit that to my working copy and look into the tag node thing.
If that goes well, I'll push sooner rather than later because this could
be a nice milestone.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66653>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
