groff
[Top][All Lists]
Advanced

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

Re: drawing commands in groff(7) (was: undiagnosed pic error)


From: Douglas McIlroy
Subject: Re: drawing commands in groff(7) (was: undiagnosed pic error)
Date: Tue, 6 Jun 2023 17:57:14 -0400

Branden

Your \D description looks good, except perhaps for
the word "solid", which I suppose was to avoid
overloading "fill". But "fill" is baked into pic, from
which I suspect the vast majority of \Ds originate.
It's also PostScript terminology.

I wrote the raster ellipse-drawing program for plan 9. Its
arc capability was not adopted because the interface
was sufficiently ugly that calling it was comparable
to writing a trivial floating-point ellipse program from
scratch. The main issue is that the endpoints of an
arc are hard to specify on a raster. Since groff doesn't
know about rasters, perhaps that decision could be
revisited. Do you have a good candidate for an interface?

Tilted ellipses pose another problem--specification. This
difficulty is exaggerated on a raster, where giving two half
axes is questionable, because in general roundoff results
in non-perpendicular axes, Perhaps the cleanest spec
in this setting is to give a bounding box and two points
of tangency, but this may not be popular. Again, groff
might enable other possibilities.

Doug

On Tue, Jun 6, 2023 at 4:07 PM G. Branden Robinson
<g.branden.robinson@gmail.com> wrote:
>
> [self-follow-up]
>
> At 2023-06-05T20:57:37-0500, G. Branden Robinson wrote:
> > Hi Doug,
> >
> > At 2023-06-05T19:48:50-0400, Douglas McIlroy wrote:
> > > > I understand that groff has the \D escape which allows you, among
> > > > other things, to draw outline and filled polygons.
> > >
> > > Very helpful. I rely on the old testament book of Ossanna and on
> > > groff(7), neither of which cover that option for \D. One must look
> > > in "info groff". I hope Branden's extensive edits to groff(7) for
> > > 1.23 may correct my myopia.
> >
> > Regrettably, not yet.  I've been kicking that can down the road [...]
>
> Here's my first cut of this.
>
>   Drawing commands
>     Drawing commands direct the output device to render geometrical
>     objects rather than glyphs.  Specific devices may support only a
>     subset, or may feature additional ones; consult the man page for the
>     output driver in use.  Terminal devices in particular implement
>     almost none.
>
>     Rendering starts at the drawing position; when finished, the drawing
>     position is left at the rightmost point of the object, even for
>     closed figures, except where noted.  GNU troff draws objects with
>     the selected stroke color; the interior of solid ones is shaded with
>     the fill color.  See section "Colors" above.  Coordinates h and v
>     are horizontal and vertical motions relative to the drawing position
>     or previous point in the command.
>
>     \D'~ h1 v1 ... hn vn'
>         Draw B-spline to each point in sequence, leaving drawing
>         position at (hn, vn).
>     \D'a hc hv h v'
>         Draw circular arc centered at (hc, vc) from the drawing position
>         to (h, v).
>     \D'c d'
>         Draw circle of diameter d with its leftmost point at the drawing
>         position.
>     \D'C d'
>         As \D'C', but the circle is solid.
>     \D'e h v'
>         Draw ellipse of diameter d with its leftmost point at the
>         drawing position.
>     \D'E h v'
>         As \D'e', but the ellipse is solid.
>     \D'l h v'
>         Draw line from the drawing position to (h, v).
>     \D'p h1 v1 ... hn vn'
>         Draw polygon with vertices at drawing position and each point in
>         sequence.  GNU troff closes the polygon by drawing a line from
>         (hn, vn) back to the initial drawing position.  Afterward, the
>         drawing position is left at (hn, vn).
>     \D'P h1 v1 ... hn vn'
>         As \D'p', but the polygon is solid.
>     \D't n'
>         Set line thickness of geometric objects to to n basic units.  A
>         zero n selects the minimal supported thickness.  A negative n
>         selects a thickness proportional to the type size; this is the
>         default.
>
> Comments?
>
> How was one supposed to draw a "skewed" ellipse in AT&T troff?  That is,
> one with its axes rotated non-orthogonally?
>
> Was any consideration given to elliptical arcs?  (Maybe there is a
> straightforward transformation of these to B-splines.  I don't feel I
> understand B-splines very well.)
>
> Regards,
> Branden



reply via email to

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