|
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
|