diff options
author | albert-github <albert.tests@gmail.com> | 2020-02-15 13:43:31 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-02-15 13:43:31 (GMT) |
commit | d32c7f52414d6a2bcb8b2a62bb780333348000be (patch) | |
tree | 6fbedf341ab7010499532c3a265a584363726e59 /src/formula.cpp | |
parent | c8d3befccbfbba83c2c0509dc23d53144177aa94 (diff) | |
download | Doxygen-d32c7f52414d6a2bcb8b2a62bb780333348000be.zip Doxygen-d32c7f52414d6a2bcb8b2a62bb780333348000be.tar.gz Doxygen-d32c7f52414d6a2bcb8b2a62bb780333348000be.tar.bz2 |
Creation of svg images for formulas with inkscape
Based on the implementation as mentioned in #7578 to add the possibilities to generated svg images for formulas
- When running with inkscape 92.3 / 92.4 on Cygwin /Windows there were no images generated as the `-o` flag didn't exist, the output file had to be specified as part of the `-l` (or `--export-plain-svg`) option
- For more flexibility the system is checked on existence of the `pdf2svg` and `inkscape` executables, so no compilations flags are necessary
Diffstat (limited to 'src/formula.cpp')
-rw-r--r-- | src/formula.cpp | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/src/formula.cpp b/src/formula.cpp index 92647ed..de004ed 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -38,15 +38,6 @@ #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) @@ -303,31 +294,37 @@ 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) + if (Portable::checkForExecutable("pdf2svg")) { - err("Problems running pdf2svg. Check your installation!\n"); + sprintf(args,"%s_tmp.pdf form_%d.svg",formBase.data(),pageNum); + Portable::sysTimerStart(); + if (Portable::system("pdf2svg",args)!=0) + { + err("Problems running pdf2svg. Check your installation!\n"); + Portable::sysTimerStop(); + QDir::setCurrent(oldDir); + return; + } Portable::sysTimerStop(); - QDir::setCurrent(oldDir); - return; } - Portable::sysTimerStop(); -#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) + else if (Portable::checkForExecutable("inkscape")) { - err("Problems running inkscape. Check your installation!\n"); + sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),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(); - QDir::setCurrent(oldDir); + } + else + { + err("Neither 'pdf2svg' nor 'inkscape' present for conversion of formula to 'svg'\n"); return; } - Portable::sysTimerStop(); -#endif if (RM_TMP_FILES) { |