summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.xml8
-rw-r--r--src/doxygen.cpp2
-rw-r--r--src/formula.cpp37
-rw-r--r--src/htmldocvisitor.cpp2
4 files changed, 40 insertions, 9 deletions
diff --git a/src/config.xml b/src/config.xml
index fec21b6..de5efdc 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -2357,16 +2357,16 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
]]>
</docs>
</option>
- <option type='enum' id='HTML_FORMULA_FORMAT' defval='PNG' depends='GENERATE_HTML'>
+ <option type='enum' id='HTML_FORMULA_FORMAT' defval='png' depends='GENERATE_HTML'>
<docs>
<![CDATA[
- If the \c HTML_FORMULA_FORMAT option is set to \c SVG, doxygen will use the pdf2svg
+ If the \c HTML_FORMULA_FORMAT option is set to \c svg, doxygen will use the pdf2svg
tool (see https://github.com/dawbarton/pdf2svg) to generate formulas as SVG images instead of
PNGs for the HTML output. These images will generally look nicer at scaled resolutions.
]]>
</docs>
- <value name="PNG" desc="The default"/>
- <value name="SVG" desc="Looks nicer but requires the pdf2svg tool"/>
+ <value name="png" desc="The default"/>
+ <value name="svg" desc="Looks nicer but requires the pdf2svg tool"/>
</option>
<option type='int' id='FORMULA_FONTSIZE' minval='8' maxval='50' defval='10' depends='GENERATE_HTML'>
<docs>
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index a36bf06..f6e8d09 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -11412,7 +11412,7 @@ void generateOutput()
&& !Config_getBool(USE_MATHJAX))
{
g_s.begin("Generating images for formulas in HTML...\n");
- fm.generateImages(Config_getString(HTML_OUTPUT), Config_getEnum(HTML_FORMULA_FORMAT)=="SVG" ?
+ fm.generateImages(Config_getString(HTML_OUTPUT), Config_getEnum(HTML_FORMULA_FORMAT)=="svg" ?
FormulaManager::Format::Vector : FormulaManager::Format::Bitmap, FormulaManager::HighDPI::On);
g_s.end();
}
diff --git a/src/formula.cpp b/src/formula.cpp
index 063684e..92647ed 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -38,6 +38,15 @@
#define RM_TMP_FILES (true)
//#define RM_TMP_FILES (false)
+// for SVG output choose which tool to use
+#define USE_PDF2SVG 1
+#define USE_INKSCAPE 0
+
+#if (USE_PDF2SVG+USE_INKSCAPE!=1)
+#error "Invalid configuration: either USE_PDF2SVG or USE_INKSCAPE should be 1"
+#endif
+
+
struct FormulaManager::Private
{
void storeDisplaySize(int id,int w,int h)
@@ -294,6 +303,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c
}
Portable::sysTimerStop();
+#if USE_PDF2SVG
sprintf(args,"%s_tmp.pdf form_%d.svg",formBase.data(),pageNum);
Portable::sysTimerStart();
if (Portable::system("pdf2svg",args)!=0)
@@ -304,7 +314,25 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c
return;
}
Portable::sysTimerStop();
- if (RM_TMP_FILES) thisDir.remove(formBase+"_tmp.pdf");
+#endif
+
+#if USE_INKSCAPE // alternative using inkscape (does seem to work very well on my system)
+ sprintf(args,"-l -z %s_tmp.pdf -o form_%d.svg 2>%s",formBase.data(),pageNum,Portable::devNull());
+ Portable::sysTimerStart();
+ if (Portable::system("inkscape",args)!=0)
+ {
+ err("Problems running inkscape. Check your installation!\n");
+ Portable::sysTimerStop();
+ QDir::setCurrent(oldDir);
+ return;
+ }
+ Portable::sysTimerStop();
+#endif
+
+ if (RM_TMP_FILES)
+ {
+ thisDir.remove(formBase+"_tmp.pdf");
+ }
}
else // format==Format::Bitmap
{
@@ -378,8 +406,11 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c
}
Portable::sysTimerStop();
- thisDir.remove(formBase+"_tmp.eps");
- thisDir.remove(formBase+"_tmp_corr.eps");
+ if (RM_TMP_FILES)
+ {
+ thisDir.remove(formBase+"_tmp.eps");
+ thisDir.remove(formBase+"_tmp_corr.eps");
+ }
}
// remove intermediate image files
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 5c17198..f220646 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -890,7 +890,7 @@ void HtmlDocVisitor::visit(DocFormula *f)
filterQuotedCdataAttr(f->text());
m_t << "\"";
m_t << " src=\"" << f->relPath() << f->name();
- if (Config_getEnum(HTML_FORMULA_FORMAT)=="SVG")
+ if (Config_getEnum(HTML_FORMULA_FORMAT)=="svg")
{
m_t << ".svg";
}