On Wednesday, 18 December 2024 12:36:13 GMT Tadziu Hoffmann wrote: > > I wrote "pdf: pdfpic" to mimic the behaviour of .PSPIC, > > render image down from current point, [...] > > The above difference means this works for pdf:- > > > > .char \[gnu] \v'-9p'\X'pdf: pdfpic GNU-head-small.pdf -L 10p'\h'10p' > > A GNU head \[gnu] image. > > Thanks for the feedback! This solution is perfectly workable. > However, I had to change the -9p to -8.8p (which is the > aspect ratio of the image times 10p) to get the baseline of > the text to the right of the image to be aligned with the > text on the left. > > Interestingly, I also get a vertical shift if I wrap the sequence > \v'...'\X'...' in \Z'...' which is supposed to restore the > horizontal and vertical position after outputting the contents. > Does that mean that the pdfpic special does not restore the > graphics state (with q/Q) after inserting the image file? > In that case there might be a discrepancy between what troff > and gropdf consider to be the current output position.
Hi Tadziu, Mea culpa (again!) although I was aware of this faux pas for a while. I mistakenly add the height of the image to gropdf's Y position after rendering the image. While this means that the sequence - up height of image : image : right width of image - as in Peter's code, works, it is clearly "wrong", as your \Z experiment shows. If I corrected this the sequence required would become - up height of image : image : down height of image : right width of image. I have not done anything yet, (a) no one has reported it as bug, and (b) I hate changing existing behaviour which may affect users documents. Given what I discovered yesterday regarding grops rendering up from the base line and this aberrant behaviour of mine, I am gradually coming round to the view that a new "pdf: inline" (I did not like "pdf: pdfpicup", sounds like some sort of road vehicle!) is required, which would sit the image on the baseline as "ps: import" and leave the Y position well alone!! I would appreciate guidance on whether this is a good idea or not. The reason why this behaviour has not been reported sooner is probably because .PDFPIC includes a break after the image so the grout file includes new H and V commands which reset the position for gropdf. Cheers Deri