I refactored the textpath class as a separate module (textpath.py).
Now, it supports mathtext and also usetex mode.
The example, demo_text_path.py, also is updated (figure attached).
You may use this module to improve the visibility of the text.
Or you may use it to create your own mpl logo
What I'm actually planning to do is to implement the "draw_text" and
the "draw_tex" method of the RendererBase using the textpath so that a
new backend may only implement the draw_path and draw_image. The
usetex-mode will be supported in most of the backend (e.g., usetex in
svg). Of course, the quality of the rendered text will not be ideal,
especially for low dpi screen display, and it should be best if
backend-specific draw_text method is eventually implemented.
I must confess that I don't have much clue about the font rendering.
Most of the code in the textpath.py are borrowed from backed_svg.py
and backend_pdf.py, and it is highly likely that there are things
that I didn't get right. So, it would be great if those who knows
better (e.g., the original authors of the svg and pdf backend) review
The current code does not take care of "dpi", "rotation" and
"baseline", and also not well optimized. My plan is to improve these
as I incorporate textpath into the RendererBase. Any comments or
suggestion will be welcomed.