[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text properties and FTGL
From: |
John Swensen |
Subject: |
Re: Text properties and FTGL |
Date: |
Thu, 30 Oct 2008 22:02:11 -0400 |
On Oct 29, 2008, at 11:40 AM, John W. Eaton wrote:
On 29-Oct-2008, John Swensen wrote:
| I think that small subset should also have \dot, \ddot, \hat,
\tilde,
| and maybe a couple others, since these get used quite frequently.
And someone else will of course want \int and \sum and \begin{array}
and ... So I think it would be best to simply make it possible to use
all of TeX, interpreted by TeX itself rather than some kluge.
| Would you be averse to having the two options available at compile
| time? That way, for those with systems where LaTeX and libpoppler
are
| available (whether gtk or QT), we could compile in the support for
the
| full interpreter?
That adds maintenance overhead. I'd say just require TeX for TeX
markup, and if that is not available, then skip the transformation of
the TeX parts.
jwe
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. The pdfcrop step could definitely be made
faster, since it is a perl script that in turn calls ghostscript.
I also did the conversion to a bitmap with libpoppler (a version with
no dependency on glib and QT) and drew it with OpenGL and it upped the
time to about 1.0 seconds.
struct timeval start, stop;
gettimeofday(&start,NULL);
// Build up a simple LaTeX file
std::string baseFilename = "tmplatex";
std::string logFilename = baseFilename+".log";
std::string latexFilename = baseFilename+".tex";
std::string latexFileString = "\\documentclass{article}\n\
\usepackage{amsmath}\n\\usepackage{amssymb}\n\\usepackage{amsfonts}\n\
\thispagestyle{empty}\n\\begin{document}\n\\begin{equation*}\n" + lbl
+ "\\end{equation*}\\end{document}\n";
// TODO: write this to a tmp file
FILE* fd = fopen(latexFilename.c_str(),"w+");
fprintf(fd,latexFileString.c_str());
fclose(fd);
// Run pdflatex on the file
std::string pdflatexCmd = "pdflatex -interaction nonstopmode " +
latexFilename + " > " + logFilename;
system(pdflatexCmd.c_str());
// Run pdfcrop on the result
std::string pdfcropCmd = "pdfcrop --clip --hires " + baseFilename
+ ".pdf >> " + logFilename;
system(pdfcropCmd.c_str());
gettimeofday(&stop,NULL);
double elapsed = (stop.tv_sec - start.tv_sec) +
1E-6*(stop.tv_usec - start.tv_usec);
std::cout << "Elapsed: " << elapsed << std::endl;
- Re: Text properties and FTGL, (continued)
- Re: Text properties and FTGL, Shai Ayal, 2008/10/28
- Re: Text properties and FTGL, John W. Eaton, 2008/10/28
- Re: Text properties and FTGL, Thomas Weber, 2008/10/28
- Re: Text properties and FTGL, Jordi Gutiérrez Hermoso, 2008/10/28
- Re: Text properties and FTGL, John Swensen, 2008/10/28
- Re: Text properties and FTGL, Shai Ayal, 2008/10/29
- Re: Text properties and FTGL, John Swensen, 2008/10/29
- Re: Text properties and FTGL, John W. Eaton, 2008/10/29
- Re: Text properties and FTGL, Michael Goffioul, 2008/10/29
- Re: Text properties and FTGL, John W. Eaton, 2008/10/29
- Re: Text properties and FTGL,
John Swensen <=
- Re: Text properties and FTGL, Abdelrazak Younes, 2008/10/31
- Re: Text properties and FTGL, John Swensen, 2008/10/31
- Re: Text properties and FTGL, Abdelrazak Younes, 2008/10/31
- Re: Text properties and FTGL, Søren Hauberg, 2008/10/31
- Re: Text properties and FTGL, Jason Riedy, 2008/10/31
- Re: Text properties and FTGL, John Swensen, 2008/10/31
- Re: Text properties and FTGL, Bill Denney, 2008/10/31
- Re: Text properties and FTGL, John W. Eaton, 2008/10/29
- Re: Text properties and FTGL, Abdelrazak Younes, 2008/10/31
- Re: Text properties and FTGL, Ben Abbott, 2008/10/28