Skip to content

Commit ce2e03a

Browse files
committed
Added option to export text as object or path
1 parent 7152d0c commit ce2e03a

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

Packages/vcs/vcs/Canvas.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,7 +2313,7 @@ def plot(self, *actual_args, **keyargs):
23132313
Other:
23142314
[x|y]rev = 0|1 # if ==1, reverse the direction of the x
23152315
or y axis
2316-
continents = 0,1,2,3,4,5,6,7,8,9,10,11 # if >=1, plot continental outlines
2316+
continents = 0,1,2,3,4,5,6,7,8,9,10,11 # if >=1, plot continental outlines
23172317
(default: plot if xaxis is
23182318
longitude, yaxis is latitude -or-
23192319
xname is 'longitude' and yname is
@@ -3939,7 +3939,7 @@ def close(self, *args, **kargs):
39393939

39403940
##########################################################################
39413941
# #
3942-
# Destroy VCS Canvas Object (i.e., call the Dealloc C code). #
3942+
# Destroy VCS Canvas Object (i.e., call the Dealloc C code). #
39433943
# #
39443944
##########################################################################
39453945
def destroy(self):
@@ -4680,7 +4680,7 @@ def png(self, file, width=None, height=None,
46804680
# pdf wrapper for VCS. #
46814681
# #
46824682
##########################################################################
4683-
def pdf(self, file, width=None, height=None, units='inches'):
4683+
def pdf(self, file, width=None, height=None, units='inches', textAsObject=True):
46844684
"""
46854685
Function: postscript
46864686
@@ -4704,14 +4704,14 @@ def pdf(self, file, width=None, height=None, units='inches'):
47044704

47054705
if not file.split('.')[-1].lower() in ['pdf']:
47064706
file += '.pdf'
4707-
return self.backend.pdf(file, W, H)
4707+
return self.backend.pdf(file, W, H. textAsObject)
47084708
##########################################################################
47094709
# #
47104710
# SVG wrapper for VCS. #
47114711
# #
47124712
##########################################################################
47134713

4714-
def svg(self, file, width=None, height=None, units='inches'):
4714+
def svg(self, file, width=None, height=None, units='inches', textAsObject=True):
47154715
"""
47164716
Function: postscript
47174717
@@ -4735,7 +4735,7 @@ def svg(self, file, width=None, height=None, units='inches'):
47354735

47364736
if not file.split('.')[-1].lower() in ['svg']:
47374737
file += '.svg'
4738-
return self.backend.svg(file, W, H)
4738+
return self.backend.svg(file, W, H, textAsObject)
47394739

47404740
def _compute_margins(
47414741
self, W, H, top_margin, bottom_margin, right_margin, left_margin, dpi):
@@ -4911,7 +4911,7 @@ def _compute_width_height(self, width, height, units, ps=False):
49114911
return W, H
49124912

49134913
def postscript(self, file, mode='r', orientation=None, width=None, height=None,
4914-
units='inches'):
4914+
units='inches', textAsObject=True):
49154915
"""
49164916
Function: postscript
49174917
@@ -4950,7 +4950,7 @@ def postscript(self, file, mode='r', orientation=None, width=None, height=None,
49504950
if not file.split('.')[-1].lower() in ['ps', 'eps']:
49514951
file += '.ps'
49524952
if mode == 'r':
4953-
return self.backend.postscript(file, W, H, units="pixels")
4953+
return self.backend.postscript(file, W, H, units="pixels", textAsObject=textAsObject)
49544954
else:
49554955
n = random.randint(0, 10000000000000)
49564956
psnm = '/tmp/' + '__VCS__tmp__' + str(n) + '.ps'
@@ -5209,7 +5209,7 @@ def getcontinentsline(self):
52095209

52105210
##########################################################################
52115211
# #
5212-
# Set continents type wrapper for VCS. #
5212+
# Set continents type wrapper for VCS. #
52135213
# #
52145214
##########################################################################
52155215
def setcontinentstype(self, value):

Packages/vcs/vcs/VTKPlots.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ def get3DPlot(self):
10641064
return plot
10651065

10661066
def vectorGraphics(
1067-
self, output_type, file, width=None, height=None, units=None):
1067+
self, output_type, file, width=None, height=None, units=None, textAsObject=True):
10681068
if self.renWin is None:
10691069
raise Exception("Nothing on Canvas to dump to file")
10701070

@@ -1095,7 +1095,11 @@ def vectorGraphics(
10951095
gl.SetInput(self.renWin)
10961096
gl.SetCompress(0) # Do not compress
10971097
gl.SetFilePrefix(".".join(file.split(".")[:-1]))
1098-
gl.TextAsPathOn()
1098+
1099+
if textAsObject:
1100+
gl.TextAsPathOff()
1101+
else:
1102+
gl.TextAsPathOn()
10991103
if output_type == "svg":
11001104
gl.SetFileFormatToSVG()
11011105
elif output_type == "ps":
@@ -1112,14 +1116,17 @@ def vectorGraphics(
11121116
self.showGUI()
11131117

11141118
def postscript(self, file, width=None, height=None,
1115-
units=None):
1116-
return self.vectorGraphics("ps", file, width, height, units)
1119+
units=None, textAsObject=True):
1120+
return self.vectorGraphics("ps", file, width, height,
1121+
units, textAsObject)
11171122

1118-
def pdf(self, file, width=None, height=None, units=None):
1119-
return self.vectorGraphics("pdf", file, width, height, units)
1123+
def pdf(self, file, width=None, height=None, units=None, textAsObject=True):
1124+
return self.vectorGraphics("pdf", file, width, height,
1125+
units, textAsObject)
11201126

1121-
def svg(self, file, width=None, height=None, units=None):
1122-
return self.vectorGraphics("svg", file, width, height, units)
1127+
def svg(self, file, width=None, height=None, units=None, textAsObject=True):
1128+
return self.vectorGraphics("svg", file, width,
1129+
height, units, textAsObject)
11231130

11241131
def gif(self, filename='noname.gif', merge='r', orientation=None,
11251132
geometry='1600x1200'):

0 commit comments

Comments
 (0)