]> git.lyx.org Git - features.git/commitdiff
Don't switch encodings when a document wide encoding is specified.
authorGünter Milde <milde@lyx.org>
Wed, 27 Feb 2019 13:01:53 +0000 (14:01 +0100)
committerGünter Milde <milde@lyx.org>
Thu, 28 Feb 2019 21:55:43 +0000 (22:55 +0100)
Remove special code for CJK that is no longer required after
we use CJKutf8 document-wide with inputenc "utf8-cjk"
(and "utf8" for languages requiring CJK) (since 7bbf333fa100).

CJK characters can no longer be used with a document-wide 8-bit encoding.
(Hint: Use utf8-cjk or one of the CJK legacy encodings if your document contains CJK characters.)

src/output_latex.cpp

index 8beb09623b562cb336a335dfa39362897c787b5e..07007cce1d444c3d6d54423e245b77de977e6ea2 100644 (file)
@@ -1418,7 +1418,7 @@ void latexParagraphs(Buffer const & buf,
                                && bparams.language->encoding()->package() == Encoding::CJK)
                                //  FIXME: should test if any language requires CJK
                                //  && LaTeXFeatures::mustProvide("CJK"))
-                               // error: cannot call member function ‘bool lyx::LaTeXFeatures::mustProvide(const string&) const’ without object 
+                               // error: cannot call member function ‘bool lyx::LaTeXFeatures::mustProvide(const string&) const’ without object
                   )) {
                docstring const cjkenc = bparams.encoding().iconvName() == "UTF-8"
                                                                 ? from_ascii("UTF8") : from_ascii(bparams.encoding().latexName());
@@ -1611,14 +1611,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
 
        Encoding const & oldEnc = *runparams.encoding;
        bool moving_arg = runparams.moving_arg;
-       // If we switch from/to CJK, we need to switch anyway, despite custom inputenc,
-       // except if we use CJKutf8 or explicitely set inputenc to a CJK encoding
-       bool const from_to_cjk =
-               ((oldEnc.package() == Encoding::CJK && newEnc.package() != Encoding::CJK)
-                || (oldEnc.package() != Encoding::CJK && newEnc.package() == Encoding::CJK))
-               && bparams.encoding().iconvName() != "UTF8"
-               && bparams.encoding().package() != Encoding::CJK;
-       if (!force && !from_to_cjk
+       if (!force
            && ((bparams.inputenc != "auto" && bparams.inputenc != "default") || moving_arg))
                return make_pair(false, 0);
 
@@ -1692,9 +1685,8 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
                                os << "\\egroup";
                                count += 7;
                        }
-                       docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
-                                                                         ? from_ascii("UTF8") : from_ascii(newEnc.latexName()));
-                       os << "\\begin{CJK}{" << cjkenc << "}{"
+                       os << "\\begin{CJK}{"
+                          << from_ascii(newEnc.latexName()) << "}{"
                           << from_ascii(bparams.fonts_cjk) << "}";
                        state->open_encoding_ = CJK;
                        return make_pair(true, count + 15);