You can subscribe to this list here.
| 2002 |
Jan
|
Feb
(13) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(15) |
Jul
(4) |
Aug
(4) |
Sep
(4) |
Oct
(41) |
Nov
(3) |
Dec
(19) |
| 2004 |
Jan
(7) |
Feb
(1) |
Mar
(6) |
Apr
(13) |
May
(26) |
Jun
(6) |
Jul
(66) |
Aug
(13) |
Sep
|
Oct
(21) |
Nov
(12) |
Dec
(24) |
| 2005 |
Jan
(7) |
Feb
(24) |
Mar
(9) |
Apr
(5) |
May
|
Jun
(8) |
Jul
(5) |
Aug
(22) |
Sep
(58) |
Oct
(6) |
Nov
|
Dec
(2) |
| 2006 |
Jan
(1) |
Feb
(11) |
Mar
(12) |
Apr
(8) |
May
(12) |
Jun
(30) |
Jul
(6) |
Aug
(2) |
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
(8) |
Aug
(3) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(21) |
Apr
(6) |
May
(12) |
Jun
(13) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
| 2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(26) |
Jun
(1) |
Jul
(40) |
Aug
|
Sep
|
Oct
(15) |
Nov
|
Dec
(2) |
| 2012 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
(24) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(9) |
Nov
(3) |
Dec
(2) |
| 2013 |
Jan
(12) |
Feb
(8) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2014 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(6) |
| 2016 |
Jan
(4) |
Feb
(10) |
Mar
(4) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(4) |
Oct
(2) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: Michael J G. <mic...@us...> - 2011-12-22 13:26:27
|
r3235 moved plot styles to graph.style. As a result, plotitem raises
AttributeError: 'module' object has no attribute 'getdefaultprovider'
because style.getdefaultprovider() does not find getdefaultprovider when
called in the module style (graph.style).
Fix this by referencing getdefaultprovider() directly (without the
module) in that module.
Signed-off-by: Michael J Gruber <mic...@us...>
---
pyx/graph/style.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pyx/graph/style.py b/pyx/graph/style.py
index 4afc047..9471b2f 100644
--- a/pyx/graph/style.py
+++ b/pyx/graph/style.py
@@ -56,7 +56,7 @@ class plotitem:
for s in styles:
for n in s.needsdata:
if n not in provided:
- defaultprovider = style.getdefaultprovider(n)
+ defaultprovider = getdefaultprovider(n)
addstyles.append(defaultprovider)
provided.extend(defaultprovider.providesdata)
provided.extend(s.providesdata)
--
1.7.8.1.461.g7edd2
|
|
From: Michael J G. <mic...@us...> - 2011-10-13 19:46:47
|
Hi André André Wobst venit, vidit, dixit 13.10.2011 21:41: > Hi Michael, > > nice MAPline trick. However it should be rather safe to use a T1 Font > by font.T1font(<t1file instance>, <afmfile instance>). In the future > we'll likely provide an official "text-without-TeX" feature. For the > moment (to use the correct PyX Logo) I added some textpath > functionality to the texrunner.text return value. See changeset > 3230. Huh, that is cheating ;) But nice cheating, I just didn't know how to get the textpath from text.text() and resorted to the unofficial t-wo-t (and to "PyX" rather than r"\PyX"). Nice! Michael |
|
From: André W. <wo...@us...> - 2011-10-13 19:42:00
|
Hi Michael,
nice MAPline trick. However it should be rather safe to use a T1 Font by font.T1font(<t1file instance>, <afmfile instance>). In the future we'll likely provide an official "text-without-TeX" feature. For the moment (to use the correct PyX Logo) I added some textpath functionality to the texrunner.text return value. See changeset 3230.
Best,
André
Am 11.10.2011 um 11:12 schrieb Michael J Gruber:
> ---
> Here's one for the gallery ;)
>
> There may be better ways to get at a text font using the file locator,
> but then the encoding may be an issue. I don't know any simple way to get at
> the outline path of "\PyX" rather than "PyX".
> ---
> gallery/misc/INDEX | 1 +
> gallery/misc/pyxpyx.py | 13 +++++++++++++
> 2 files changed, 14 insertions(+), 0 deletions(-)
> create mode 100644 gallery/misc/pyxpyx.py
>
> diff --git a/gallery/misc/INDEX b/gallery/misc/INDEX
> index ae05119..e3f07ec 100644
> --- a/gallery/misc/INDEX
> +++ b/gallery/misc/INDEX
> @@ -1,4 +1,5 @@
> pattern
> +pyxpyx
> vector
> connect
> box
> diff --git a/gallery/misc/pyxpyx.py b/gallery/misc/pyxpyx.py
> new file mode 100644
> index 0000000..3641eb7
> --- /dev/null
> +++ b/gallery/misc/pyxpyx.py
> @@ -0,0 +1,13 @@
> +from pyx import *
> +from pyx.dvi.mapfile import MAPline
> +
> +f = MAPline('cmb10 CMB10 <cmb10.pfb').getfont()
> +
> +c = canvas.canvas()
> +tpath = f.text(0, 0, "PyX", 300).textpath().reversed()
> +t = r"\PyX is fun. "
> +n = int(tpath.arclen() / text.text(0, 0, t).width)
> +c.draw(tpath, [deco.curvedtext(t*n)])
> +
> +c.writeEPSfile("pyxpyx")
> +c.writePDFfile("pyxpyx")
> --
> 1.7.7.338.g0156b
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> PyX-devel mailing list
> PyX...@li...
> https://lists.sourceforge.net/lists/listinfo/pyx-devel
--
by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
|
|
From: Michael J G. <mic...@us...> - 2011-10-12 20:06:05
|
André Wobst venit, vidit, dixit 12.10.2011 14:35:
> Hi, Michael,
>
> Am 12.10.2011 um 09:18 schrieb Michael J Gruber:
>>> Anyway, could you try whether changeset 3229 ("pop from the end of
>>> t1stack in gathercalls") fixes the issue. Thanks!
>>
>> Yes, version 30815 fixes it ;)
>
> Great, thanks for testing!
>
>>> (By the way we obviously have different version of cmr10 etc. ...)
>>
>> How is this obvious? (OK, I guess you did test 3227/3228...) Shouldn't
>> they be mostly the same? My pfb's are the bluesky T1, as distributed by
>> the AMS, and included in Fedora 15. Font metrics from texlive 2007 as
>> included in Fedora 15 (old, I know; Fedora+texlive=long story).
>
>
> Well, it is not obvious at first, but it is obvious for me after spending some time last night to get the texttopath feature back to work on my system. It turns out that the cmr10.pfb has been updated lately (and you need an implementation of the flex machinery realized by othersubr 0 to 2 to properly render the path – the details can be found in the T1 spec). Anyway, here is the cmr10.pfb from my system (I'm using TeXLive 2011):
>
> andre@mbp:~$ t1disasm $(kpsewhich cmr10.pfb)|head
> %!PS-AdobeFont-1.0: CMR10 003.002
> %%Title: CMR10
> %Version: 003.002
> %%CreationDate: Mon Jul 13 16:17:00 2009
> %%Creator: David M. Jones
> %Copyright: Copyright (c) 1997, 2009 American Mathematical Society
> %Copyright: (<http://www.ams.org>), with Reserved Font Name CMR10.
> % This Font Software is licensed under the SIL Open Font License, Version 1.1.
> % This license is in the accompanying file OFL.txt, and is also
> % available with a FAQ at: http://scripts.sil.org/OFL.
>
> I'm pretty sure you get something this on your system:
>
> %!PS-AdobeFont-1.1: CMR10 1.00B
> %%CreationDate: 1992 Feb 19 19:54:52
> % Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
> ...
Exactly.
>
> Internally the fonts are quite different. Also the file size has changed: the old versions was 26882 bytes in size while the new one has 35752 bytes.
>
Oh my dear, I'm glad you switched to TL11 before I did. I would have
been clueless.
Cheers,
Michael
|
|
From: André W. <wo...@us...> - 2011-10-12 12:35:56
|
Hi, Michael,
Am 12.10.2011 um 09:18 schrieb Michael J Gruber:
>> Anyway, could you try whether changeset 3229 ("pop from the end of
>> t1stack in gathercalls") fixes the issue. Thanks!
>
> Yes, version 30815 fixes it ;)
Great, thanks for testing!
>> (By the way we obviously have different version of cmr10 etc. ...)
>
> How is this obvious? (OK, I guess you did test 3227/3228...) Shouldn't
> they be mostly the same? My pfb's are the bluesky T1, as distributed by
> the AMS, and included in Fedora 15. Font metrics from texlive 2007 as
> included in Fedora 15 (old, I know; Fedora+texlive=long story).
Well, it is not obvious at first, but it is obvious for me after spending some time last night to get the texttopath feature back to work on my system. It turns out that the cmr10.pfb has been updated lately (and you need an implementation of the flex machinery realized by othersubr 0 to 2 to properly render the path – the details can be found in the T1 spec). Anyway, here is the cmr10.pfb from my system (I'm using TeXLive 2011):
andre@mbp:~$ t1disasm $(kpsewhich cmr10.pfb)|head
%!PS-AdobeFont-1.0: CMR10 003.002
%%Title: CMR10
%Version: 003.002
%%CreationDate: Mon Jul 13 16:17:00 2009
%%Creator: David M. Jones
%Copyright: Copyright (c) 1997, 2009 American Mathematical Society
%Copyright: (<http://www.ams.org>), with Reserved Font Name CMR10.
% This Font Software is licensed under the SIL Open Font License, Version 1.1.
% This license is in the accompanying file OFL.txt, and is also
% available with a FAQ at: http://scripts.sil.org/OFL.
I'm pretty sure you get something this on your system:
%!PS-AdobeFont-1.1: CMR10 1.00B
%%CreationDate: 1992 Feb 19 19:54:52
% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
...
Internally the fonts are quite different. Also the file size has changed: the old versions was 26882 bytes in size while the new one has 35752 bytes.
Best,
André
--
by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
|
|
From: Michael J G. <mic...@us...> - 2011-10-12 07:18:34
|
André Wobst venit, vidit, dixit 12.10.2011 09:09:
> Hi Michael,
>
> I'm curious about the changeset numbering. The flex patch is
> changeset 3227 here.
>
> Anyway, could you try whether changeset 3229 ("pop from the end of
> t1stack in gathercalls") fixes the issue. Thanks!
Yes, version 30815 fixes it ;)
Sorry for the wrong numbers. Not being able to count is one thing, not
being able to copy&paste is a different matter...
> (By the way we obviously have different version of cmr10 etc. ...)
How is this obvious? (OK, I guess you did test 3227/3228...) Shouldn't
they be mostly the same? My pfb's are the bluesky T1, as distributed by
the AMS, and included in Fedora 15. Font metrics from texlive 2007 as
included in Fedora 15 (old, I know; Fedora+texlive=long story).
Michael
|
|
From: André W. <wo...@us...> - 2011-10-12 07:10:22
|
Hi Michael,
I'm curious about the changeset numbering. The flex patch is changeset 3227 here.
Anyway, could you try whether changeset 3229 ("pop from the end of t1stack in gathercalls") fixes the issue. Thanks!
(By the way we obviously have different version of cmr10 etc. ...)
André
Am 12.10.2011 um 08:38 schrieb Michael J Gruber:
> I dunno why, but after r3224, several characters are missing from the
> output of the textalongpath example as of r3225:
> s,u,r are not drawn, instead there is a space for each.
>
> If I apply r3225 on top of r3223 (without the flex patch) everything is
> fine.
>
> Michael
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> PyX-devel mailing list
> PyX...@li...
> https://lists.sourceforge.net/lists/listinfo/pyx-devel
--
by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
|
|
From: Michael J G. <mic...@us...> - 2011-10-12 06:38:30
|
I dunno why, but after r3224, several characters are missing from the output of the textalongpath example as of r3225: s,u,r are not drawn, instead there is a space for each. If I apply r3225 on top of r3223 (without the flex patch) everything is fine. Michael |
|
From: Michael J G. <mic...@us...> - 2011-10-11 09:12:55
|
---
Here's one for the gallery ;)
There may be better ways to get at a text font using the file locator,
but then the encoding may be an issue. I don't know any simple way to get at
the outline path of "\PyX" rather than "PyX".
---
gallery/misc/INDEX | 1 +
gallery/misc/pyxpyx.py | 13 +++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
create mode 100644 gallery/misc/pyxpyx.py
diff --git a/gallery/misc/INDEX b/gallery/misc/INDEX
index ae05119..e3f07ec 100644
--- a/gallery/misc/INDEX
+++ b/gallery/misc/INDEX
@@ -1,4 +1,5 @@
pattern
+pyxpyx
vector
connect
box
diff --git a/gallery/misc/pyxpyx.py b/gallery/misc/pyxpyx.py
new file mode 100644
index 0000000..3641eb7
--- /dev/null
+++ b/gallery/misc/pyxpyx.py
@@ -0,0 +1,13 @@
+from pyx import *
+from pyx.dvi.mapfile import MAPline
+
+f = MAPline('cmb10 CMB10 <cmb10.pfb').getfont()
+
+c = canvas.canvas()
+tpath = f.text(0, 0, "PyX", 300).textpath().reversed()
+t = r"\PyX is fun. "
+n = int(tpath.arclen() / text.text(0, 0, t).width)
+c.draw(tpath, [deco.curvedtext(t*n)])
+
+c.writeEPSfile("pyxpyx")
+c.writePDFfile("pyxpyx")
--
1.7.7.338.g0156b
|
|
From: André W. <wo...@us...> - 2011-10-11 07:40:20
|
Hi Michael, Am 11.10.2011 um 09:13 schrieb Michael J Gruber: > Nice, "exclude" looks simple and useful. yeah, when we added this feature to the decorated path this use case was on our mind all the time. It's great to finally make it happen. :-) André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |
|
From: Joerg L. <jo...@us...> - 2011-10-11 07:18:56
|
Hi Michael,
On 11.10.11, Michael J Gruber wrote:
> André Wobst venit, vidit, dixit 11.10.2011 00:03:
[...]
> > Anyway, thanks a lot for your effort to finally bring this
> > functionality to PyX. I'm pretty sure users will love it ... :-)
Very nice, indeed! Thanks a lot for bringing this into a usable form!
Cheers,
Jörg
|
|
From: Michael J G. <mic...@us...> - 2011-10-11 07:13:09
|
André Wobst venit, vidit, dixit 11.10.2011 00:03: > Dear Michael, > > your patch still had the problem, that singlecharmode was a global > setting to the dvi file which is wrong. (You could easily break your > code by rendering some text without singlecharmode being active and > then activating the singlecharmode on the *same* texrunner > instance.) > > Furthermore we properly have to copy all canvas item instance in the > correct order. (You need that, when you change the color of the text > for some characters in TeX/LaTeX (i.e. special commands).) Thanks for the fix and finishing touches. It's good to have someone with the full overview of the codebase spot these things. > I also added an exclude feature to the decorator, changed some > defaults and did some quite different examples. It is all submitted > now, please see changeset 3225. Nice, "exclude" looks simple and useful. > Anyway, thanks a lot for your effort to finally bring this > functionality to PyX. I'm pretty sure users will love it ... :-) Should give good PR and the means to PyXify some logos! Cheers, Michael |
|
From: André W. <wo...@us...> - 2011-10-10 22:04:36
|
Dear Michael,
your patch still had the problem, that singlecharmode was a global setting to the dvi file which is wrong. (You could easily break your code by rendering some text without singlecharmode being active and then activating the singlecharmode on the *same* texrunner instance.)
Furthermore we properly have to copy all canvas item instance in the correct order. (You need that, when you change the color of the text for some characters in TeX/LaTeX (i.e. special commands).)
I also added an exclude feature to the decorator, changed some defaults and did some quite different examples. It is all submitted now, please see changeset 3225.
Anyway, thanks a lot for your effort to finally bring this functionality to PyX. I'm pretty sure users will love it ... :-)
Best,
André
Am 09.10.2011 um 17:25 schrieb Michael J Gruber:
> Implement a decorator curvedtext for setting text along a given path.
> curvedtext switches to singlecharmode, but only while it is needed.
>
> The basic idea has been discussed on the list and goes back to the PyX
> grand masters.
>
> Signed-off-by: Michael J Gruber <mic...@us...>
> ---
> v2 has singlecharmode as a parameter to text() rather than the texrunner.
> The drawback is that ensuredvicanvas() and finishdvi() need that parameter
> also, or else the last few characters come out wrong.
> ---
> examples/text/INDEX | 1 +
> examples/text/textalongpath.py | 15 ++++++++++
> examples/text/textalongpath.txt | 5 +++
> pyx/deco.py | 56 +++++++++++++++++++++++++++++++++++++++
> pyx/dvi/dvifile.py | 5 ++-
> pyx/text.py | 12 ++++----
> 6 files changed, 86 insertions(+), 8 deletions(-)
> create mode 100644 examples/text/textalongpath.py
> create mode 100644 examples/text/textalongpath.txt
>
> diff --git a/examples/text/INDEX b/examples/text/INDEX
> index 04692ae..c982f89 100644
> --- a/examples/text/INDEX
> +++ b/examples/text/INDEX
> @@ -5,3 +5,4 @@ marker
> color
> texrunner
> textbox
> +textalongpath
> diff --git a/examples/text/textalongpath.py b/examples/text/textalongpath.py
> new file mode 100644
> index 0000000..f4aad4e
> --- /dev/null
> +++ b/examples/text/textalongpath.py
> @@ -0,0 +1,15 @@
> +from pyx import *
> +
> +c = canvas.canvas()
> +
> +R = 1.3
> +p = path.path(path.arc(0,0, R, 0,270)) + path.line(0,-R, R,-R)
> +label = (r"\PyX{} is fun. " * 4)[:-1] # chop off last space
> +
> +c.draw(p, [deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
> +c.draw(p, [trafo.translate(2.5*R,0), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
> +c.draw(p.reversed(), [trafo.translate(0, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
> +c.draw(p.reversed(), [trafo.translate(2.5*R, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
> +
> +c.writeEPSfile("textalongpath")
> +c.writePDFfile("textalongpath")
> diff --git a/examples/text/textalongpath.txt b/examples/text/textalongpath.txt
> new file mode 100644
> index 0000000..1737993
> --- /dev/null
> +++ b/examples/text/textalongpath.txt
> @@ -0,0 +1,5 @@
> +Text along path
> +
> +! In order to set text along a given path, you can use the `curvedtext()`
> +decorator. The examples show how you can position the text relative to the
> +path.
> diff --git a/pyx/deco.py b/pyx/deco.py
> index 656845f..ceb6712 100644
> --- a/pyx/deco.py
> +++ b/pyx/deco.py
> @@ -564,6 +564,62 @@ class text(deco, attr.attr):
> t.linealign(self.textdist, math.cos(angle), math.sin(angle))
> dp.ornaments.insert(t)
>
> +class curvedtext(deco, attr.attr):
> + """a text decorator for curved text
> +
> + - text: is typeset along the path to which this decorator is applied
> + - relarclenpos: position for the base point of the text (default: 0)
> + - arlenfrombegin, arclenfromend: alternative ways of specifying the position of the base point;
> + use of relarclenpos, arclenfrombegin and arclenfromend is mutually exclusive
> + - textattrs, texrunner: standard text arguments (defaults: [] resp None)
> +
> + """
> +
> + def __init__(self, text, textattrs=[],
> + relarclenpos=0, arclenfrombegin=None, arclenfromend=None,
> + texrunner=None):
> + if arclenfrombegin is not None and arclenfromend is not None:
> + raise ValueError("either set arclenfrombegin or arclenfromend")
> + self.text = text
> + self.textattrs = textattrs
> + self.relarclenpos = relarclenpos
> + self.arclenfrombegin = arclenfrombegin
> + self.arclenfromend = arclenfromend
> + self.texrunner = texrunner
> +
> + def decorate(self, dp, texrunner):
> + if self.texrunner:
> + texrunner = self.texrunner
> + import text as textmodule
> +
> + dp.ensurenormpath()
> + if self.arclenfrombegin is not None:
> + textpos = dp.path.begin() + self.arclenfrombegin
> + elif self.arclenfromend is not None:
> + textpos = dp.path.end() - self.arclenfromend
> + else:
> + # relarcpos is used if neither arcfrombegin nor arcfromend is given
> + textpos = self.relarclenpos * dp.path.arclen()
> +
> + c = canvas.canvas()
> +
> + t = texrunner.text(0, 0, self.text, self.textattrs, singlecharmode=1)
> +
> + # copy over attr ops (colour...)
> + # isinstance(op, canvas._canvas) should not occur before ensuredvicanvas; should we even care to check?
> + [ c.insert(op) for op in t.items if not isinstance(op, canvas._canvas)]
> +
> + t.ensuredvicanvas(singlecharmode=1)
> +
> + items = t.dvicanvas.items
> + xs = [item.bbox().center()[0] for item in items]
> + trafos = dp.path.trafo([textpos +x for x in xs])
> + for x, op, atrafo in zip(xs, items, trafos):
> + c.insert(op, [trafo.translate(-x, 0), atrafo]) # reversed trafos: fix for change in canvas.py from r2728 to 2730
> +
> + dp.ornaments.insert(c)
> +
> +
>
> class shownormpath(deco, attr.attr):
>
> diff --git a/pyx/dvi/dvifile.py b/pyx/dvi/dvifile.py
> index b1e8123..d65e952 100644
> --- a/pyx/dvi/dvifile.py
> +++ b/pyx/dvi/dvifile.py
> @@ -112,12 +112,13 @@ class _restoretrafo(canvasitem.canvasitem):
>
> class DVIfile:
>
> - def __init__(self, filename, debug=0, debugfile=sys.stdout):
> + def __init__(self, filename, debug=0, debugfile=sys.stdout, singlecharmode=0):
> """ opens the dvi file and reads the preamble """
> self.filename = filename
> self.debug = debug
> self.debugfile = debugfile
> self.debugstack = []
> + self.singlecharmode = singlecharmode
>
> self.fonts = {}
> self.activefont = None
> @@ -197,7 +198,7 @@ class DVIfile:
> self.activetext[2].append(char)
> self.pos[_POS_H] += dx
>
> - if not advancepos:
> + if (not advancepos) or self.singlecharmode:
> self.flushtext(fontmap)
>
> def usefont(self, fontnum, id1234, fontmap):
> diff --git a/pyx/text.py b/pyx/text.py
> index 242a4b9..b55667d 100644
> --- a/pyx/text.py
> +++ b/pyx/text.py
> @@ -700,9 +700,9 @@ class textbox(box.rect, canvas._canvas):
> raise RuntimeError("multiple call to setdvicanvas")
> self.dvicanvas = dvicanvas
>
> - def ensuredvicanvas(self):
> + def ensuredvicanvas(self, singlecharmode=0):
> if self.dvicanvas is None:
> - self.finishdvi()
> + self.finishdvi(singlecharmode=singlecharmode)
> assert self.dvicanvas is not None, "finishdvi is broken"
> if not self.insertdvicanvas:
> self.insert(self.dvicanvas, [self.texttrafo])
> @@ -1024,14 +1024,14 @@ class texrunner:
> else:
> raise TexResultError("TeX didn't respond as expected within the timeout period (%i seconds)." % self.waitfortex, self)
>
> - def finishdvi(self, ignoretail=0):
> + def finishdvi(self, ignoretail=0, singlecharmode=0):
> """finish TeX/LaTeX and read the dvifile
> - this method ensures that all textboxes can access their
> dvicanvas"""
> self.execute(None, self.defaulttexmessagesend + self.texmessagesend)
> dvifilename = "%s.dvi" % self.texfilename
> if not self.texipc:
> - self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug)
> + self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug, singlecharmode=singlecharmode)
> page = 1
> for box in self.needdvitextboxes:
> box.setdvicanvas(self.dvifile.readpage([ord("P"), ord("y"), ord("X"), page, 0, 0, 0, 0, 0, 0], fontmap=box.fontmap))
> @@ -1151,7 +1151,7 @@ class texrunner:
>
> PyXBoxPattern = re.compile(r"PyXBox:page=(?P<page>\d+),lt=(?P<lt>-?\d*((\d\.?)|(\.?\d))\d*)pt,rt=(?P<rt>-?\d*((\d\.?)|(\.?\d))\d*)pt,ht=(?P<ht>-?\d*((\d\.?)|(\.?\d))\d*)pt,dp=(?P<dp>-?\d*((\d\.?)|(\.?\d))\d*)pt:")
>
> - def text(self, x, y, expr, textattrs=[], texmessages=[], fontmap=None):
> + def text(self, x, y, expr, textattrs=[], texmessages=[], fontmap=None, singlecharmode=0):
> """create text by passing expr to TeX/LaTeX
> - returns a textbox containing the result from running expr thru TeX/LaTeX
> - the box center is set to x, y
> @@ -1190,7 +1190,7 @@ class texrunner:
> raise e
> if self.texipc:
> if first:
> - self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
> + self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=singlecharmode)
> match = self.PyXBoxPattern.search(self.texmessage)
> if not match or int(match.group("page")) != self.page:
> raise TexResultError("box extents not found", self)
> --
> 1.7.7.338.g0156b
>
--
by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
|
|
From: Michael J G. <mic...@us...> - 2011-10-09 15:26:02
|
Implement a decorator curvedtext for setting text along a given path.
curvedtext switches to singlecharmode, but only while it is needed.
The basic idea has been discussed on the list and goes back to the PyX
grand masters.
Signed-off-by: Michael J Gruber <mic...@us...>
---
v2 has singlecharmode as a parameter to text() rather than the texrunner.
The drawback is that ensuredvicanvas() and finishdvi() need that parameter
also, or else the last few characters come out wrong.
---
examples/text/INDEX | 1 +
examples/text/textalongpath.py | 15 ++++++++++
examples/text/textalongpath.txt | 5 +++
pyx/deco.py | 56 +++++++++++++++++++++++++++++++++++++++
pyx/dvi/dvifile.py | 5 ++-
pyx/text.py | 12 ++++----
6 files changed, 86 insertions(+), 8 deletions(-)
create mode 100644 examples/text/textalongpath.py
create mode 100644 examples/text/textalongpath.txt
diff --git a/examples/text/INDEX b/examples/text/INDEX
index 04692ae..c982f89 100644
--- a/examples/text/INDEX
+++ b/examples/text/INDEX
@@ -5,3 +5,4 @@ marker
color
texrunner
textbox
+textalongpath
diff --git a/examples/text/textalongpath.py b/examples/text/textalongpath.py
new file mode 100644
index 0000000..f4aad4e
--- /dev/null
+++ b/examples/text/textalongpath.py
@@ -0,0 +1,15 @@
+from pyx import *
+
+c = canvas.canvas()
+
+R = 1.3
+p = path.path(path.arc(0,0, R, 0,270)) + path.line(0,-R, R,-R)
+label = (r"\PyX{} is fun. " * 4)[:-1] # chop off last space
+
+c.draw(p, [deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
+c.draw(p, [trafo.translate(2.5*R,0), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
+c.draw(p.reversed(), [trafo.translate(0, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
+c.draw(p.reversed(), [trafo.translate(2.5*R, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
+
+c.writeEPSfile("textalongpath")
+c.writePDFfile("textalongpath")
diff --git a/examples/text/textalongpath.txt b/examples/text/textalongpath.txt
new file mode 100644
index 0000000..1737993
--- /dev/null
+++ b/examples/text/textalongpath.txt
@@ -0,0 +1,5 @@
+Text along path
+
+! In order to set text along a given path, you can use the `curvedtext()`
+decorator. The examples show how you can position the text relative to the
+path.
diff --git a/pyx/deco.py b/pyx/deco.py
index 656845f..ceb6712 100644
--- a/pyx/deco.py
+++ b/pyx/deco.py
@@ -564,6 +564,62 @@ class text(deco, attr.attr):
t.linealign(self.textdist, math.cos(angle), math.sin(angle))
dp.ornaments.insert(t)
+class curvedtext(deco, attr.attr):
+ """a text decorator for curved text
+
+ - text: is typeset along the path to which this decorator is applied
+ - relarclenpos: position for the base point of the text (default: 0)
+ - arlenfrombegin, arclenfromend: alternative ways of specifying the position of the base point;
+ use of relarclenpos, arclenfrombegin and arclenfromend is mutually exclusive
+ - textattrs, texrunner: standard text arguments (defaults: [] resp None)
+
+ """
+
+ def __init__(self, text, textattrs=[],
+ relarclenpos=0, arclenfrombegin=None, arclenfromend=None,
+ texrunner=None):
+ if arclenfrombegin is not None and arclenfromend is not None:
+ raise ValueError("either set arclenfrombegin or arclenfromend")
+ self.text = text
+ self.textattrs = textattrs
+ self.relarclenpos = relarclenpos
+ self.arclenfrombegin = arclenfrombegin
+ self.arclenfromend = arclenfromend
+ self.texrunner = texrunner
+
+ def decorate(self, dp, texrunner):
+ if self.texrunner:
+ texrunner = self.texrunner
+ import text as textmodule
+
+ dp.ensurenormpath()
+ if self.arclenfrombegin is not None:
+ textpos = dp.path.begin() + self.arclenfrombegin
+ elif self.arclenfromend is not None:
+ textpos = dp.path.end() - self.arclenfromend
+ else:
+ # relarcpos is used if neither arcfrombegin nor arcfromend is given
+ textpos = self.relarclenpos * dp.path.arclen()
+
+ c = canvas.canvas()
+
+ t = texrunner.text(0, 0, self.text, self.textattrs, singlecharmode=1)
+
+ # copy over attr ops (colour...)
+ # isinstance(op, canvas._canvas) should not occur before ensuredvicanvas; should we even care to check?
+ [ c.insert(op) for op in t.items if not isinstance(op, canvas._canvas)]
+
+ t.ensuredvicanvas(singlecharmode=1)
+
+ items = t.dvicanvas.items
+ xs = [item.bbox().center()[0] for item in items]
+ trafos = dp.path.trafo([textpos +x for x in xs])
+ for x, op, atrafo in zip(xs, items, trafos):
+ c.insert(op, [trafo.translate(-x, 0), atrafo]) # reversed trafos: fix for change in canvas.py from r2728 to 2730
+
+ dp.ornaments.insert(c)
+
+
class shownormpath(deco, attr.attr):
diff --git a/pyx/dvi/dvifile.py b/pyx/dvi/dvifile.py
index b1e8123..d65e952 100644
--- a/pyx/dvi/dvifile.py
+++ b/pyx/dvi/dvifile.py
@@ -112,12 +112,13 @@ class _restoretrafo(canvasitem.canvasitem):
class DVIfile:
- def __init__(self, filename, debug=0, debugfile=sys.stdout):
+ def __init__(self, filename, debug=0, debugfile=sys.stdout, singlecharmode=0):
""" opens the dvi file and reads the preamble """
self.filename = filename
self.debug = debug
self.debugfile = debugfile
self.debugstack = []
+ self.singlecharmode = singlecharmode
self.fonts = {}
self.activefont = None
@@ -197,7 +198,7 @@ class DVIfile:
self.activetext[2].append(char)
self.pos[_POS_H] += dx
- if not advancepos:
+ if (not advancepos) or self.singlecharmode:
self.flushtext(fontmap)
def usefont(self, fontnum, id1234, fontmap):
diff --git a/pyx/text.py b/pyx/text.py
index 242a4b9..b55667d 100644
--- a/pyx/text.py
+++ b/pyx/text.py
@@ -700,9 +700,9 @@ class textbox(box.rect, canvas._canvas):
raise RuntimeError("multiple call to setdvicanvas")
self.dvicanvas = dvicanvas
- def ensuredvicanvas(self):
+ def ensuredvicanvas(self, singlecharmode=0):
if self.dvicanvas is None:
- self.finishdvi()
+ self.finishdvi(singlecharmode=singlecharmode)
assert self.dvicanvas is not None, "finishdvi is broken"
if not self.insertdvicanvas:
self.insert(self.dvicanvas, [self.texttrafo])
@@ -1024,14 +1024,14 @@ class texrunner:
else:
raise TexResultError("TeX didn't respond as expected within the timeout period (%i seconds)." % self.waitfortex, self)
- def finishdvi(self, ignoretail=0):
+ def finishdvi(self, ignoretail=0, singlecharmode=0):
"""finish TeX/LaTeX and read the dvifile
- this method ensures that all textboxes can access their
dvicanvas"""
self.execute(None, self.defaulttexmessagesend + self.texmessagesend)
dvifilename = "%s.dvi" % self.texfilename
if not self.texipc:
- self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug)
+ self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug, singlecharmode=singlecharmode)
page = 1
for box in self.needdvitextboxes:
box.setdvicanvas(self.dvifile.readpage([ord("P"), ord("y"), ord("X"), page, 0, 0, 0, 0, 0, 0], fontmap=box.fontmap))
@@ -1151,7 +1151,7 @@ class texrunner:
PyXBoxPattern = re.compile(r"PyXBox:page=(?P<page>\d+),lt=(?P<lt>-?\d*((\d\.?)|(\.?\d))\d*)pt,rt=(?P<rt>-?\d*((\d\.?)|(\.?\d))\d*)pt,ht=(?P<ht>-?\d*((\d\.?)|(\.?\d))\d*)pt,dp=(?P<dp>-?\d*((\d\.?)|(\.?\d))\d*)pt:")
- def text(self, x, y, expr, textattrs=[], texmessages=[], fontmap=None):
+ def text(self, x, y, expr, textattrs=[], texmessages=[], fontmap=None, singlecharmode=0):
"""create text by passing expr to TeX/LaTeX
- returns a textbox containing the result from running expr thru TeX/LaTeX
- the box center is set to x, y
@@ -1190,7 +1190,7 @@ class texrunner:
raise e
if self.texipc:
if first:
- self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
+ self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=singlecharmode)
match = self.PyXBoxPattern.search(self.texmessage)
if not match or int(match.group("page")) != self.page:
raise TexResultError("box extents not found", self)
--
1.7.7.338.g0156b
|
|
From: André W. <wo...@us...> - 2011-10-07 21:06:57
|
Hi Michael,
thank you for your patch. Overall I like it very much. I didn't try it yet, just browsed it. In general I'm very happy to accept your patch. However I have one question which I would like to address first. Couldn't be the singlecharmode an option to the text method of the texrunner. Could it be passed to be applied to the single page on the dvifile being created/processed? I didn't try but my impression is that this could be possible. Maybe I don't see the real trouble ahead when trying to do so, but it might be possible without major problems. Could you comment on that?
André
Am 07.10.2011 um 18:14 schrieb Michael J Gruber:
> Implement a decorator curvedtext for setting text along a given path.
> curvedtext switches to singlecharmode, but only while it is needed.
>
> The basic idea has been discussed on the list and goes back to the PyX
> grand masters.
>
> Signed-off-by: Michael J Gruber <mic...@us...>
> ---
> examples/text/INDEX | 1 +
> examples/text/textalongpath.py | 15 ++++++++++
> examples/text/textalongpath.txt | 5 +++
> pyx/deco.py | 59 +++++++++++++++++++++++++++++++++++++++
> pyx/dvi/dvifile.py | 5 ++-
> pyx/text.py | 8 +++--
> 6 files changed, 88 insertions(+), 5 deletions(-)
> create mode 100644 examples/text/textalongpath.py
> create mode 100644 examples/text/textalongpath.txt
>
> diff --git a/examples/text/INDEX b/examples/text/INDEX
> index 04692ae..c982f89 100644
> --- a/examples/text/INDEX
> +++ b/examples/text/INDEX
> @@ -5,3 +5,4 @@ marker
> color
> texrunner
> textbox
> +textalongpath
> diff --git a/examples/text/textalongpath.py b/examples/text/textalongpath.py
> new file mode 100644
> index 0000000..c410aa4
> --- /dev/null
> +++ b/examples/text/textalongpath.py
> @@ -0,0 +1,15 @@
> +from pyx import *
> +
> +c = canvas.canvas()
> +
> +R = 1.3
> +p = path.path(path.arc(0,0, R, 0,270)) + path.line(0,-R, R,-R)
> +label = (r"\PyX{} is fun. " * 4)[:-1] # chop off last space
> +
> +c.draw(p, [deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
> +c.draw(p, [trafo.translate(2.5*R,0), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
> +c.draw(p.reversed(), [trafo.translate(0, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
> +c.draw(p.reversed(), [trafo.translate(2.5*R, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
> +
> +c.writeEPSfile("textalongpath")
> +c.writePDFfile("textalongpath")
> diff --git a/examples/text/textalongpath.txt b/examples/text/textalongpath.txt
> new file mode 100644
> index 0000000..1737993
> --- /dev/null
> +++ b/examples/text/textalongpath.txt
> @@ -0,0 +1,5 @@
> +Text along path
> +
> +! In order to set text along a given path, you can use the `curvedtext()`
> +decorator. The examples show how you can position the text relative to the
> +path.
> diff --git a/pyx/deco.py b/pyx/deco.py
> index 656845f..a6a3359 100644
> --- a/pyx/deco.py
> +++ b/pyx/deco.py
> @@ -564,6 +564,65 @@ class text(deco, attr.attr):
> t.linealign(self.textdist, math.cos(angle), math.sin(angle))
> dp.ornaments.insert(t)
>
> +class curvedtext(deco, attr.attr):
> + """a text decorator for curved text
> +
> + - text: is typeset along the path to which this decorator is applied
> + - relarclenpos: position for the base point of the text (default: 0)
> + - arlenfrombegin, arclenfromend: alternative ways of specifying the position of the base point;
> + use of relarclenpos, arclenfrombegin and arclenfromend is mutually exclusive
> + - textattrs, texrunner: standard text arguments (defaults: [] resp None)
> +
> + """
> +
> + def __init__(self, text, textattrs=[],
> + relarclenpos=0, arclenfrombegin=None, arclenfromend=None,
> + texrunner=None):
> + if arclenfrombegin is not None and arclenfromend is not None:
> + raise ValueError("either set arclenfrombegin or arclenfromend")
> + self.text = text
> + self.textattrs = textattrs
> + self.relarclenpos = relarclenpos
> + self.arclenfrombegin = arclenfrombegin
> + self.arclenfromend = arclenfromend
> + self.texrunner = texrunner
> +
> + def decorate(self, dp, texrunner):
> + if self.texrunner:
> + texrunner = self.texrunner
> + import text as textmodule
> +
> + dp.ensurenormpath()
> + if self.arclenfrombegin is not None:
> + textpos = dp.path.begin() + self.arclenfrombegin
> + elif self.arclenfromend is not None:
> + textpos = dp.path.end() - self.arclenfromend
> + else:
> + # relarcpos is used if neither arcfrombegin nor arcfromend is given
> + textpos = self.relarclenpos * dp.path.arclen()
> +
> + c = canvas.canvas()
> +
> + singlecharmode=texrunner.singlecharmode # usually 0
> + texrunner.singlecharmode=1
> + t = texrunner.text(0, 0, self.text, self.textattrs)
> +
> + # copy over attr ops (colour...)
> + # isinstance(op, canvas._canvas) should not occur before ensuredvicanvas; should we even care to check?
> + [ c.insert(op) for op in t.items if not isinstance(op, canvas._canvas)]
> +
> + t.ensuredvicanvas()
> + texrunner.singlecharmode=singlecharmode
> +
> + items = t.dvicanvas.items
> + xs = [item.bbox().center()[0] for item in items]
> + trafos = dp.path.trafo([textpos +x for x in xs])
> + for x, op, atrafo in zip(xs, items, trafos):
> + c.insert(op, [trafo.translate(-x, 0), atrafo]) # reversed trafos: fix for change in canvas.py from r2728 to 2730
> +
> + dp.ornaments.insert(c)
> +
> +
>
> class shownormpath(deco, attr.attr):
>
> diff --git a/pyx/dvi/dvifile.py b/pyx/dvi/dvifile.py
> index b1e8123..d65e952 100644
> --- a/pyx/dvi/dvifile.py
> +++ b/pyx/dvi/dvifile.py
> @@ -112,12 +112,13 @@ class _restoretrafo(canvasitem.canvasitem):
>
> class DVIfile:
>
> - def __init__(self, filename, debug=0, debugfile=sys.stdout):
> + def __init__(self, filename, debug=0, debugfile=sys.stdout, singlecharmode=0):
> """ opens the dvi file and reads the preamble """
> self.filename = filename
> self.debug = debug
> self.debugfile = debugfile
> self.debugstack = []
> + self.singlecharmode = singlecharmode
>
> self.fonts = {}
> self.activefont = None
> @@ -197,7 +198,7 @@ class DVIfile:
> self.activetext[2].append(char)
> self.pos[_POS_H] += dx
>
> - if not advancepos:
> + if (not advancepos) or self.singlecharmode:
> self.flushtext(fontmap)
>
> def usefont(self, fontnum, id1234, fontmap):
> diff --git a/pyx/text.py b/pyx/text.py
> index 242a4b9..a7e94ac 100644
> --- a/pyx/text.py
> +++ b/pyx/text.py
> @@ -791,6 +791,7 @@ class texrunner:
> waitfortex=config.getint("text", "waitfortex", 60),
> showwaitfortex=config.getint("text", "showwaitfortex", 5),
> texipc=config.getboolean("text", "texipc", 0),
> + singlecharmode=0,
> texdebug=None,
> dvidebug=0,
> errordebug=1,
> @@ -812,6 +813,7 @@ class texrunner:
> self.waitfortex = waitfortex
> self.showwaitfortex = showwaitfortex
> self.texipc = texipc
> + self.singlecharmode = singlecharmode
> if texdebug is not None:
> if texdebug[-4:] == ".tex":
> self.texdebug = open(texdebug, "w")
> @@ -1031,7 +1033,7 @@ class texrunner:
> self.execute(None, self.defaulttexmessagesend + self.texmessagesend)
> dvifilename = "%s.dvi" % self.texfilename
> if not self.texipc:
> - self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug)
> + self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
> page = 1
> for box in self.needdvitextboxes:
> box.setdvicanvas(self.dvifile.readpage([ord("P"), ord("y"), ord("X"), page, 0, 0, 0, 0, 0, 0], fontmap=box.fontmap))
> @@ -1190,7 +1192,7 @@ class texrunner:
> raise e
> if self.texipc:
> if first:
> - self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
> + self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
> match = self.PyXBoxPattern.search(self.texmessage)
> if not match or int(match.group("page")) != self.page:
> raise TexResultError("box extents not found", self)
> @@ -1252,7 +1254,7 @@ class texrunner:
> "\\vfill\\supereject%%\n" % text, [texmessage.ignore])
> if self.texipc:
> if self.dvifile is None:
> - self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
> + self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
> else:
> raise RuntimeError("textboxes currently needs texipc")
> lastparnos = parnos
> --
> 1.7.7.602.g8c3f8
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> PyX-devel mailing list
> PyX...@li...
> https://lists.sourceforge.net/lists/listinfo/pyx-devel
--
by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
/ \ \ / ) wo...@us..., http://www.wobsta.de/
/ _ \ \/\/ / PyX - High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
|
|
From: Michael J G. <mic...@us...> - 2011-10-07 16:14:52
|
Implement a decorator curvedtext for setting text along a given path.
curvedtext switches to singlecharmode, but only while it is needed.
The basic idea has been discussed on the list and goes back to the PyX
grand masters.
Signed-off-by: Michael J Gruber <mic...@us...>
---
examples/text/INDEX | 1 +
examples/text/textalongpath.py | 15 ++++++++++
examples/text/textalongpath.txt | 5 +++
pyx/deco.py | 59 +++++++++++++++++++++++++++++++++++++++
pyx/dvi/dvifile.py | 5 ++-
pyx/text.py | 8 +++--
6 files changed, 88 insertions(+), 5 deletions(-)
create mode 100644 examples/text/textalongpath.py
create mode 100644 examples/text/textalongpath.txt
diff --git a/examples/text/INDEX b/examples/text/INDEX
index 04692ae..c982f89 100644
--- a/examples/text/INDEX
+++ b/examples/text/INDEX
@@ -5,3 +5,4 @@ marker
color
texrunner
textbox
+textalongpath
diff --git a/examples/text/textalongpath.py b/examples/text/textalongpath.py
new file mode 100644
index 0000000..c410aa4
--- /dev/null
+++ b/examples/text/textalongpath.py
@@ -0,0 +1,15 @@
+from pyx import *
+
+c = canvas.canvas()
+
+R = 1.3
+p = path.path(path.arc(0,0, R, 0,270)) + path.line(0,-R, R,-R)
+label = (r"\PyX{} is fun. " * 4)[:-1] # chop off last space
+
+c.draw(p, [deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
+c.draw(p, [trafo.translate(2.5*R,0), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
+c.draw(p.reversed(), [trafo.translate(0, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label,textattrs=[text.halign.right],relarclenpos=1)])
+c.draw(p.reversed(), [trafo.translate(2.5*R, -2.5*R), deco.stroked([color.rgb.blue]), deco.curvedtext(label)])
+
+c.writeEPSfile("textalongpath")
+c.writePDFfile("textalongpath")
diff --git a/examples/text/textalongpath.txt b/examples/text/textalongpath.txt
new file mode 100644
index 0000000..1737993
--- /dev/null
+++ b/examples/text/textalongpath.txt
@@ -0,0 +1,5 @@
+Text along path
+
+! In order to set text along a given path, you can use the `curvedtext()`
+decorator. The examples show how you can position the text relative to the
+path.
diff --git a/pyx/deco.py b/pyx/deco.py
index 656845f..a6a3359 100644
--- a/pyx/deco.py
+++ b/pyx/deco.py
@@ -564,6 +564,65 @@ class text(deco, attr.attr):
t.linealign(self.textdist, math.cos(angle), math.sin(angle))
dp.ornaments.insert(t)
+class curvedtext(deco, attr.attr):
+ """a text decorator for curved text
+
+ - text: is typeset along the path to which this decorator is applied
+ - relarclenpos: position for the base point of the text (default: 0)
+ - arlenfrombegin, arclenfromend: alternative ways of specifying the position of the base point;
+ use of relarclenpos, arclenfrombegin and arclenfromend is mutually exclusive
+ - textattrs, texrunner: standard text arguments (defaults: [] resp None)
+
+ """
+
+ def __init__(self, text, textattrs=[],
+ relarclenpos=0, arclenfrombegin=None, arclenfromend=None,
+ texrunner=None):
+ if arclenfrombegin is not None and arclenfromend is not None:
+ raise ValueError("either set arclenfrombegin or arclenfromend")
+ self.text = text
+ self.textattrs = textattrs
+ self.relarclenpos = relarclenpos
+ self.arclenfrombegin = arclenfrombegin
+ self.arclenfromend = arclenfromend
+ self.texrunner = texrunner
+
+ def decorate(self, dp, texrunner):
+ if self.texrunner:
+ texrunner = self.texrunner
+ import text as textmodule
+
+ dp.ensurenormpath()
+ if self.arclenfrombegin is not None:
+ textpos = dp.path.begin() + self.arclenfrombegin
+ elif self.arclenfromend is not None:
+ textpos = dp.path.end() - self.arclenfromend
+ else:
+ # relarcpos is used if neither arcfrombegin nor arcfromend is given
+ textpos = self.relarclenpos * dp.path.arclen()
+
+ c = canvas.canvas()
+
+ singlecharmode=texrunner.singlecharmode # usually 0
+ texrunner.singlecharmode=1
+ t = texrunner.text(0, 0, self.text, self.textattrs)
+
+ # copy over attr ops (colour...)
+ # isinstance(op, canvas._canvas) should not occur before ensuredvicanvas; should we even care to check?
+ [ c.insert(op) for op in t.items if not isinstance(op, canvas._canvas)]
+
+ t.ensuredvicanvas()
+ texrunner.singlecharmode=singlecharmode
+
+ items = t.dvicanvas.items
+ xs = [item.bbox().center()[0] for item in items]
+ trafos = dp.path.trafo([textpos +x for x in xs])
+ for x, op, atrafo in zip(xs, items, trafos):
+ c.insert(op, [trafo.translate(-x, 0), atrafo]) # reversed trafos: fix for change in canvas.py from r2728 to 2730
+
+ dp.ornaments.insert(c)
+
+
class shownormpath(deco, attr.attr):
diff --git a/pyx/dvi/dvifile.py b/pyx/dvi/dvifile.py
index b1e8123..d65e952 100644
--- a/pyx/dvi/dvifile.py
+++ b/pyx/dvi/dvifile.py
@@ -112,12 +112,13 @@ class _restoretrafo(canvasitem.canvasitem):
class DVIfile:
- def __init__(self, filename, debug=0, debugfile=sys.stdout):
+ def __init__(self, filename, debug=0, debugfile=sys.stdout, singlecharmode=0):
""" opens the dvi file and reads the preamble """
self.filename = filename
self.debug = debug
self.debugfile = debugfile
self.debugstack = []
+ self.singlecharmode = singlecharmode
self.fonts = {}
self.activefont = None
@@ -197,7 +198,7 @@ class DVIfile:
self.activetext[2].append(char)
self.pos[_POS_H] += dx
- if not advancepos:
+ if (not advancepos) or self.singlecharmode:
self.flushtext(fontmap)
def usefont(self, fontnum, id1234, fontmap):
diff --git a/pyx/text.py b/pyx/text.py
index 242a4b9..a7e94ac 100644
--- a/pyx/text.py
+++ b/pyx/text.py
@@ -791,6 +791,7 @@ class texrunner:
waitfortex=config.getint("text", "waitfortex", 60),
showwaitfortex=config.getint("text", "showwaitfortex", 5),
texipc=config.getboolean("text", "texipc", 0),
+ singlecharmode=0,
texdebug=None,
dvidebug=0,
errordebug=1,
@@ -812,6 +813,7 @@ class texrunner:
self.waitfortex = waitfortex
self.showwaitfortex = showwaitfortex
self.texipc = texipc
+ self.singlecharmode = singlecharmode
if texdebug is not None:
if texdebug[-4:] == ".tex":
self.texdebug = open(texdebug, "w")
@@ -1031,7 +1033,7 @@ class texrunner:
self.execute(None, self.defaulttexmessagesend + self.texmessagesend)
dvifilename = "%s.dvi" % self.texfilename
if not self.texipc:
- self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug)
+ self.dvifile = dvifile.DVIfile(dvifilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
page = 1
for box in self.needdvitextboxes:
box.setdvicanvas(self.dvifile.readpage([ord("P"), ord("y"), ord("X"), page, 0, 0, 0, 0, 0, 0], fontmap=box.fontmap))
@@ -1190,7 +1192,7 @@ class texrunner:
raise e
if self.texipc:
if first:
- self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
+ self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
match = self.PyXBoxPattern.search(self.texmessage)
if not match or int(match.group("page")) != self.page:
raise TexResultError("box extents not found", self)
@@ -1252,7 +1254,7 @@ class texrunner:
"\\vfill\\supereject%%\n" % text, [texmessage.ignore])
if self.texipc:
if self.dvifile is None:
- self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug)
+ self.dvifile = dvifile.DVIfile("%s.dvi" % self.texfilename, debug=self.dvidebug, singlecharmode=self.singlecharmode)
else:
raise RuntimeError("textboxes currently needs texipc")
lastparnos = parnos
--
1.7.7.602.g8c3f8
|
|
From: André W. <wo...@us...> - 2011-07-25 20:38:34
|
Hi, I'm sorry for being late in the discussion. Am 22.07.2011 um 14:09 schrieb Michael J Gruber: > hiresbbox=0 is the default, unchanged behaviour. > hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox) > is used rather than the normal one (BoundingBox). First of all thank you for your patch. We should certainly use the HiResBoundingBox. I agree to other comments in the thread to change the default to use the HiResBB (if available). While this is an incompatible change, it is for the better. PyX development allows for incompatible changes. While the graphical defect might need to be fixed for certain use-cases, I suggest to make this exceptional by a deprecation warning (just add a warnings.warn(...)). Furthermore I suggest to rename the parameter to "ignore_hiresbbox" and set it to False. While this is more verbose, it is a better description of what the parameter does. To summarize my point of view: We don't have a lowresbbox paramter and we don't need to add it. As a side remark: PyX requires Python 2.3 now and we can use True and False. While we did not yet fix all the old code in this respect, we should use it for new code from the very beginning. Any comment regarding the addition of the second part of the patch, the epsfile.epsfile example? Fine for me, even as an example, not just an gallery entry. However, I wonder whether we should demonstrate "ignore_hiresbbox". It could be a double dangerous bend signed paragraph, but we don't need to show it. This example will also display the bitmap based display of the embedded epsfile in the pdf output, which could (and should) be discussed by a double dangerous bend signed paragraph. It is fine to demonstrate this problem, as we need to work on a pdffile.pdffile functionality too (and it slightly increases the pressure). But for PDF there will never be a lowresbbox feature so the same functionality for epsfile should be an exception and to my mind even a deprecated feature. Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |
|
From: Michael S. <m-s...@us...> - 2011-07-22 13:52:30
|
Salut, On 22/07/11, Michael J Gruber wrote: > Joerg Lehmann venit, vidit, dixit 22.07.2011 15:24: > > On 22.07.11, Michael J Gruber wrote: > >> hiresbbox=0 is the default, unchanged behaviour. > >> hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox) > >> is used rather than the normal one (BoundingBox). > > > > Thanks! I wonder whether one should not do this automatically, i.e., if there > > is a HiResBoundingBox present, use that one instead of BoundingBox. +1 for defaulting to HiRes, with fallback to ordinary BB if HiRes not present. In my opinion, the ordinary BB is the default only for historical reasons. BTW: If I compare inclusion of eps and pdf in latex/pdflatex, then eps defaults to BB, and in pdf there is only a HiResBB. This made me use always the HiResBB, also if I include eps in latex. > Well, that would change existing behaviour, which would mean a no-go in > another project I'm working with. That attitude somewhat stuck to me ;) > > Note that with my implementation, hirebbox=1 even errors out when there > is no hires bbox. This is intentional (user asks for it but there is > none), but I don't mind changing it. Cordialement, Michael |
|
From: Joerg L. <jo...@us...> - 2011-07-22 13:47:42
|
On 22.07.11, Michael J Gruber wrote:
> Joerg Lehmann venit, vidit, dixit 22.07.2011 15:24:
> > On 22.07.11, Michael J Gruber wrote:
> >> hiresbbox=0 is the default, unchanged behaviour.
> >> hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox)
> >> is used rather than the normal one (BoundingBox).
> >
> > Thanks! I wonder whether one should not do this automatically, i.e., if there
> > is a HiResBoundingBox present, use that one instead of BoundingBox.
>
> Well, that would change existing behaviour, which would mean a no-go in
> another project I'm working with. That attitude somewhat stuck to me ;)
PyX is still officially in its alpha state. The only problem I can see
is that it changes existing behaviour without notifying the user. But
since in my opinion, the current behaviour of PyX is just not fully in
accordance with the standard, I would live with such a change.
> Note that with my implementation, hirebbox=1 even errors out when there
> is no hires bbox. This is intentional (user asks for it but there is
> none), but I don't mind changing it.
Yep, that would need to change, of course.
What do the others think?
Jörg
|
|
From: Michael J G. <mic...@us...> - 2011-07-22 13:40:12
|
Joerg Lehmann venit, vidit, dixit 22.07.2011 15:24: > Hi Michael, > > On 22.07.11, Michael J Gruber wrote: >> hiresbbox=0 is the default, unchanged behaviour. >> hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox) >> is used rather than the normal one (BoundingBox). > > Thanks! I wonder whether one should not do this automatically, i.e., if there > is a HiResBoundingBox present, use that one instead of BoundingBox. Well, that would change existing behaviour, which would mean a no-go in another project I'm working with. That attitude somewhat stuck to me ;) Note that with my implementation, hirebbox=1 even errors out when there is no hires bbox. This is intentional (user asks for it but there is none), but I don't mind changing it. Michael |
|
From: Joerg L. <jo...@us...> - 2011-07-22 13:24:40
|
Hi Michael,
On 22.07.11, Michael J Gruber wrote:
> hiresbbox=0 is the default, unchanged behaviour.
> hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox)
> is used rather than the normal one (BoundingBox).
Thanks! I wonder whether one should not do this automatically, i.e., if there
is a HiResBoundingBox present, use that one instead of BoundingBox.
Cheers,
Jörg
|
|
From: Michael J G. <mic...@us...> - 2011-07-22 12:26:20
|
The widespread use of \newline (in the incarnation \\) for enforcing linebreaks causes many problems with the alignment of parboxes. \linebreak is the correct way to force a line break without destroying alignment. --- examples/text/halign.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/examples/text/halign.txt b/examples/text/halign.txt index a9d15e3..b1453d0 100644 --- a/examples/text/halign.txt +++ b/examples/text/halign.txt @@ -23,3 +23,7 @@ well, when you do not create a parbox. !! Note that the alignment features are implemented in such a way, that they work in both, TeX and LaTeX mode. Furthermore, you can always influence the alignment of the box contents by appropriate TeX and LaTeX commands as well. + +!! If you want to enforce line breaks in a parbox use `\linebreak`, not `\newline` (which +is equivalent to `\\`). `\linebreak` makes sure that horizontal alignment is preserved +throughout the text box. -- 1.7.6.336.gdf067 |
|
From: Michael J G. <mic...@us...> - 2011-07-22 12:11:46
|
--- www/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/www/Makefile b/www/Makefile index 2f8eb15..eb18fb0 100644 --- a/www/Makefile +++ b/www/Makefile @@ -22,7 +22,7 @@ copy: mkdir -p build cp main.css build cp *.png *.ico build - cp png/*.png ../manual/_build/latex/manual.pdf ../faq/pyxfaq.pdf build + cp png/*.png ../manual/_build/latex/manual.pdf ../faq/_build/latex/pyxfaq.pdf build cp -r ../manual/_build/html build/manual cp -r ../manual/_build/html/manual.html build/manual/index.html for s in examples gallery; \ -- 1.7.6.336.gdf067 |
|
From: Michael J G. <mic...@us...> - 2011-07-22 12:09:47
|
hiresbbox=0 is the default, unchanged behaviour.
hiresbbox=1 means that the high resolution bounding box (HiResBoundingBox)
is used rather than the normal one (BoundingBox).
---
manual/epsfile.rst | 3 +++
pyx/epsfile.py | 23 +++++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/manual/epsfile.rst b/manual/epsfile.rst
index 7becc79..8badb08 100644
--- a/manual/epsfile.rst
+++ b/manual/epsfile.rst
@@ -59,6 +59,9 @@ are summarized in the following table:
+---------------------+-----------------------------------------------+
| ``kpsearch=0`` | Search for file using the kpathsea library. |
+---------------------+-----------------------------------------------+
+| ``hiresbbox=0`` | Use the high resolution bounding box rather |
+| | than the normal one. |
++---------------------+-----------------------------------------------+
.. _epsfile:
diff --git a/pyx/epsfile.py b/pyx/epsfile.py
index 59d291b..d04e07b 100644
--- a/pyx/epsfile.py
+++ b/pyx/epsfile.py
@@ -137,7 +137,7 @@ class linefilereader:
self.file.close()
-def _readbbox(file):
+def _readbbox(file, hiresbbox=0):
"""returns bounding box of EPS file filename"""
file = linefilereader(file)
@@ -146,20 +146,26 @@ def _readbbox(file):
if not file.readline().startswith("%!"):
raise IOError("file doesn't start with a '%!' header comment")
+ if hiresbbox:
+ bboxmatch = "%%HiResBoundingBox:"
+ bboxtype = float
+ else:
+ bboxmatch = "%%BoundingBox:"
+ bboxtype = int
bboxatend = 0
# parse the header (use the first BoundingBox)
while 1:
line = file.readline()
if not line:
break
- if line.startswith("%%BoundingBox:") and not bboxatend:
+ if line.startswith(bboxmatch) and not bboxatend:
values = line.split(":", 1)[1].split()
if values == ["(atend)"]:
bboxatend = 1
else:
if len(values) != 4:
raise IOError("invalid number of bounding box values")
- return bbox.bbox_pt(*map(int, values))
+ return bbox.bbox_pt(*map(bboxtype, values))
elif (line.rstrip() == "%%EndComments" or
(len(line) >= 2 and line[0] != "%" and line[1] not in string.whitespace)):
# implicit end of comments section
@@ -213,11 +219,11 @@ def _readbbox(file):
line = True
while line:
line = file.readline(EOFmsg=None)
- if line.startswith("%%BoundingBox:"):
+ if line.startswith(bboxmatch):
values = line.split(":", 1)[1].split()
if len(values) != 4:
raise IOError("invalid number of bounding box values")
- usebbox = bbox.bbox_pt(*map(int, values))
+ usebbox = bbox.bbox_pt(*map(bboxtype, values))
if not usebbox:
raise IOError("missing bounding box information in document trailer")
return usebbox
@@ -231,7 +237,7 @@ class epsfile(canvasitem.canvasitem):
x, y, filename,
width=None, height=None, scale=None, align="bl",
clip=1, translatebbox=1, bbox=None,
- kpsearch=0):
+ kpsearch=0, hiresbbox=0):
"""inserts epsfile
Object for an EPS file named filename at position (x,y). Width, height,
@@ -240,7 +246,8 @@ class epsfile(canvasitem.canvasitem):
translatebbox is not set, the EPS graphics is not translated to the
corresponding origin. If bbox is not None, it overrides the bounding
box in the epsfile itself. If kpsearch is set then filename is searched
- using the kpathsea library.
+ using the kpathsea library. If hiresbbox is set then the high resolution
+ bbox is used instead of the normal one.
"""
self.x_pt = unit.topt(x)
@@ -251,7 +258,7 @@ class epsfile(canvasitem.canvasitem):
self.mybbox = bbox
else:
epsfile = self.open()
- self.mybbox = _readbbox(epsfile)
+ self.mybbox = _readbbox(epsfile, hiresbbox=hiresbbox)
epsfile.close()
# determine scaling in x and y direction
--
1.7.6.336.gdf067
|
|
From: Michael J G. <mic...@us...> - 2011-07-22 12:09:47
|
Highlighting bbox issues.
---
I failed to install whatever I need from zope, I hope the example builds.
---
examples/drawing2/INDEX | 1 +
examples/drawing2/epsbbox.py | 23 +++++++++++++++++++++++
examples/drawing2/epsbbox.txt | 14 ++++++++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 examples/drawing2/epsbbox.py
create mode 100644 examples/drawing2/epsbbox.txt
diff --git a/examples/drawing2/INDEX b/examples/drawing2/INDEX
index e547b1b..e2f9ae5 100644
--- a/examples/drawing2/INDEX
+++ b/examples/drawing2/INDEX
@@ -3,3 +3,4 @@ insert
smoothed
parallel
clipping
+epsbbox
diff --git a/examples/drawing2/epsbbox.py b/examples/drawing2/epsbbox.py
new file mode 100644
index 0000000..408183f
--- /dev/null
+++ b/examples/drawing2/epsbbox.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: ISO-8859-1 -*-
+from pyx import *
+
+r = canvas.canvas()
+r.stroke(path.line(0, 0, 0.15, 0.15))
+r.writeEPSfile("epsbbox-inc", bboxenlarge=0)
+
+s = canvas.canvas()
+s.insert(r, [trafo.scale(10)])
+elow = epsfile.epsfile(0, 0, "epsbbox-inc.eps", scale=10)
+ehigh = epsfile.epsfile(0, 0, "epsbbox-inc.eps", scale=10, hiresbbox=1)
+
+c = canvas.canvas()
+x = 0
+
+for cc in [s, elow, ehigh]:
+ c.stroke(cc.bbox().rect(), [color.rgb.red, trafo.translate(x,0)])
+ c.insert(cc, [trafo.translate(x,0)])
+ x += cc.bbox().width()*1.2
+
+c.writeEPSfile("epsbbox")
+c.writePDFfile("epsbbox")
diff --git a/examples/drawing2/epsbbox.txt b/examples/drawing2/epsbbox.txt
new file mode 100644
index 0000000..7b82c60
--- /dev/null
+++ b/examples/drawing2/epsbbox.txt
@@ -0,0 +1,14 @@
+EPS-file inclusion and bounding boxes
+
+In this example we first generate an EPS-file and write it out.
+Reading an EPS-file with `epsfile.epsfile()` gives you a canvas which can be
+inserted just like other canvases. Note how you can scale the EPS when it is read.
+
+Like many others, PyX writes out high resolution bounding boxes.
+By default it reads the normal bounding boxes, but using `hiresbbox=1` you can
+instruct PyX to use the high resolution version. Note the difference between the
+middle (low res bbox) and right (high res bbox) boxes.
+
+!The difference between left (canvas bbox) and right (high res eps bbox) is due to
+fact that PyX can take into account the width of the line only for the bounding
+box calculation during the output of the EPS.
--
1.7.6.336.gdf067
|