File indexing completed on 2024-05-05 03:48:22
0001 /* 0002 File : TeXRenderer.h 0003 Project : LabPlot 0004 Description : TeX renderer class 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2008-2016 Alexander Semke <alexander.semke@web.de> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef TEXRENDERER_H 0011 #define TEXRENDERER_H 0012 0013 #include <QColor> 0014 0015 class QString; 0016 class QImage; 0017 class QTemporaryFile; 0018 0019 class TeXRenderer { 0020 public: 0021 struct Formatting { 0022 QColor fontColor; 0023 QColor backgroundColor; 0024 int fontSize; 0025 QString fontFamily; 0026 int dpi; 0027 }; 0028 0029 struct Result { 0030 Result() 0031 : successful(false) { 0032 } 0033 bool successful; 0034 QString errorMessage; 0035 }; 0036 0037 static QByteArray renderImageLaTeX(const QString&, Result*, const TeXRenderer::Formatting&); 0038 static bool executeLatexProcess(const QString engine, const QString& baseName, const QTemporaryFile& file, const QString& resultFileExtension, Result* res); 0039 static QByteArray imageFromPDF(const QTemporaryFile&, const QString& engine, Result*); 0040 static QByteArray imageFromDVI(const QTemporaryFile&, const int dpi, Result*); 0041 static bool enabled(); 0042 static bool executableExists(const QString&); 0043 }; 0044 0045 #endif