From: Charles B. <bo...@bu...> - 2012-10-23 04:06:23
|
Andre and Alan, Many thanks for sharing how postsript handles lines of zero thickness and how PyX handles draw vs stroke...here's some code that illustrates all this.... Thanks again, Charley ========================== from pyx import * c = canvas.canvas() p = path.path(path.moveto(-2, 0), path.curveto(-1, 0, -1, 1, 0, 1), path.curveto(1, 1, 1, 0, 2, 0)) zeroThicknessPath = path.path(path.moveto(-2, 0.5), path.curveto(-1, 0.5, -1, 1.5, 0, 1.5), path.curveto(1, 1.5, 1, 0.5, 2, 0.5)) noPath = path.path(path.moveto(-2, 1), path.curveto(-1, 1, -1, 2, 0, 2), path.curveto(1, 2, 1, 1, 2, 1)) c.stroke(p, [deco.curvedtext("\PyX{} is fun!")]) c.stroke(zeroThicknessPath, [deco.curvedtext("\PyX{} is fun!"),style.linewidth(0)]) c.draw(noPath, [deco.curvedtext("\PyX{} is fun!")]) c.writeEPSfile("textalongpath") c.writePDFfile("textalongpath") ============================== Charles Bowman, Ph.D. Dept. of Physiology and Biophysical Sciences University at Buffalo Buffalo NY 14214 Sherman 126 Tel: 716-829-3350 On Mon 10/22/12 1:11 AM , André Wobst wo...@us... sent: > Dear Charles, > > > Am 22.10.2012 um 05:17 schrieb Charles Bowman: > > It's great to see PyX-0.12 working well on my xp > and windows 7 boxes! > Glad to hear that. > > > When printing text along a path, I sometimes > don't want to include the path so I> attempt to print a "zero width" path > in the manner shown below. > > > The following code in PyX-0.12 prints a line > when linewidth is set to zero > > > Any suggestions? > > Use the draw method instead of the stroke method. You can than ignore the > linewidth at all, as the original path won't be contained in the output at > all. > Internally (and to introduce you with some PyX speak), the draw method > applies all the decorators to the path and outputs it. The stroke and fill > methods do the same, but they add the stroke and fill decorator. After all > decorators have been applied, a decorated path instance will be output, > which does not just contain the path with its output attributes applied, > but also ornaments like the text along a path or an arrow head etc. > 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/ > > > > |