mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Adapt creation of preview images to the defaul document output.
Sometimes, even compilable documents could not display preview snippets. Previously the preview was computed only with help of latex or xelatex. This also fixes #9371
This commit is contained in:
parent
13c60bfa78
commit
0bb378ba6a
@ -218,7 +218,7 @@ private:
|
|||||||
/// Called by the ForkedCall process that generated the bitmap files.
|
/// Called by the ForkedCall process that generated the bitmap files.
|
||||||
void finishedGenerating(pid_t, int);
|
void finishedGenerating(pid_t, int);
|
||||||
///
|
///
|
||||||
void dumpPreamble(otexstream &) const;
|
void dumpPreamble(otexstream &, OutputParams::FLAVOR) const;
|
||||||
///
|
///
|
||||||
void dumpData(odocstream &, BitmapFile const &) const;
|
void dumpData(odocstream &, BitmapFile const &) const;
|
||||||
|
|
||||||
@ -568,9 +568,44 @@ void PreviewLoader::Impl::startLoading(bool wait)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
of << "\\batchmode\n";
|
of << "\\batchmode\n";
|
||||||
dumpPreamble(os);
|
|
||||||
|
LYXERR(Debug::LATEX, "Format = " << buffer_.params().getDefaultOutputFormat());
|
||||||
|
string latexparam = "";
|
||||||
|
OutputParams::FLAVOR flavor = buffer_.params().getOutputFlavor();
|
||||||
|
if (buffer_.params().encoding().package() == Encoding::japanese) {
|
||||||
|
latexparam = " --latex=platex";
|
||||||
|
flavor = OutputParams::LATEX;
|
||||||
|
}
|
||||||
|
else if (buffer_.params().useNonTeXFonts) {
|
||||||
|
if (flavor == OutputParams::LUATEX)
|
||||||
|
latexparam = " --latex=lualatex";
|
||||||
|
else {
|
||||||
|
flavor = OutputParams::XETEX;
|
||||||
|
latexparam = " --latex=xelatex";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (flavor) {
|
||||||
|
case OutputParams::PDFLATEX:
|
||||||
|
latexparam = " --latex=pdflatex";
|
||||||
|
break;
|
||||||
|
case OutputParams::XETEX:
|
||||||
|
latexparam = " --latex=xelatex";
|
||||||
|
break;
|
||||||
|
case OutputParams::LUATEX:
|
||||||
|
latexparam = " --latex=lualatex";
|
||||||
|
break;
|
||||||
|
case OutputParams::DVILUATEX:
|
||||||
|
latexparam = " --latex=dvilualatex";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
flavor = OutputParams::LATEX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dumpPreamble(os, flavor);
|
||||||
// handle inputenc etc.
|
// handle inputenc etc.
|
||||||
buffer_.params().writeEncodingPreamble(os, features);
|
// I think, this is already hadled by dumpPreamble(): Kornel
|
||||||
|
// buffer_.params().writeEncodingPreamble(os, features);
|
||||||
of << "\n\\begin{document}\n";
|
of << "\n\\begin{document}\n";
|
||||||
dumpData(of, inprogress.snippets);
|
dumpData(of, inprogress.snippets);
|
||||||
of << "\n\\end{document}\n";
|
of << "\n\\end{document}\n";
|
||||||
@ -598,11 +633,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
|
|||||||
<< " --bg " << theApp()->hexName(bg);
|
<< " --bg " << theApp()->hexName(bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME what about LuaTeX?
|
cs << latexparam;
|
||||||
if (buffer_.params().useNonTeXFonts)
|
|
||||||
cs << " --latex=xelatex";
|
|
||||||
if (buffer_.params().encoding().package() == Encoding::japanese)
|
|
||||||
cs << " --latex=platex";
|
|
||||||
if (buffer_.params().bibtex_command != "default")
|
if (buffer_.params().bibtex_command != "default")
|
||||||
cs << " --bibtex=" << quoteName(buffer_.params().bibtex_command);
|
cs << " --bibtex=" << quoteName(buffer_.params().bibtex_command);
|
||||||
else if (buffer_.params().encoding().package() == Encoding::japanese)
|
else if (buffer_.params().encoding().package() == Encoding::japanese)
|
||||||
@ -712,14 +743,12 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreviewLoader::Impl::dumpPreamble(otexstream & os) const
|
void PreviewLoader::Impl::dumpPreamble(otexstream & os, OutputParams::FLAVOR flavor) const
|
||||||
{
|
{
|
||||||
// Dump the preamble only.
|
// Dump the preamble only.
|
||||||
|
LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << flavor);
|
||||||
OutputParams runparams(&buffer_.params().encoding());
|
OutputParams runparams(&buffer_.params().encoding());
|
||||||
if (buffer_.params().useNonTeXFonts)
|
runparams.flavor = flavor;
|
||||||
runparams.flavor = OutputParams::XETEX;
|
|
||||||
else
|
|
||||||
runparams.flavor = OutputParams::LATEX;
|
|
||||||
runparams.nice = true;
|
runparams.nice = true;
|
||||||
runparams.moving_arg = true;
|
runparams.moving_arg = true;
|
||||||
runparams.free_spacing = true;
|
runparams.free_spacing = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user