groff
[Top][All Lists]
Advanced

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

Re: gropdf landscape orientation support (was: [groff] 04/40: [gropdf]:


From: G. Branden Robinson
Subject: Re: gropdf landscape orientation support (was: [groff] 04/40: [gropdf]: Provide more info in diagnostic message.)
Date: Thu, 17 Nov 2022 18:30:28 -0600

Hi Deri,

At 2022-11-17T21:29:43+0000, Deri wrote:
> Hi Branden,
> 
> In papersize.tmac I see this in a comment:-
> 
>   groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
> 
> So concept of reversing width height by appending an l has already
> been used in groff.

Yes, indeed, I'm well aware of this example, having revised much of our
documentation around it (it has long appeared in the groff(1) page, for
instance).

I note emphatically what the above example _doesn't_ say.

  groff -Tps -dpaper=a4l -P-pa4l -ms foo.ms > foo.ps
                         ^^^^^^^

I am concerned about the incongruity between grops and gropdf here.
(In the following, "groff" is groff 1.22.4 and "test-groff" is groff
Git, my working copy, which is Savannah's HEAD plus your Landscape.diff
and some unrelated changes.)

$ groff -Tps -P-pa4l /dev/null
grops: invalid custom paper size 'a4l' ignored
$ groff -Tps -P-pletterl /dev/null
grops: invalid custom paper size 'letterl' ignored
$ groff -Tpdf -P-pa4l /dev/null
$ printf '.tm \\n(.p\n' | groff -Tpdf -P-pa4l
792000
$ printf '.tm \\n(.p\n' | groff -Tpdf -P-pletterl
792000

$ ./build/test-groff -Tps -P-pa4l /dev/null
grops: error: ignoring invalid custom paper format 'a4l'
$ ./build/test-groff -Tps -P-pletterl /dev/null
./build/test-groff -Tps -P-pletterl /dev/null
grops: error: ignoring invalid custom paper format 'letterl'
$ ./build/test-groff -Tpdf -P-pa4l /dev/null
$ printf '.tm \\n(.p\n' | ./build/test-groff -Tpdf -P-pa4l
792000
$ printf '.tm \\n(.p\n' | ./build/test-groff -Tpdf -P-pletterl
792000

Something I'm curious to know is what gropdf in 1.22.4 was doing with
"-P-pa4l", since it wasn't rejected and the page length didn't change
after Landscape.diff.

> There is a fundamental difference between -p a4 -l and -p a4l. The
> first is a portrait medium where all strokes to the page are
> transformed through 90 degrees.

I'm afraid my primitive Neanderthal brain suspects that these might be
members of an equivalence class under rotations in SO(3).

> The second is a landscape medium with
> no transformation applied to the strokes. If you consider landscape
> printing A5 paper on an A4 printer, you can load the paper in two
> orientations, one way round will require stroke rotation, but none the
> other way.

Being from benighted North America, I must confess to little experience
with ISO paper formats.  I admire their properties, and I spent some
time in an A4 country, but it was a largely paperless working
experience.

> The example above could be written:-
> 
>   groff -Tpdf -dpaper=a4l -P-pa4l -ms foo.ms > foo.ps
> 
> I hope you have grasped the difference.

Alas, no.

> If you examine the contents of the pdf produced you will see
> substantial differences even though they may look the same on the
> screen.

Can you cook up a simple illustrative example?  Maybe use \D escape
sequences to draw a couple of intersecting oblique lines so that I can
tell the visual orientation of the rendered page; sort of a "THIS SIDE
UP" but without text.

> You might like to think about whether -dpaper= should trigger an
> appropriate \X'papersize' if output is pdf, which would ensure both
> groff and gropdf are singing from the same hymn book.

I'll probably get more confused before I get less.  I notice you have
two distinct rotational variables in gropdf, $rot and $frot, and (now)
two different places where rotational transforms are done, complete with
slight differences in sign placement so that I have to recall trig
identities to satisfy myself whether they're equivalent.[1]

875-            my ($x,$y)=PtoR($theta+$curangle,$hyp);
876-            my ($tx, $ty) = ($xpos - $x, GraphY($ypos) - $y);
877:            if ($frot) {
878-              ($tx, $ty) = ($tx *  sin($theta) + $ty * -cos($theta),
879-                            $tx * -cos($theta) + $ty * -sin($theta));

1499-
1500:    if ($rot)
1501-    {
1502-   ($rect->[0],$rect->[1])=Rotate($rect->[0],$rect->[1]);
1503-   ($rect->[2],$rect->[3])=Rotate($rect->[2],$rect->[3]);
1504-    }
--
1509-    my ($tx,$ty)=(@_);
1510:    my $theta=rad($rot);
1511-
1512-    ($tx,$ty)=(d3($tx * cos(-$theta) - $ty * sin(-$theta)),
1513-          d3($tx * sin( $theta) + $ty * cos( $theta)));
1514-    return($tx,$ty);

$rot is new and therefore I know that it is used for rotating the
MediaBox.  What is $frot for?

None of these questions are urgent.

Regards,
Branden

[1] Maybe all I need to remember is the difference between even and odd
    functions.

Attachment: signature.asc
Description: PGP signature


reply via email to

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