|
From: Joerg L. <jo...@us...> - 2003-10-21 12:11:22
|
Hi Otto,
On 20.10.03, Otto Tronarp wrote:
> However, I have found one thing that I miss. The length of dashes and
> space in dashed, dotted, and dashdotted is absolute and not relative
> to line width. So if I draw a THICK dotted line I get a semi solid
> line instead. Therefore, I propose to add the possibility to define
> the dashes in terms of the current line width, something like the
> attached patch.
>
> It does the following:
>
> 1: The init function of dashes takes an additional argument
> normdist. If it is set to true it emitts code like
> [0 currentlinewidth mul 3 currentlinewidth mul ] 0 setdash
> instead of
> [0 3 ] 0 setdash
I could swear that I once - some years ago - tried using noninteger
numbers in the array passed to the setdash operator - and it didn result
in an error. So my first thought was that your solution doesn't work at
all. But, of course, you're right and in principle, we could do
that.
However, I don't like the name normdist too much. It doesn't seem
to be very intuitive, does it? How about one of the following.
- absolute
- abslengths
- abslen
- relative
- rellengths
- rellen
Further suggestions?
> BTW: What version of python do you require? Is it ok to use True and
> False instead?
At the moment we only require Python 2.1, because it is the default in
Debian/stable, which does not know True and False.
> 2: However, for this to work the linewidth must be set before we set
> the dash so I introduced a class member in PathStyle named prio
> (default 0) and I set this prio to 1 in linewidth. Then in
> decoratedpath::_writestyles I do a reverse sort on prio before we
> write the styles to file.
Similar ordering problems arise at other places in PyX, where we
use a similar solution. André, maybe we should use the mechanism
of the text module?
> 3: I wasn't sure if it should be default behavior so I
> introduced dottedn, dashedn, and dashdottedn for now.
I really want to avoid the duplication of linestyles, so one
should really choose a sensible default. I would tend to
use the "automatic" behaviour. Other options?
> I don't know if this takes care of all cases for dashed lines (can I
> draw a dashed line without decoratedpath?) However, it works for the
> attached test case (dotted-test.py) so it is at least a proof of concept.
In principle you can draw a dashed line without decoratedpath but this
is neither the recommended behaviour nor is it documented. So your
solution is fine.
Jörg
--
JOERG LEHMANN | PyX - High quality PostScript figures with Python & TeX
jo...@lu... | Visit http://pyx.sourceforge.net/
|