Update of bug #68883 (group groff):

                  Status:               Confirmed => None
             Assigned to:                gbranden => None

    _______________________________________________________

Follow-up Comment #4:

[comment #3 comment #3:]
> commit 41542f995 repeats the same incorrect diagnosis of the issue which this
> bug introduced. Assigning to Branden since it looks like he didn't spot my
> comments below

I saw your comments.  But I wanted to get the release out, not keep churning
my working copy, especially over a relatively minor detail that was easily
worked arond.
 
> which establish the correct diagnosis of the issue.

I think you're hasty to call it "correct".

[comment #1 comment #1:]
> Hi Branden,
> 
> This is my analysis
> 
> The .device command adds the command to current "line".

This is not intelligible to me.  Do you mean the pending output line?  If so,
that's correct.  There is only one way to get information from the input
document to the output device: via a node in a node list.
 
> The TH command contains .in 0 and a .sp command (in PT).

Yes.

> Both of these cause a line break if there is a partially filled line (causing
> the extra 1v).

Not relevant here, because the `device` command _itself_ creates a "partially
filled line" (pending output line).  But it has to, as there's no other way to
get the information it encodes to the output device.

> So it is neither a driver nor a difference in using .device.

It is, I think, a problem with employing device extension commands and not
having sufficiently expressive means of communicating to the output driver
what that extension command means for the state of the page.

> The workaround which you have probably used is to add .sp -1

As you must have observed from the commit you cited, I used `.sp |0`.

> to the bottom of the title page.

No, not to the bottom of the title page.  I emit the `.sp |0` **after** a page
break request, `bp`.  In fact I had to, or the change to PDF page numbering
would, as I recall, take effect too soon, messing up the contents of the
navigation pane.

> This flushes the partially filled line but negates the consequent vertical
> movement.

I don't want any vertical movement "consequent" to the use of the device
extension command.

> One way of "fixing" this would be change troff so that it does not flush a
> partially filled line if that line only contains \X nodes,

It has to flush the "partially filled line" (pending output line) to get _any_
device extension nodes, created by `\X` _or_ `.device`, to the output driver.

> unless it is an explicit .fl.

This brings us back to bug #66187.

I think the scope of this bug should be a _gropdf_ documentation issue, to
explain to the user what the consequences of using a device extension command
can be...until we come up with a fix for bug #66187, such that _pdf.tmac_'s
"convenience macros" can wrap the emission of `\X` and `.device` instructions
to prevent unwanted vertical motions in the output.

> This is the relevant grout:-

Here's the relevant node sequence from a very simple document.


$ printf '.pdfpagenumbering D . 1\n.pline\n' | ./build/test-groff -T pdf -z
2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "pdf.tmac",
      "starting line number": 865,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  }
]


If we go straight to the request, we get the same result:


$ printf '.device pdf: pagenumbering D . 1\n.pline\n' | ./build/test-groff -T
pdf -z 2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "<standard input>",
      "starting line number": 1,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  }
]


If we use the `\X` escape sequence, we get something a little different.


$ printf '\\X"pdf: pagenumbering D . 1"\n.pline\n' | ./build/test-groff -T pdf
-z 2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "<standard input>",
      "starting line number": 1,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  },
  {
    "type": "word space node",
    "diversion level": 0,
    "is_special_node": false,
    "hunits": 2500,
    "undiscardable": false,
    "is hyphenless breakpoint": false,
    "terminal_color": "default",
    "width_list": [
      {
        "width": 2500,
        "sentence_width": 2500
      }
    ],
    "unformat": false
  }
]


That word space node is because the `\X` escape sequence occurs on a text
line, and the text line ends with a newline, which, when filling is disabled,
is interpreted as a word space.

But what if we add `\c`?


$ printf '\\X"pdf: pagenumbering D . 1"\\c\n.pline\n' | ./build/test-groff -T
pdf -z 2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "<standard input>",
      "starting line number": 1,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  },
  {
    "type": "transparent dummy node",
    "diversion level": 0,
    "is_special_node": false
  }
]


We get a transparent dummy node instead--which is not very helpful
nomenclature on Clark's part, as it has nothing to do with dummy characters,
but then the latter is my coinage, of which Clark could not have been aware in
1990.  Long story short, that's Clark's name for what `\c` becomes on output.

Should `\c` cause `.in` or `.sp` to cause a break?  Let's see.


$ printf '.in 0\n.pline\n' | ./build/test-groff -T pdf -z 2>&1 | jq
[]
$ printf '\\c\n.in 0\n.pline\n' | ./build/test-groff -T pdf -z 2>&1 | jq
[]


Apparently not.  So, perturbing the input one more time:


$ printf '\\X"pdf: pagenumbering D . 1"\\c\n.pline\n' | ./build/test-groff -T
pdf -z 2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "<standard input>",
      "starting line number": 1,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  },
  {
    "type": "transparent dummy node",
    "diversion level": 0,
    "is_special_node": false
  }
]


...a "device extension command line" means the pending output line has
"content" and is therefore breakable.

But what if we use another technique?


$ printf '.nf\n\\X"pdf: pagenumbering D . 1"\n.pline\n' | ./build/test-groff
-T pdf -z 2>&1 | jq
[]


Wuh-oh.  And yet:


$ printf '.nf\n.device pdf: pagenumbering D . 1\n.pline\n' |
./build/test-groff -T pdf -z 2>&1 | jq
[
  {
    "type": "output line start node",
    "diversion level": 0,
    "is_special_node": false
  },
  {
    "type": "device extension command node",
    "diversion level": 0,
    "is_special_node": true,
    "macro": {
      "file name": "<standard input>",
      "starting line number": 2,
      "length": 24,
      "contents": "pdf: pagenumbering D . 1",
      "node list": []
    },
    "tfont": "TR",
    "stroke_color": "default",
    "fill_color": "default"
  }
]


I think there's an inconsistency here.


    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to