groff
[Top][All Lists]
Advanced

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

Re: [Groff] Rules drawn with \D are rounded


From: Tadziu Hoffmann
Subject: Re: [Groff] Rules drawn with \D are rounded
Date: Thu, 27 Jul 2006 18:40:09 +0200
User-agent: Mutt/1.5.11

> > > Well, it is justifiable, but it isn't documented correctly.
> >
> > The only justification I can think of is that this way it is
> > not apparent when a closed curve isn't closed properly (in the
> > Postscript sense).  This shouldn't happen in a Postscript-aware
> > application, however.
> 
> I don't think so.  Consider for example a rectangle, with border,
> where the left half of the interior is coloured green, and the right
> half is coloured red.  This can be most easily done with

[snip]

I think we're misunderstanding each other here.  I was referring
to the particular choice of linecap and linejoin (rounded).
Example:

.de XX
ps: exec
% "open" triangle
/trio { moveto .5 1 rlineto -1 0 rlineto .5 -1 rlineto stroke } def
% closed triangle
/tric { moveto .5 1 rlineto -1 0 rlineto closepath stroke } def
gsave
currentpoint translate 10 dup scale
1 setlinecap 1 setlinejoin 0 0 trio 2 0 tric
2 setlinecap 0 setlinejoin 4 0 trio 6 0 tric
grestore
..
.devicem XX

The first two triangles (with rounded corners) appear alike,
even though one is "open" and the other is closed, whereas the
third ("open") is noticeably different from the fourth (closed).

Anyhow, it's no real issue in grops because polygons drawn with
"\D'p ...'" are correctly closed by grops; your example works
just as well with mitered joins.  By the way, if you draw the
border last, you get a full-size border, not only half a border
as in your example where you let the fills draw over half the
border width:

\X'ps: exec 0 setlinejoin 0 setlinecap'\
\M[green]\
\Z'\D'P 1 0   0 1   -1 0''\
\h'1'\
\M[red]\
\Z'\D'P 1 0   0 1   -1 0''\
\h'-1'\
\Z'\D'p 2 0   0 1   -2 0''

Regarding the point you were addressing, of course I agree
that filled polygons should not draw borders.


> Sounds useful.  Can you provide a patch, with documentation?

========================================================================
*** prologue    Tue Jul 18 10:40:31 2006
--- prologue.new        Thu Jul 27 17:00:58 2006
***************
*** 55,60 ****
--- 55,61 ----
  /level0 save def
  1 setlinecap
  1 setlinejoin
+ DEFS /BPhook known { DEFS begin BPhook end } if
  72 RES div dup scale
  LS{
  90 rotate
========================================================================

Documentation? We don' need no steenkin' documentation!
No, seriously, I have no idea how to document this since
it's essentially trivial: the code simply checks whether
the user has defined a procedure named "BPhook" (which gets
placed into dictionary "DEFS" by "ps:def" or "ps: mdef"), and
executes it if it exists.  (Don't know about the name, though.
Is it a real hook in the elisp sense, or shouldn't this be
more something like a "hook manager" which allows you to add
arbitrarily many "real" hooks?)

I used to have this at the very beginning of BP, but placing
it after the linejoin and linecap settings allows you to
override these with your preferred values.

Example:

.de XX
ps: def
/BPhook
{ gsave 1 1 .8 setrgbcolor clippath fill grestore
  2 setlinecap 0 setlinejoin }
def
..
.devicem XX

I use linecap 2 instead of 0 because this gives nice corners
in tables, even though the lines are drawn unjoined.







reply via email to

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