diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-12-26 14:40:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-26 14:40:50 (GMT) |
commit | d1e058b9c1f93aa0a986dbc8a754c5eabd747e27 (patch) | |
tree | 5dadd9d3fae88b0d9e37182ea073e60ebe3197a5 /src/formula.cpp | |
parent | c42c0ae66542e4e154c2646fc725890554208d89 (diff) | |
parent | a5c98ade388f4f18ec30476ca706760a8129c73f (diff) | |
download | Doxygen-d1e058b9c1f93aa0a986dbc8a754c5eabd747e27.zip Doxygen-d1e058b9c1f93aa0a986dbc8a754c5eabd747e27.tar.gz Doxygen-d1e058b9c1f93aa0a986dbc8a754c5eabd747e27.tar.bz2 |
Merge branch 'master' into feature/bug_fenced_code
Diffstat (limited to 'src/formula.cpp')
-rw-r--r-- | src/formula.cpp | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/src/formula.cpp b/src/formula.cpp index 534f56a..63323db 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -51,8 +51,20 @@ void FormulaList::generateBitmaps(const char *path) int x1,y1,x2,y2; QDir d(path); // store the original directory - if (!d.exists()) { err("Output dir %s does not exist!\n",path); exit(1); } + if (!d.exists()) + { + term("Output dir %s does not exist!\n",path); + } QCString oldDir = QDir::currentDirPath().utf8(); + QCString macroFile = Config_getString(FORMULA_MACROFILE); + QCString stripMacroFile; + if (!macroFile.isEmpty()) + { + QFileInfo fi(macroFile); + macroFile=fi.absFilePath().utf8(); + stripMacroFile = fi.fileName().data(); + } + // go to the html output directory (i.e. path) QDir::setCurrent(d.absPath()); QDir thisDir; @@ -74,6 +86,11 @@ void FormulaList::generateBitmaps(const char *path) t << "\\usepackage[utf8]{inputenc}" << endl; // looks like some older distributions with newunicode package 1.1 need this option. writeExtraLatexPackages(t); writeLatexSpecialFormulaChars(t); + if (!macroFile.isEmpty()) + { + copyFile(macroFile,stripMacroFile); + t << "\\input{" << stripMacroFile << "}" << endl; + } t << "\\pagestyle{empty}" << endl; t << "\\begin{document}" << endl; int page=0; @@ -100,15 +117,15 @@ void FormulaList::generateBitmaps(const char *path) //printf("Running latex...\n"); //system("latex _formulas.tex </dev/null >/dev/null"); QCString latexCmd = "latex"; - portable_sysTimerStart(); - if (portable_system(latexCmd,"_formulas.tex")!=0) + Portable::sysTimerStart(); + if (Portable::system(latexCmd,"_formulas.tex")!=0) { err("Problems running latex. Check your installation or look " "for typos in _formulas.tex and check _formulas.log!\n"); formulaError=TRUE; //return; } - portable_sysTimerStop(); + Portable::sysTimerStop(); //printf("Running dvips...\n"); QListIterator<int> pli(pagesToGenerate); int *pagePtr; @@ -125,27 +142,27 @@ void FormulaList::generateBitmaps(const char *path) // postscript file. sprintf(dviArgs,"-q -D 600 -n 1 -p %d -o %s_tmp.ps _formulas.dvi", pageIndex,formBase.data()); - portable_sysTimerStart(); - if (portable_system("dvips",dviArgs)!=0) + Portable::sysTimerStart(); + if (Portable::system("dvips",dviArgs)!=0) { err("Problems running dvips. Check your installation!\n"); - portable_sysTimerStop(); + Portable::sysTimerStop(); QDir::setCurrent(oldDir); return; } - portable_sysTimerStop(); + Portable::sysTimerStop(); // run ps2epsi to convert to an encapsulated postscript file with // boundingbox (dvips with -E has some problems here). sprintf(psArgs,"%s_tmp.ps %s.eps",formBase.data(),formBase.data()); - portable_sysTimerStart(); - if (portable_system("ps2epsi",psArgs)!=0) + Portable::sysTimerStart(); + if (Portable::system("ps2epsi",psArgs)!=0) { err("Problems running ps2epsi. Check your installation!\n"); - portable_sysTimerStop(); + Portable::sysTimerStop(); QDir::setCurrent(oldDir); return; } - portable_sysTimerStop(); + Portable::sysTimerStop(); // now we read the generated postscript file to extract the bounding box QFileInfo fi(formBase+".eps"); if (fi.exists()) @@ -193,20 +210,20 @@ void FormulaList::generateBitmaps(const char *path) // used. char gsArgs[4096]; - sprintf(gsArgs,"-q -g%dx%d -r%dx%dx -sDEVICE=ppmraw " - "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -- %s.ps", + sprintf(gsArgs,"-q -g%dx%d -r%dx%d -sDEVICE=ppmraw " + "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -dNOSAFER %s.ps", gx,gy,(int)(scaleFactor*72),(int)(scaleFactor*72), formBase.data(),formBase.data() ); - portable_sysTimerStart(); - if (portable_system(portable_ghostScriptCommand(),gsArgs)!=0) + Portable::sysTimerStart(); + if (Portable::system(Portable::ghostScriptCommand(),gsArgs)!=0) { - err("Problem running ghostscript %s %s. Check your installation!\n",portable_ghostScriptCommand(),gsArgs); - portable_sysTimerStop(); + err("Problem running ghostscript %s %s. Check your installation!\n",Portable::ghostScriptCommand(),gsArgs); + Portable::sysTimerStop(); QDir::setCurrent(oldDir); return; } - portable_sysTimerStop(); + Portable::sysTimerStop(); f.setName(formBase+".pnm"); uint imageX=0,imageY=0; // we read the generated image again, to obtain the pixel data. |