KLFBackend Class Reference

The main engine for KLatexFormula. More...

#include <klfbackend.h>

List of all members.

Static Public Member Functions

static klfOutput getLatexFormula (const klfInput &in, const klfSettings &settings)

Classes

struct  klfInput
 Specific input to KLFBackend::getLatexFormula(). More...
struct  klfOutput
 KLFBackend::getLatexFormula() result. More...
struct  klfSettings
 General settings for KLFBackend::getLatexFormula(). More...


Detailed Description

The main engine for KLatexFormula.

The main engine for KLatexFormula, providing core functionality of transforming LaTeX code into graphics.

Don't instanciate this class, use the static function KLFBackend::getLatexFormula() to do all the processing.

Author:
Philippe Faist <philippe.faist@bluewin.ch>

Definition at line 123 of file klfbackend.h.


Member Function Documentation

KLFBackend::klfOutput KLFBackend::getLatexFormula ( const klfInput in,
const klfSettings settings 
) [static]

The call to process everything.

Pass on a valid klfInput input object, as well as a klfSettings object filled with your input and settings, and you will get output in klfOutput.

If an error occurs, klfOutput::status is non-zero and klfOutput::errorstr contains an explicit error in human-readable form. The latter is Qt-Translated with QObject::tr() with "KLFBackend" comment.

Usage example:

   ...
   // these could have been declared at some more global scope
   KLFBackend::klfSettings settings;
   settings.tempdir = "/tmp";
   settings.latexexec = "latex";
   settings.dvipsexec = "dvips";
   settings.gsexec = "gs";
   settings.epstopdfexec = "epstopdf";
   settings.lborderoffset = 1;
   settings.tborderoffset = 1;
   settings.rborderoffset = 1;
   settings.bborderoffset = 1;

   KLFBackend::klfInput input;
   input.latex = "\\int_{\\Sigma}\\!(\\vec{\\nabla}\\times\\vec u)\\,d\\vec S = \\oint_C \\vec{u}\\cdot d\\vec r";
   input.mathmode = "\\[ ... \\]";
   input.preamble = "\\usepackage{somerequiredpackage}\n";
   input.fg_color = qRgb(255, 128, 128); // pink
   input.bg_color = qRgba(0, 0, 80, 255); // dark blue, opaque
   input.dpi = 300;

   KLFBackend::klfOutput out = KLFBackend::getLatexFormula(input, settings);

   if (out.status != 0) {
     // an error occurred. an appropriate error string is in out.errorstr
     display_error_to_user(out.errorstr);
     return;
   }

   myLabel->setPixmap(QPixmap(out.result));

   // write contents of 'out.pdfdata' to a file to get a PDF file (for example)
   {
     QFile fpdf(fname);
     fpdf.open(IO_WriteOnly | IO_Raw);
     fpdf.writeBlock(*dataptr);
   }
   ...

Definition at line 80 of file klfbackend.cpp.

References KLFBackend::klfSettings::bborderoffset, KLFBackend::klfInput::bg_color, KLFBackend::klfInput::dpi, KLFBackend::klfSettings::dvipsexec, KLFBackend::klfOutput::epsdata, KLFBackend::klfSettings::epstopdfexec, KLFBackend::klfOutput::errorstr, KLFBlockProcess::exitStatus(), KLFBackend::klfInput::fg_color, KLFBackend::klfSettings::gsexec, KLFERR_BADEPSBBOX, KLFERR_DVIPSNONORMALEXIT, KLFERR_EPSREADFAIL, KLFERR_EPSTOPDFNONORMALEXIT, KLFERR_EPSWRITEFAIL, KLFERR_GSNONORMALEXIT, KLFERR_LATEXNONORMALEXIT, KLFERR_MISSINGLATEXFORMULA, KLFERR_MISSINGMATHMODETHREEDOTS, KLFERR_NODVIFILE, KLFERR_NODVIPSPROG, KLFERR_NOEPSBBOX, KLFERR_NOEPSFILE, KLFERR_NOEPSTOPDFPROG, KLFERR_NOERROR, KLFERR_NOGSPROG, KLFERR_NOLATEXPROG, KLFERR_NOPDFFILE, KLFERR_NOPNGFILE, KLFERR_PDFREADFAIL, KLFERR_PNGREADFAIL, KLFERR_PROGERR_DVIPS, KLFERR_PROGERR_EPSTOPDF, KLFERR_PROGERR_GS, KLFERR_PROGERR_LATEX, KLFERR_TEXWRITEFAIL, KLFBackend::klfInput::latex, KLFBackend::klfSettings::latexexec, KLFBackend::klfSettings::lborderoffset, KLFBackend::klfInput::mathmode, KLFBlockProcess::normalExit(), KLFBackend::klfOutput::pdfdata, KLFBackend::klfOutput::pngdata, KLFBackend::klfInput::preamble, KLFBackend::klfSettings::rborderoffset, KLFBlockProcess::readStderrString(), KLFBlockProcess::readStdoutString(), KLFBackend::klfOutput::result, KLFBlockProcess::startProcess(), KLFBackend::klfOutput::status, KLFBackend::klfSettings::tborderoffset, and KLFBackend::klfSettings::tempdir.


The documentation for this class was generated from the following files:
Generated on Mon May 4 01:27:08 2009 for KLFBackend by  doxygen 1.5.3