mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix 480937a103708a651/lyxgit. See also #9740.
Actually, the changed tests were used to prevent overwriting the encoding changed in Buffer::writeLaTeX with a language-default encoding. This is still required for XeTeX with TeX-fonts unless a proper solution is found. Documents with more than one encoding and TeX-fonts fail with LuaTeX, as "luainputenc" can only handle one encoding.
This commit is contained in:
parent
3f52e8058c
commit
9894e0be23
@ -1674,8 +1674,9 @@ void Buffer::writeLaTeXSource(otexstream & os,
|
||||
|
||||
// XeTeX with TeX fonts is only safe with ASCII encoding,
|
||||
// See #9740 and FIXME in BufferParams::encoding()
|
||||
// FIXME: when only the current paragraph is shown, this seems to be ignored:
|
||||
// characters encodable in the current encoding are not converted to ASCII-representation.
|
||||
// FIXME: when only the current paragraph is shown, this is ignored and
|
||||
// characters encodable in the current encoding are not converted
|
||||
// to ASCII-representation.
|
||||
if (!params().useNonTeXFonts && (runparams.flavor == OutputParams::XETEX))
|
||||
runparams.encoding = encodings.fromLyXName("ascii");
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ string BufferParams::bufferFormat() const
|
||||
string format = documentClass().outputFormat();
|
||||
if (format == "latex") {
|
||||
if (useNonTeXFonts)
|
||||
return "xetex"; // FIXME: why not "luatex"?
|
||||
return "xetex"; // actually "xetex or luatex"
|
||||
if (encoding().package() == Encoding::japanese)
|
||||
return "platex";
|
||||
}
|
||||
@ -3141,11 +3141,14 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
|
||||
|
||||
Encoding const & BufferParams::encoding() const
|
||||
{
|
||||
// FIXME: additionally, we must check for runparams().flavor == XeTeX
|
||||
// or runparams.isFullUnicode() to care for the combination
|
||||
// of XeTeX and TeX-fonts (see #9740).
|
||||
// Currently, we reset the encoding in Buffer::makeLaTeXFile
|
||||
// (for export) and Buffer::writeLaTeXSource (for preview).
|
||||
// FIXME: For export with XeTeX and TeX fonts,
|
||||
// this function returns the wrong value.
|
||||
// The combination of XeTeX and TeX-fonts requires ASCII (see #9740).
|
||||
// However, the flavor is no buffer parameter but only known once export started.
|
||||
// Currently, we set runparams.encoding to ASCII in Buffer::makeLaTeXFile
|
||||
// (for export) and Buffer::writeLaTeXSource (for preview)
|
||||
// and prevent overwriting it with another encoding in Paragraph::latex
|
||||
// and at four places in output_latex.cpp.
|
||||
if (useNonTeXFonts)
|
||||
return *(encodings.fromLyXName("utf8-plain"));
|
||||
if (inputenc == "auto" || inputenc == "default")
|
||||
|
@ -2567,7 +2567,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
||||
if (allowcust && d->endTeXParParams(bparams, os, runparams)
|
||||
&& runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useNonTeXFonts)
|
||||
if (runparams.flavor != OutputParams::XETEX) // see BufferParams::encoding
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ static void finishEnvironment(otexstream & os, OutputParams const & runparams,
|
||||
state->prev_env_language_ = data.par_language;
|
||||
if (runparams.encoding != data.prev_encoding) {
|
||||
runparams.encoding = data.prev_encoding;
|
||||
//if (!bparams.useNonTeXFonts) // FIXME just for speedup, would require passing of "buf" as argument
|
||||
if (runparams.flavor != OutputParams::XETEX) // see BufferParams::encoding
|
||||
os << setEncoding(data.prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -259,7 +259,7 @@ static void finishEnvironment(otexstream & os, OutputParams const & runparams,
|
||||
state->prev_env_language_ = data.par_language;
|
||||
if (runparams.encoding != data.prev_encoding) {
|
||||
runparams.encoding = data.prev_encoding;
|
||||
//if (!bparams.useNonTeXFonts) //FIXME just for speedup
|
||||
if (runparams.flavor != OutputParams::XETEX) // see BufferParams::encoding
|
||||
os << setEncoding(data.prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -884,7 +884,7 @@ void TeXOnePar(Buffer const & buf,
|
||||
latexArgInsets(par, os, runparams, style.postcommandargs(), "post:");
|
||||
if (runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useNonTeXFonts)
|
||||
if (runparams.flavor != OutputParams::XETEX) // see BufferParams::encoding
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -1049,7 +1049,8 @@ void TeXOnePar(Buffer const & buf,
|
||||
if (runparams.isLastPar && runparams_in.local_font != 0
|
||||
&& runparams_in.encoding != runparams_in.local_font->language()->encoding()
|
||||
&& (bparams.inputenc == "auto" || bparams.inputenc == "default")
|
||||
&& !bparams.useNonTeXFonts) {
|
||||
&& runparams.flavor != OutputParams::XETEX // see BufferParams::encoding
|
||||
) {
|
||||
runparams_in.encoding = runparams_in.local_font->language()->encoding();
|
||||
os << setEncoding(runparams_in.encoding->iconvName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user