]> git.lyx.org Git - features.git/commitdiff
Fix PDF output of clipped graphics with recent graphics package
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 12 Oct 2017 13:38:59 +0000 (15:38 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 13 Oct 2017 06:31:37 +0000 (08:31 +0200)
The previous redirection of the senseless option "bb" to "viewport" in
PDFLaTeX output has been removed in a recent graphics package update.

This breaks documents, since clipped graphics silently stop displaying.

This change restores the previous output by using "viewport" instaed of
"bb" for non-PS/DVI output, while leaving PS/DVI untouched (where "bb"
and "viewport" behave differently.

Fixes: #7910
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h
status.22x

index 92203620b420b80337a30c054ba551635c7c551d..62740f21401c58724ec5861a01d1eedc65e83cd3 100644 (file)
@@ -304,17 +304,19 @@ void InsetGraphics::read(Lexer & lex)
 }
 
 
-string InsetGraphics::createLatexOptions() const
+string InsetGraphics::createLatexOptions(bool const ps) const
 {
        // Calculate the options part of the command, we must do it to a string
        // stream since we might have a trailing comma that we would like to remove
        // before writing it to the output stream.
        ostringstream options;
-       if (!params().bbox.empty())
-               options << "bb=" << params().bbox.xl.asLatexString() << ' '
+       if (!params().bbox.empty()) {
+               string const key = ps ? "bb=" : "viewport=";
+               options << key << params().bbox.xl.asLatexString() << ' '
                        << params().bbox.yb.asLatexString() << ' '
                        << params().bbox.xr.asLatexString() << ' '
                        << params().bbox.yt.asLatexString() << ',';
+       }
        if (params().draft)
            options << "draft,";
        if (params().clip)
@@ -765,7 +767,9 @@ void InsetGraphics::latex(otexstream & os,
        before += "\\includegraphics";
 
        // Write the options if there are any.
-       string const opts = createLatexOptions();
+       bool const ps = runparams.flavor == OutputParams::LATEX
+               || runparams.flavor == OutputParams::DVILUATEX;
+       string const opts = createLatexOptions(ps);
        LYXERR(Debug::GRAPHICS, "\tOpts = " << opts);
 
        if (!opts.empty() && !message.empty())
index 5270f2bfa9f9497109e510de965719fafaa9cda7..dae9602433e6bb2f3cece6a0d951f536897c351f 100644 (file)
@@ -112,7 +112,7 @@ private:
        /// Get the status message, depends on the image loading status.
        std::string statusMessage() const;
        /// Create the options for the latex command.
-       std::string createLatexOptions() const;
+       std::string createLatexOptions(bool const ps) const;
        /// Create length values for docbook export.
        docstring toDocbookLength(Length const & len) const;
        /// Create the atributes for docbook export.
index 91a8a3ec63f99e9b3d402de01a1564dab4960ad3..25416e173044deed2f1321691c689a88726d32ce 100644 (file)
@@ -49,6 +49,8 @@ What's new
 
 - Catch "! Incomplete \if[x]" LaTeX error (bug 10666).
 
+- Fix PDF output of clipped graphics with recent graphics package (bug 7910).
+
 - Catch xdvipdfmx driver error that breaks XeTeX compilation (bug 10076).
 
 - Fix caption handling in listings insets when it is split into multiple