Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from matplotlib.backend_bases import RendererBase
from matplotlib.textpath import TextPath
from matplotlib.colors import colorConverter


def _process_text_args(override, fontdict=None, **kwargs):
Expand Down Expand Up @@ -749,8 +750,10 @@ def draw(self, renderer):
if textobj._bbox_patch:
textobj._draw_bbox(renderer, posx, posy)

color = textobj.get_color()
color = colorConverter.to_rgb(color)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be to_rgba?

prop = textobj._fontproperties
gc = renderer.new_gc()
gc.set_foreground(textobj.get_color())
gc.set_alpha(textobj.get_alpha())
gc.set_url(textobj._url)
textobj._set_gc_clip(gc)
Expand All @@ -771,19 +774,24 @@ def draw(self, renderer):
clean_line, ismath = textobj.is_math_text(line)

if textobj.get_path_effects():
from matplotlib.patheffects import PathEffectRenderer
textrenderer = PathEffectRenderer(
textobj.get_path_effects(), renderer)
path_effects = textobj.get_path_effects()
if textobj.get_usetex():
ismath = "TeX"
path, transform = renderer._get_text_path_transform(
x, y, clean_line, prop, angle, ismath)
gc.set_linewidth(0.0)
for path_effect in path_effects:
path_effect.draw_path(renderer, gc, path, transform,
rgbFace=color)
else:
textrenderer = renderer

if textobj.get_usetex():
textrenderer.draw_tex(gc, x, y, clean_line,
textobj._fontproperties, angle,
gc.set_foreground(color)
if textobj.get_usetex():
renderer.draw_tex(gc, x, y, clean_line,
prop, angle,
mtext=mtext)
else:
textrenderer.draw_text(gc, x, y, clean_line,
textobj._fontproperties, angle,
else:
renderer.draw_text(gc, x, y, clean_line,
prop, angle,
ismath=ismath, mtext=mtext)

gc.restore()
Expand Down