groff
[Top][All Lists]
Advanced

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

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


From: Jennifer Sayers
Subject: [groff] Alignment problems in pic drawing when using \X'ps: exec
Date: Tue, 24 Jul 2018 12:26:55 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hello!  I am trying to use a feature of groff that I haven't used before, and I'm running into a bit of trouble.

I have a gpic drawing where I want to have some lines with round endcaps and some with square ones.  (So, it's not a matter of using the BP feature to set the endcap style for the whole page.) I am successfully getting the endcap styles to change, but I am getting a side effect - vertical alignment isn't working properly.

My real drawing is a bit complicated, but I have boiled down my problem to the following short example:

**********************************************************************************************

.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
******************************************************************************************

This produces a short line, a gap, and then a longer line, all lined up with one another.  All as expected.

The tail of the PostScript file is this:

*******************************************************************************************

%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
2 LW 144 12 72 12 DL 324 12 180 12 DL 0 Cg EP
%%Trailer
end
%%EOF

********************************************************************************************

Now, if I uncomment the first "command" line, I get this PostScript

********************************************************************************************

%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
72 12 EBEGIN
0 setlinecap
EEND 2 LW 144 24 72 24 DL 324 24 180 24 DL 0 Cg EP
%%Trailer
end
%%EOF

********************************************************************************************

The lines come out fine, but they have shifted down the page a bit.  I can why in the PostScript - all the numbers that used to be "12" are now "24".

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:

********************************************************************************************

%%Page: 1 1
%%BeginPageSetup
BP
%%EndPageSetup
72 12 EBEGIN
0 setlinecap
EEND 2 LW 144 24 72 24 DL 72 24 EBEGIN
1 setlinecap
EEND 2 LW 324 36 180 36 DL 0 Cg EP
%%Trailer
end
%%EOF

********************************************************************************************

So, what were originally all "12" are now "24" or "36".

I have tried tracking down where this change in the co-ordinates is coming from, by generating the groff intermediate output files and comparing the numbers in them.  The co-ordinate change is not in the output of pic, but it is in the output of troff.  grops is just using what it is being given by troff.

Does anyone understand what is happening here?

Thanks,

jen.




reply via email to

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