@@ -1428,7 +1428,7 @@ void BuildManager::readSettings(QSettings &settings)
1428
1428
1429
1429
int md = dvi2pngMode;
1430
1430
#ifdef NO_POPPLER_PREVIEW
1431
- if (md == DPM_EMBEDDED_PDF || md == DPM_LUA_EMBEDDED_PDF)
1431
+ if (md == DPM_EMBEDDED_PDF || md == DPM_LUA_EMBEDDED_PDF || md == DPM_XE_EMBEDDED_PDF )
1432
1432
md = -1 ;
1433
1433
#endif
1434
1434
if (md < 0 ) {
@@ -1811,6 +1811,8 @@ void BuildManager::preview(const QString &preamble, const PreviewSource &source,
1811
1811
p = newProcessInternal (QString (" %1 -interaction=nonstopmode -ini \" &pdflatex %2 \\ dump\" " ).arg (getCommandInfo (CMD_PDFLATEX).getProgramName (),preambleFormatFile), QFileInfo (tf->fileName ())); // no delete! goes automatically
1812
1812
} else if (dvi2pngMode == DPM_LUA_EMBEDDED_PDF) {
1813
1813
p = newProcessInternal (QString (" %1 -interaction=nonstopmode -ini \" &lualatex %2 \\ dump\" " ).arg (getCommandInfo (CMD_LUALATEX).getProgramName (),preambleFormatFile), QFileInfo (tf->fileName ())); // no delete! goes automatically
1814
+ } else if (dvi2pngMode == DPM_XE_EMBEDDED_PDF) {
1815
+ p = newProcessInternal (QString (" %1 -interaction=nonstopmode -ini \" &xelatex %2 \\ dump\" " ).arg (getCommandInfo (CMD_XELATEX).getProgramName (),preambleFormatFile), QFileInfo (tf->fileName ())); // no delete! goes automatically
1814
1816
} else {
1815
1817
p = newProcessInternal (QString (" %1 -interaction=nonstopmode -ini \" &latex %2 \\ dump\" " ).arg (getCommandInfo (CMD_LATEX).getProgramName (),preambleFormatFile), QFileInfo (tf->fileName ())); // no delete! goes automatically
1816
1818
}
@@ -1880,6 +1882,15 @@ void BuildManager::preview(const QString &preamble, const PreviewSource &source,
1880
1882
command = command.insert (pgm.length (), " -fmt=" + preambleFormatFile);
1881
1883
}
1882
1884
p1 = firstProcessOfDirectExpansion (command, QFileInfo (ffn)); // no delete! goes automatically
1885
+ } else if (dvi2pngMode == DPM_XE_EMBEDDED_PDF) {
1886
+ // start conversion
1887
+ // tex -> pdf
1888
+ QString command = getCommandInfo (CMD_XELATEX).commandLine ;
1889
+ if (preambleFormatFile != " " ) {
1890
+ QString pgm = getCommandInfo (CMD_XELATEX).getProgramName ();
1891
+ command = command.insert (pgm.length (), " -fmt=" + preambleFormatFile);
1892
+ }
1893
+ p1 = firstProcessOfDirectExpansion (command, QFileInfo (ffn)); // no delete! goes automatically
1883
1894
} else {
1884
1895
// start conversion
1885
1896
// tex -> dvi
@@ -2111,6 +2122,20 @@ void BuildManager::latexPreviewCompleted(int status)
2111
2122
emit previewAvailable (fn, previewFileNameToSource[processedFile]);
2112
2123
}
2113
2124
}
2125
+ if (dvi2pngMode == DPM_XE_EMBEDDED_PDF) {
2126
+ ProcessX *p1 = qobject_cast<ProcessX *> (sender ());
2127
+ if (!p1) return ;
2128
+ QString processedFile = p1->getFile ();
2129
+ if (processedFile.endsWith (" .tex" ))
2130
+ processedFile = QDir::fromNativeSeparators (parseExtendedCommandLine (" ?am.tex" , QFileInfo (processedFile)).constFirst ());
2131
+ // TODO: fromNativeSeparators is a workaround to fix bug
2132
+ // yields different dir separators depending on the context. This should be fixed (which direction?).
2133
+ // Test (on win): switch preview between dvipng and pdflatex
2134
+ QString fn = parseExtendedCommandLine (" ?am).pdf" , QFileInfo (processedFile)).constFirst ();
2135
+ if (QFileInfo::exists (fn)) {
2136
+ emit previewAvailable (fn, previewFileNameToSource[processedFile]);
2137
+ }
2138
+ }
2114
2139
}
2115
2140
2116
2141
// dvi to ps conversion is finished, call ghostscript to make a useable png from it
0 commit comments