Hi: I'm writing a vector graphics drawing lib that produces PS/EPS outputs. I want allow users can embed LaTeX expressions into the file like asymptote did. I only have a vague understanding of how to achieve this: as far as I know, one should first create a .tex file which contains the source latex string, then compile this tex file using a tex engine to get a .dvi output, then parse this dvi file to get the info of the latex string and fonts used in it, and finally look for the font file and embed the command into postscript. Am I right? Can someone help explain more details of the process to me? thanks!
(I want to know what a .dvi file contains, how it's related to the actual font file, and how the ps commands look like)