On 08/26/2011 02:32 AM, Ole Jacob Hagen wrote:

I'm about to implement a TeX interpreter for the graphical backend to GNU Octave (http://www.octave.org). The rendering is in OpenGL context.
As I understand it, matplotlib doesn't use OpenGL at all?

Not at present -- though various people are working on it.

Could you tell me about the design and work flow for the Tex/Latex interpreter and rendering system for TeX/Latex fonts?

There are two.  One is a Python reimplementation of part of the TeX math algorithms called "mathtext" (I am the original author).  It uses Truetype versions of either the Computer Modern fonts or the STIX fonts.  It is able to produce either raster images or data that is then used by the matplotlib backends to generate PS, PDF, SVG etc.

The other approach is used when "text.usetex" is True.  It calls out to a real "tex" interpreter and then interprets the DVI it produces to convert it into a form the matplotlib backends can use.  Since I didn't write this code, I'm not as familiar with the details.

In the case of OpenGL, since you only want images anyway, you may be best off using a tool like dvipng along with the preview LaTeX package, if having "real" LaTeX as a dependency is acceptable.