mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
further xetex disambiguation: use the flavor where the flavor is apt.
This introduces an isFullUnicode() function to OutputParams that currently only contains XETEX, but later can also contain other fully unicode-aware backends (LUATEX for instance). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36445 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d165b5ea51
commit
fc9c1494ce
@ -1359,9 +1359,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
// set font encoding
|
||||
// for arabic_arabi and farsi we also need to load the LAE and
|
||||
// LFE encoding
|
||||
// XeTeX works without fontenc
|
||||
// XeTeX (isFullUnicode() flavor) works without fontenc
|
||||
if (font_encoding() != "default" && language->lang() != "japanese"
|
||||
&& !useXetex && !tclass.provides("fontenc")) {
|
||||
&& !features.runparams().isFullUnicode() && !tclass.provides("fontenc")) {
|
||||
size_t fars = language_options.str().find("farsi");
|
||||
size_t arab = language_options.str().find("arabic");
|
||||
if (language->lang() == "arabic_arabi"
|
||||
@ -1892,7 +1892,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
// these packages (xunicode, for that matter) need to be loaded at least
|
||||
// after amsmath, amssymb, esint and the other packages that provide
|
||||
// special glyphs
|
||||
if (useXetex) {
|
||||
if (features.runparams().flavor == OutputParams::XETEX) {
|
||||
os << "\\usepackage{xunicode}\n";
|
||||
texrow.newline();
|
||||
os << "\\usepackage{xltxtra}\n";
|
||||
@ -2456,7 +2456,8 @@ docstring BufferParams::getGraphicsDriver(string const & package) const
|
||||
void BufferParams::writeEncodingPreamble(odocstream & os,
|
||||
LaTeXFeatures & features, TexRow & texrow) const
|
||||
{
|
||||
if (useXetex)
|
||||
// fully unicode-aware backends (such as XeTeX) do not need this
|
||||
if (features.runparams().isFullUnicode())
|
||||
return;
|
||||
if (inputenc == "auto") {
|
||||
string const doc_encoding =
|
||||
|
@ -48,4 +48,10 @@ bool OutputParams::isLaTeX() const
|
||||
return flavor == LATEX || flavor == PDFLATEX || flavor == XETEX;
|
||||
}
|
||||
|
||||
|
||||
bool OutputParams::isFullUnicode() const
|
||||
{
|
||||
return flavor == XETEX;
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
FLAVOR flavor;
|
||||
/// is it some flavor of LaTeX?
|
||||
bool isLaTeX() const;
|
||||
/// does this flavour support full unicode?
|
||||
bool isFullUnicode() const;
|
||||
|
||||
/// Same, but for math output, which only matter is XHTML output.
|
||||
MathFlavor math_flavor;
|
||||
|
@ -2516,7 +2516,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
||||
if (allowcust && d->endTeXParParams(bparams, os, texrow, runparams)
|
||||
&& runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useXetex)
|
||||
if (!runparams.isFullUnicode())
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
|
||||
|
@ -143,11 +143,12 @@ int InsetListings::latex(odocstream & os, OutputParams const & runparams) const
|
||||
bool encoding_switched = false;
|
||||
Encoding const * const save_enc = runparams.encoding;
|
||||
|
||||
if (runparams.flavor != OutputParams::XETEX
|
||||
if (!runparams.isFullUnicode()
|
||||
&& !runparams.encoding->hasFixedWidth()) {
|
||||
// We need to switch to a singlebyte encoding, since the
|
||||
// listings package cannot deal with multi-byte-encoded
|
||||
// glyphs (not needed with XeTeX).
|
||||
// glyphs (not needed with full-unicode aware backends
|
||||
// such as XeTeX).
|
||||
Language const * const outer_language =
|
||||
(runparams.local_font != 0) ?
|
||||
runparams.local_font->language()
|
||||
|
@ -283,7 +283,7 @@ TeXEnvironment(Buffer const & buf,
|
||||
prev_env_language_ = par_language;
|
||||
if (runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useXetex)
|
||||
if (!runparams.isFullUnicode())
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -294,7 +294,7 @@ TeXEnvironment(Buffer const & buf,
|
||||
prev_env_language_ = par_language;
|
||||
if (runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useXetex)
|
||||
if (!runparams.isFullUnicode())
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -712,7 +712,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
|
||||
os << '}';
|
||||
if (runparams.encoding != prev_encoding) {
|
||||
runparams.encoding = prev_encoding;
|
||||
if (!bparams.useXetex)
|
||||
if (!runparams.isFullUnicode())
|
||||
os << setEncoding(prev_encoding->iconvName());
|
||||
}
|
||||
}
|
||||
@ -865,11 +865,12 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
|
||||
// If this is the last paragraph, and a local_font was set upon entering
|
||||
// the inset, and we're using "auto" or "default" encoding, the encoding
|
||||
// should be set back to that local_font's encoding.
|
||||
// However, do not change the encoding when XeTeX is used.
|
||||
// However, do not change the encoding when a fully unicode aware backend
|
||||
// such as XeTeX is used.
|
||||
if (nextpit == paragraphs.end() && runparams_in.local_font != 0
|
||||
&& runparams_in.encoding != runparams_in.local_font->language()->encoding()
|
||||
&& (bparams.inputenc == "auto" || bparams.inputenc == "default")
|
||||
&& (!bparams.useXetex)) {
|
||||
&& (!runparams.isFullUnicode())) {
|
||||
runparams_in.encoding = runparams_in.local_font->language()->encoding();
|
||||
os << setEncoding(runparams_in.encoding->iconvName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user