Skip to content

Commit 3daceff

Browse files
committed
Hide fully transparent text in PS output.
PS doesn't really support transparency (because the format itself doesn't, unless using some nonstandard extensions), but has some special casing for "fully transparent" (see e.g. "rgbFace is None" check in _draw_ps). Also implement the special-casing for text.
1 parent 2296775 commit 3daceff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,16 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
631631

632632
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
633633
"""
634-
draw a Text instance
634+
Draw a Text instance.
635635
"""
636636
# local to avoid repeated attribute lookups
637637
write = self._pswriter.write
638638
if debugPS:
639639
write("% text\n")
640640

641+
if gc.get_rgb() == (0, 0, 0, 0):
642+
return # Special handling for fully transparent.
643+
641644
if ismath=='TeX':
642645
return self.draw_tex(gc, x, y, s, prop, angle)
643646

0 commit comments

Comments
 (0)