Problem changing font properties

The effects are observed from with a single python session.

    > Out of curiosity - Is there any way of clearing the cache
    > within a session ?

OK, I think I see what is going on. text.Text is calling
FigureCanvas.draw_text with a font_manager.FontProperties instance.
backend_ps is using the __hash__ method of the FontProperties class to
create a cache mapping the font property to the ttf font found in the
RendererPS._get_font_ttf method.

    def _get_font_ttf(self, prop):
        key = hash(prop)
        font = _fontd.get(key)
        if font is None:
            fname = fontManager.findfont(prop)
            font = FT2Font(str(fname))
            _fontd[key] = font
            if fname not in _type42:
        size = prop.get_size_in_points()
        font.set_size(size, 72.0)
        return font

the hash(prop) call as noted above calls the __hash__ method of the

    def __hash__(self):
        return hash( (
            tuple(self.__family), self.__style, self.__variant,
            self.__weight, self.__stretch, self.__size,
            self.__parent_size, self.fname))

My first guess w/o looking further was that the "family" entry is
'sans-serif' but not the actual font list (eg Lucida versus Bitstream)
and this is the source of your woes. Basically, we need to make the
hash method smarter to take account of the actual family list.

You might insert some debug print statements into the font_manager
class to see what this tuple being passed to hash actually is.

On second glance, the family seems to be set properly

        if family is None: family = rcParams['font.'+rcParams['']]

if rcParams[']' is 'sans-serif', then family should be
rcParams['font.sans-serif'] which is what we want since this is your
new list. But this is only on the family=None branch, so we need to
find out if a) it is working like it should on this branch and b) what
is being passed if family is not None.

You asked about clearing the cache:

  import matplotlib.backends.backend_ps as ps
  ps._fontd = {}

Let us know what you find out...