|
From: | Abdelrazak Younes |
Subject: | Re: Text properties and FTGL |
Date: | Fri, 31 Oct 2008 18:17:43 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b1pre) Gecko/20081006 Shredder/3.0a3 |
On 31/10/2008 18:09, John Swensen wrote:
On Oct 31, 2008, at 2:25 AM, Abdelrazak Younes wrote:Hello, On 31/10/2008 03:02, John Swensen wrote:So I have done a few tests, probably in a very naive way, about rendering LaTeX strings to OpenGL. I think it is going to be prohibitively slow. Using the following code, even a simple equation took about 0.6 seconds. Maybe there is a faster way of doing this. I searched around and couldn't find a way to link against a library for rendering LaTeX code.Did you have a look at latexpreview? http://preview-latex.sourceforge.net/manual/This is IMHO the perfect solution for embedded LateX snippets. You can see how we are using that within LyX:http://wiki.lyx.org/LyX/InstantPreview Hope this helps, Abdel.This is essentially what my most recent test does. It generates a very simple .tex file with the equation included, runs it through pdflatex, runs it through pdfcrop (which is a script calling ghostscript) to cut it down to just the equation bounding box, and then use poppler to render it to an in-memory bitmap. I then draw it to OpenGL. From everything I have read and a quick glance at preview-latex sources, this appears to be essentially the same process.Any suggestions on getting the steps of running pdflatex and pdfcrop to go faster?
Not from me sorry.
Currently it seems to be taking too long for this to be a feasible solution if there are more than 1 or 2 equations in text on a given figure.
In LyX we cache the generated graphics in png format so that we don't have to generate them again if the equations are unchanged (you can crc the LaTeX snippets). But if you want something scalable I suggest that you cache the generated pdf graphics instead (after pdfcrop). I think it is acceptable to wait a tiny bit the first time the equation is rendered.
Abdel.
[Prev in Thread] | Current Thread | [Next in Thread] |