Hi Deri, At 2024-01-20T21:03:11+0000, Deri wrote: > > can't transparently output node at top level > > > > But the reason 1.23.0 doesn't throw these errors is because I hid > > them, not because we fixed them.[7] > > It might be worth clarifying what this caused this error to appear > (before you suppressed it in 1.23.0).
Certainly. I think we're so far down in the weeds relative to a daily *roff user's experience that concrete examples are especially helpful. > A particularly "fruity" bookmark appears in the mom example file > mom-pdf.mom. It uses:- > > .HEADING 1 \ > "Comparison of \-Tps\*[FU4]/\*[FU2]\-mpdfmark with \-Tpdf\*[FU4]/\*[FU2]\-mom > > Which after expansion becomes this:- > > 7. Comparison of \-Tps\h'(\En[.ps]u/\E*[$KERN_UNIT]u*4u)'/\h'(\En[.ps]u/ > \E*[$KERN_UNIT]u*2u)'\-mpdfmark with \-Tpdf\h'(\En[.ps]u/ > \E*[$KERN_UNIT]u*4u)'/\h'(\En[.ps]u/\E*[$KERN_UNIT]u*2u)'\-mom > > And this passed to .pdfbookmark! Mmmm, fragrant! Hint of citrus with an overpowering bouquet of durian! > In the version of pdf.tmac used until now, this monstrous string is > run through .asciify to produce:- > > 7. Comparison of Tps/mpdfmark with Tpdf/mom > > You can see that all the "\-" are missing, .asciify left them as > nodes, and each of them would elicit the error. Yes. Not the most helpful behavior. Some day I'd like to kill `asciify`, or move it into a "string.tmac" file along with `length`, `stringup`, `stringdown`, and so forth. My notional string iterator (`for`) should make that straightforward. > So under 1.22.4 this is what the overview bookmark in the pdf looked > like:- > > 96 0 obj > << > /Dest /pdf:bm23 > /Parent 93 0 R > /Title (7. Comparison of Tps/mpdfmark with Tpdf/mom) > /Prev 109 0 R > >> > endobj > > Obviously, using .asciify is not the answer, particularly since each > unicode character (\[uXXXX]) is a node which can't be asciified, so > gets dropped. Right. `asciify` promises things it can't deliver, unless you're already a major expert and manage your expectations. > So in the latest version of pdf.tmac, not incorporated by Branden yet, > the use of asciify has been dropped and the complete, raw, string, is > passed to the output driver, so it becomes gropdf's job to make sense > of the bookmark. The grout output looks like:- > > x X ps:exec [/Dest /pdf:bm23 /Title (7. Comparison of \-Tps\h'(\En[.ps]u/ > \E*[$KERN_UNIT]u*4u)'/\h'(\En[.ps]u/\E*[$KERN_UNIT]u*2u)'\-mpdfmark with \- > Tpdf\h'(\En[.ps]u/\E*[$KERN_UNIT]u*4u)'/\h'(\En[.ps]u/\E*[$KERN_UNIT]u*2u)'\- > mom) /Level 2 /OUT pdfmark Pretty wild stuff. I wonder what we can do to drop all the stuff that the device control command won't have any use for _before_ packing it in there. Might need a macro that iterates through a string and drops all nodes from it. That's going to need 2 of the new features I have in mind. > But when gropdf writes the pdf it contains:- > > 96 0 oj << /Dest /pdf:bm23 > /Parent 75 0 R > /Prev 91 0 R > /Title (7. Comparison of -Tps/-mpdfmark with -Tpdf/-mom) > >> > endobj It appears that you're doing a lot of cleanup work in gropdf that I'd prefer you didn't have to do. > Which you can see is a more accurate rendition of what the bookmark > should be. Very much so. > The new pdf.tmac with the now released gropdf successfully handles all > unicode (\[uXXXX]), groff named glyphs (i.e. \[em] or \(em), and even > \N'233' type, when they are passed to the output driver. This means > that passing unicode in device controls is not an issue at all, no > need to invent a new way, just using the well established convention > of using \[uXXXX] for the unicode characters, which preconv provides. I didn't realize that. This is great news! I didn't want to _make_ you handle the \[uXXXX] convention, not realizing you had already done the work to support it. It sounds like we're reading from the same hymnal on this issue. The important difference with respect to the Subject: line is that, _if_ someone was using \X to construct these device control commands, then where formerly they would be saying something like (please excuse my pidgin PDF) \X'ps: exec [/Dest /pdf:bm23 /Author Ephraim Bar-B\\[u0065_0301]cue' ...to pass through the Unicode composite character, if the community ratifies (or silently assents to) my proposal to make \X read its argument in copy mode, the extra escape character will stop being necessary, just as it would not be necessary in a string or macro definition (which are also read in copy mode). \X'ps: exec [/Dest /pdf:bm23 /Author Ephraim Bar-B\[u0065_0301]cue' I reckon the affected audience here is small, and possibly restricted to participants in this thread. But I of course will NEWS item it. Still, I'll give people a bit longer to comment and opine. If I get antsy I can always push to a branch. Regards, Branden
signature.asc
Description: PGP signature