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: Ralph Corderoy
Subject: Re: [groff] Alignment problems in pic drawing when using \X'ps: exec
Date: Tue, 24 Jul 2018 10:33:00 +0100

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]