]> git.lyx.org Git - features.git/commitdiff
Strip polyglossia options from pdf string
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 5 Apr 2020 13:23:22 +0000 (15:23 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:55 +0000 (15:48 +0200)
Fixes #11813

src/Buffer.cpp
src/Font.cpp
src/OutputParams.cpp
src/OutputParams.h

index ec11ac2c88b3ca433b9d3d04495dec41b4cfc863..4be7e2119701c6a456ee574300d5aa3ffb18c39d 100644 (file)
@@ -1858,6 +1858,7 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
        // This is only set once per document (in master)
        if (!runparams.is_child) {
                runparams.use_polyglossia = features.usePolyglossia();
+               runparams.use_hyperref = features.isRequired("hyperref");
                runparams.use_CJK = features.mustProvide("CJK");
        }
        LYXERR(Debug::LATEX, "  Buffer validation done.");
@@ -4108,6 +4109,7 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
                        LaTeXFeatures features(*this, params(), runparams);
                        validate(features);
                        runparams.use_polyglossia = features.usePolyglossia();
+                       runparams.use_hyperref = features.isRequired("hyperref");
                        // latex or literate
                        otexstream ots(os);
                        // output above
index a6580fda216f3fd51ad175f6dd3061f4f60c7409..c344ac9ea8155a458b3d425f617b0061ac699da7 100644 (file)
@@ -228,8 +228,13 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
            && language() != prev.language()) {
                if (!language()->polyglossia().empty()) {
                        string tmp = "\\text" + language()->polyglossia();
-                       if (!language()->polyglossiaOpts().empty())
+                       if (!language()->polyglossiaOpts().empty()) {
                                tmp += "[" + language()->polyglossiaOpts() + "]";
+                               if (runparams.use_hyperref && runparams.moving_arg)
+                                       // We need to strip the command for
+                                       // the pdf string, see #11813
+                                       tmp = "\\texorpdfstring{" + tmp + "}{}";
+                       }
                        tmp += "{";
                        os << from_ascii(tmp);
                        count += tmp.length();
index d26955e69aa68189bdf414675806102c24a0628f..d10de5ed746307e70284e40d2e954304de319a6b 100644 (file)
@@ -22,7 +22,7 @@ OutputParams::OutputParams(Encoding const * enc)
        : flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false),
          moving_arg(false), intitle(false), inbranch(false), inulemcmd(0),
          local_font(0),master_language(0), encoding(enc), free_spacing(false),
-         use_babel(false), use_polyglossia(false), use_CJK(false),
+         use_babel(false), use_polyglossia(false), use_hyperref(false), use_CJK(false),
          use_indices(false), use_japanese(false), linelen(0), depth(0),
          exportdata(new ExportData), postpone_fragile_stuff(false), inDisplayMath(false),
          wasDisplayMath(false), inComment(false), openbtUnit(false), only_childbibs(false),
index 5503d8b7cd191b1f2c944abd14b69fa18ce320b0..5aa6080de7f0b96fed97fd527661de1eca55958a 100644 (file)
@@ -177,6 +177,10 @@ public:
        */
        bool use_polyglossia;
 
+       /** Do we use hyperref?
+       */
+       bool use_hyperref;
+
        /// Do we use the CJK package?
        bool use_CJK;