1+ import cdms2 , vcs , tempfile
2+
3+ x = vcs .init (bg = 1 , geometry = (800 , 600 ))
4+ txt = x .createtext ()
5+ txt .x = [.0000005 ,.00000005 ,.5 ,.99999 ,.999999 ]
6+ txt .y = [0.05 ,.9 ,.5 ,.9 ,0.05 ]
7+ txt .string = ["SAMPLE TEXT A" ,"SAMPLE TEXT B" ,"SAMPLE TEXT C" ,"SAMPLE TEXT D" ,"SAMPLE TEXT E" ]
8+ txt .halign = "center"
9+ txt .valign = "base"
10+ txt .height = 10
11+ x .plot (txt )
12+
13+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.ps' , \
14+ prefix = 'tmpTextAsObjectFalse' , delete = True )
15+ x .postscript (tmpfile .name , textAsObject = False )
16+ tmpfile .close ()
17+
18+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.ps' , \
19+ prefix = 'tmpTextAsObjectTrue' , delete = True )
20+ x .postscript (tmpfile .name , textAsObject = True )
21+ tmpfile .close ()
22+
23+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.pdf' , \
24+ prefix = 'tmpTextAsObjectFalse' , delete = True )
25+ x .pdf (tmpfile .name , textAsObject = False )
26+ tmpfile .close ()
27+
28+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.pdf' , \
29+ prefix = 'tmpTextAsObjectTrue' , delete = True )
30+ x .pdf (tmpfile .name , textAsObject = True )
31+ tmpfile .close ()
32+
33+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.svg' , \
34+ prefix = 'tmpTextAsObjectFalse' , delete = True )
35+ x .pdf (tmpfile .name , textAsObject = False )
36+ tmpfile .close ()
37+
38+ tmpfile = tempfile .NamedTemporaryFile (suffix = '.svg' , \
39+ prefix = 'tmpTextAsObjectTrue' , delete = True )
40+ x .pdf (tmpfile .name , textAsObject = True )
41+ tmpfile .close ()
0 commit comments