]> git.lyx.org Git - lyx.git/commitdiff
Strip polyglossia options from pdf string
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 5 Apr 2020 13:23:22 +0000 (15:23 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 5 Apr 2020 15:29:04 +0000 (17:29 +0200)
Fixes #11813

(cherry picked from commit f9999039ac7278a719513fdd15c34f12846a1189)

src/Buffer.cpp
src/Font.cpp
src/OutputParams.cpp
src/OutputParams.h
status.23x

index 4c43acbb6767bacdd32672cc138dc64e90f5e9b1..3a8fae7a57ade0753671936d2a9bbb3a967a88c0 100644 (file)
@@ -1825,8 +1825,10 @@ void Buffer::writeLaTeXSource(otexstream & os,
        LaTeXFeatures features(*this, params(), runparams);
        validate(features);
        // This is only set once per document (in master)
-       if (!runparams.is_child)
+       if (!runparams.is_child) {
                runparams.use_polyglossia = features.usePolyglossia();
+               runparams.use_hyperref = features.isRequired("hyperref");
+       }
        LYXERR(Debug::LATEX, "  Buffer validation done.");
 
        bool const output_preamble =
@@ -4094,6 +4096,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 ee05efabbe045576788e18180556b59ecaf46c92..5c6526db876cb947075b471183707299bc0a662c 100644 (file)
@@ -288,8 +288,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 5fbbdc3f906f63c0c5850163e59f260147f91889..d203761059bc0305b51f181f3c7b9ff9d99be139 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_babel(false), use_polyglossia(false), use_hyperref(false),
          use_indices(false), use_japanese(false), linelen(0), depth(0),
          exportdata(new ExportData), inDisplayMath(false), wasDisplayMath(false),
          inComment(false), openbtUnit(false), only_childbibs(false),
index cbcca69f1cad68494619001f9ab15790d8261d1d..6366422c16c374b3526537099efb29c5654573ab 100644 (file)
@@ -161,6 +161,10 @@ public:
        */
        bool use_polyglossia;
 
+       /** Do we use hyperref?
+       */
+       bool use_hyperref;
+
        /** Are we generating multiple indices?
        */
        bool use_indices;
index 59b3f06eb6c3ae01c38150c4ab1663c3fe6036d3..23d76afef538126a87622e874370095e31538452 100644 (file)
@@ -61,6 +61,8 @@ What's new
 
 - Fix loading of amsmath in beamer article classes (bug 11768).
 
+- Prevent polyglossia options from being output to PDF TOC (bug 11813).
+
 
 * USER INTERFACE