Skip to content

Commit 24709c5

Browse files
authored
Merge pull request #2058 from UV-CDAT/fix_export_svg
Fix export svg
2 parents ba05f56 + 8991302 commit 24709c5

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

Packages/vcs/vcs/VTKPlots.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -688,21 +688,16 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs):
688688
self.scaleLogo()
689689

690690
# Decide whether to rasterize background in vector outputs
691-
# Current criteria to rasterize:
691+
# Current limitation to vectorize:
692692
# * if fillarea style is either pattern or hatch
693-
# * if fillarea opacity is less than 100 for solid fill
694693
try:
695694
if gm.style and all(style != 'solid' for style in gm.style):
696695
self._rasterPropsInVectorFormats = True
697-
elif gm.opacity and not all(o == 100 for o in gm.opacity):
698-
self._rasterPropsInVectorFormats = True
699696
except:
700697
pass
701698
try:
702699
if gm.fillareastyle in ['pattern', 'hatch']:
703700
self._rasterPropsInVectorFormats = True
704-
elif not all(o == 100 for o in gm.fillareaopacity):
705-
self._rasterPropsInVectorFormats = True
706701
except:
707702
pass
708703

@@ -1109,6 +1104,7 @@ def vectorGraphics(self, output_type, file, width=None, height=None,
11091104

11101105
# Since the patterns are applied as textures on vtkPolyData, enabling
11111106
# background rasterization is required to write them out
1107+
11121108
if self._rasterPropsInVectorFormats:
11131109
gl.Write3DPropsAsRasterImageOn()
11141110

@@ -1117,9 +1113,10 @@ def vectorGraphics(self, output_type, file, width=None, height=None,
11171113
gl.SetFilePrefix(".".join(file.split(".")[:-1]))
11181114

11191115
if textAsPaths:
1120-
gl.TextAsPathOff()
1121-
else:
11221116
gl.TextAsPathOn()
1117+
else:
1118+
gl.TextAsPathOff()
1119+
11231120
if output_type == "svg":
11241121
gl.SetFileFormatToSVG()
11251122
elif output_type == "ps":
@@ -1252,16 +1249,16 @@ def gettextextent(self, textorientation, texttable):
12521249
texttable = vcs.gettexttable(texttable)
12531250

12541251
from vtk_ui.text import text_dimensions
1255-
1252+
12561253
text_property = vtk.vtkTextProperty()
12571254
info = self.canvasinfo()
12581255
win_size = info["width"], info["height"]
12591256
vcs2vtk.prepTextProperty(text_property, win_size, to=textorientation, tt=texttable)
1260-
1257+
12611258
dpi = self.renWin.GetDPI()
1262-
1259+
12631260
length = max(len(texttable.string), len(texttable.x), len(texttable.y))
1264-
1261+
12651262
strings = texttable.string + [texttable.string[-1]] * (length - len(texttable.string))
12661263
xs = texttable.x + [texttable.x[-1]] * (length - len(texttable.x))
12671264
ys = texttable.y + [texttable.y[-1]] * (length - len(texttable.y))

0 commit comments

Comments
 (0)