groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] Alignment problems in pic drawing when using \X'ps: exec


From: Russell Hyer
Subject: Re: [groff] Alignment problems in pic drawing when using \X'ps: exec
Date: Tue, 24 Jul 2018 10:41:35 +0000

Hi Ralph,

Thanks for that input, but as I already found documented I can't see
how \c is any kind of a solution where the grops man page that's
effectively being called by the X command states:

"grops man page where it
states:

"       \X'ps: exec code'
              This  executes  the arbitrary PostScript commands in code.  The
              PostScript currentpoint is set to the position of the  \X  com‐
              mand before executing code.  The origin is at the top left cor‐
              ner of the page, and y coordinates increase down the  page.   A
              procedure u is defined that converts groff units to the coordi‐
              nate system in effect (provided the  user  doesn't  change  the
              scale).  For example, ...
"

Though, referring back to the manual did help suggest a fix that would
work, which is to change the vertical spacing, since this can easily
be adjusted on the fly and a simple test is simply to set .vs 0 in the
file itself which automatically fixes these issues (although the
regular solution becomes like a CSS edit by hand trick).

Russ

On 24 July 2018 at 09:33, Ralph Corderoy <address@hidden> wrote:
> Hi Jen,
>
>> I have boiled down my problem to the following short example:
>
> Thanks.
>
>     $ cat jen.tr
>     .PS
>     #command "\X'ps: exec 0 setlinecap'"
>     linethick = 2
>     line right 1
>     move right 0.5
>     #command "\X'ps: exec 1 setlinecap'"
>     line right 2
>     .PE
>     $
>
>> The tail of the PostScript file is this:
> ...
>> 2 LW 144 12 72 12 DL 324 12 180 12 DL 0 Cg EP
>>
>> Now, if I uncomment the first "command" line, I get this PostScript
> ...
>> 72 12 EBEGIN
>> 0 setlinecap
>> EEND 2 LW 144 24 72 24 DL 324 24 180 24 DL 0 Cg EP
> ...
>> The lines come out fine, but they have shifted down the page a bit.
>
> By the line spacing used for text.
>
>> When I uncomment the second "command" line, 12 gets added again to
>> what comes after it, so that the second line appears further down the
>> page than the first one:
>
> Another unit of line spacing.
>
>> Does anyone understand what is happening here?
>
> You are putting text lines interpersed with pic's output, they just
> happen to not have any text on them.
>
>     $ ed jen.tr
>     137
>     /exec
>     #command "\X'ps: exec 0 setlinecap'"
>     s/#/
>     command "\X'ps: exec 0 setlinecap'"
>     s/"$/\\c&
>     command "\X'ps: exec 0 setlinecap'\c"
>     w ralph.tr
>     138
>     q
>     $
>     $ diff jen.tr ralph.tr
>     2c2
>     < #command "\X'ps: exec 0 setlinecap'"
>     ---
>     > command "\X'ps: exec 0 setlinecap'"\c
>     $
>     $ diff <(pic <jen.tr) <(pic <ralph.tr)
>     10a11,12
>     > .lf 2
>     > \X'ps: exec 0 setlinecap'\c
>     $
>     $ diff <(groff -p <jen.tr) <(groff -p <ralph.tr)
>     3a4
>     > %%DocumentNeededResources: font Times-Roman
>     197c198,199
>     < grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
>     ---
>     > %%IncludeResource: font Times-Roman
>     > grops begin/DEFS 52 dict def DEFS begin/u{.001 mul}bind def end/RES 72
>     204c206,208
>     < 2 LW 144 12 72 12 DL 324 12 180 12 DL 0 Cg EP
>     ---
>     > 72 12 EBEGIN
>     > 0 setlinecap
>     > EEND 2 LW 144 12 72 12 DL 324 12 180 12 DL 0 Cg EP
>     $
>     $ # one word per line
>     $ diff <(groff -p <jen.tr | owpl) <(groff -p <ralph.tr | owpl)
>     11a12,14
>     > %%DocumentNeededResources:
>     > font
>     > Times-Roman
>     557a561,563
>     > %%IncludeResource:
>     > font
>     > Times-Roman
>     560c566
>     < 1
>     ---
>     > 52
>     580a587,592
>     > 72
>     > 12
>     > EBEGIN
>     > 0
>     > setlinecap
>     > EEND
>     $
>
> The `\X' is still triggering the addition of the Times-Roman font, but
> the coordinates that had twelve added before are unaltered.  `\c' is
> described in section 4.2 of CSTR 54, https://troff.org/54.pdf, and in
> the output of `info groff 'Line Control' | cat'.
>
> --
> Cheers, Ralph.
> https://plus.google.com/+RalphCorderoy
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]