mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Don't force encoding switch for Japanese "listings" auto-strings.
listings copes with variable-width encodings under platex.
This commit is contained in:
parent
6eb9452836
commit
6dd505c67a
@ -738,6 +738,10 @@ Encoding const * DocIterator::getEncoding() const
|
||||
if (bp.useNonTeXFonts)
|
||||
return encodings.fromLyXName("utf8-plain");
|
||||
|
||||
// With platex, we don't switch encodings (not even if forced).
|
||||
if (bp.encoding().package() == Encoding::japanese)
|
||||
return &bp.encoding();
|
||||
|
||||
CursorSlice const & sl = innerTextSlice();
|
||||
Text const & text = *sl.text();
|
||||
Language const * lang =
|
||||
@ -777,7 +781,7 @@ Encoding const * DocIterator::getEncoding() const
|
||||
otext.outerFont(slices_[i].pit())).language();
|
||||
// Again, if we have a custom encoding, this is used
|
||||
// instead of the language's.
|
||||
Encoding const * oenc = customenc
|
||||
Encoding const * oenc = customenc
|
||||
? &bp.encoding() : olang->encoding();
|
||||
if (olang->encoding()->name() != "inherit")
|
||||
return oenc;
|
||||
|
@ -230,8 +230,8 @@ pair<docstring, docstring> Encoding::latexString(docstring const & input, bool d
|
||||
docstring uncodable;
|
||||
bool terminate = false;
|
||||
for (size_t n = 0; n < input.size(); ++n) {
|
||||
char_type const c = input[n];
|
||||
try {
|
||||
char_type const c = input[n];
|
||||
pair<docstring, bool> latex_char = latexChar(c);
|
||||
docstring const latex = latex_char.first;
|
||||
if (terminate && !prefixIs(latex, '\\')
|
||||
@ -248,7 +248,8 @@ pair<docstring, docstring> Encoding::latexString(docstring const & input, bool d
|
||||
result += latex;
|
||||
terminate = latex_char.second;
|
||||
} catch (EncodingException & /* e */) {
|
||||
LYXERR0("Uncodable character in latexString!");
|
||||
LYXERR0("Uncodable character <" << docstring(1, c)
|
||||
<< "> in latexString!");
|
||||
if (dryrun) {
|
||||
result += "<" + _("LyX Warning: ")
|
||||
+ _("uncodable character") + " '";
|
||||
|
@ -1913,9 +1913,11 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
|
||||
// encodings, only with fixed width encodings. Therefore we
|
||||
// need to force a fixed width encoding for
|
||||
// \lstlistlistingname and \lstlistingname (bug 9382).
|
||||
// This needs to be consistent with InsetListings::latex().
|
||||
// This needs to be consistent with InsetListings::latex()
|
||||
// rsp. InsetListings::forcedEncoding().
|
||||
bool const need_fixedwidth = !use_minted &&
|
||||
!runparams_.isFullUnicode() &&
|
||||
buffer().params().encoding().package() != Encoding::japanese &&
|
||||
it->second.fixedwidthpreambleencoding();
|
||||
// language dependent commands (once per document)
|
||||
snippets.insert(i18npreamble(it->second.langpreamble(),
|
||||
|
@ -127,7 +127,7 @@ Encoding const * InsetListings::forcedEncoding(Encoding const * inner_enc,
|
||||
// Minted can deal with all encodings.
|
||||
if (buffer().params().use_minted
|
||||
|| inner_enc->name() == "utf8-plain"
|
||||
|| buffer().params().encoding().package() == Encoding::japanese
|
||||
|| inner_enc->package() == Encoding::japanese
|
||||
|| inner_enc->hasFixedWidth())
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user