]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTransforms.cpp
Handle the case of TeX fonts LuaTeX
[lyx.git] / src / insets / ExternalTransforms.cpp
index 2ca1fceda3c50be6365d50e83a0d88a863358639..e7c8cf66c317967c74d7ef39dfa3284c59482cb4 100644 (file)
 
 #include "ExternalTransforms.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
-
 #include "support/lstrings.h"
 #include "support/lyxlib.h" // float_equal
-#include "support/convert.h"
 #include "support/Translator.h"
 
-#include <boost/regex.hpp>
+#include "support/regex.h"
 
 #include <cmath> // abs
 #include <sstream>
@@ -219,7 +218,10 @@ string const  ClipLatexOption::option_impl() const
 
        ostringstream os;
        if (!data.bbox.empty())
-               os << "bb=" << data.bbox << ',';
+               os << "bb=" << data.bbox.xl.asLatexString() << ' '
+                  << data.bbox.yb.asLatexString() << ' '
+                  << data.bbox.xr.asLatexString() << ' '
+                  << data.bbox.yt.asLatexString() << ',';
        if (data.clip)
                os << "clip,";
        return os.str();
@@ -280,10 +282,10 @@ string const sanitizeLatexOption(string const & input)
        // Strip any leading commas
        // "[,,,,foo..." -> "foo..." ("foo..." may be empty)
        string output;
-       boost::smatch what;
-       static boost::regex const front("^( *[[],*)(.*)$");
+       lyx::smatch what;
+       static lyx::regex const front("^( *\\[,*)(.*)$");
 
-       regex_match(it, end, what, front, boost::match_partial);
+       regex_match(it, end, what, front);
        if (!what[0].matched) {
                lyxerr << "Unable to sanitize LaTeX \"Option\": "
                       << input << '\n';
@@ -294,9 +296,9 @@ string const sanitizeLatexOption(string const & input)
        // Replace any consecutive commas with a single one
        // "foo,,,,bar" -> "foo,bar"
        // with iterator now pointing to 'b'
-       static boost::regex const commas("([^,]*)(,,*)(.*)$");
+       static lyx::regex const commas("([^,]*)(,,*)(.*)$");
        for (; it != end;) {
-               regex_match(it, end, what, commas, boost::match_partial);
+               regex_match(it, end, what, commas);
                if (!what[0].matched) {
                        output += string(it, end);
                        break;
@@ -307,7 +309,9 @@ string const sanitizeLatexOption(string const & input)
 
        // Strip any trailing commas
        // "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
-       static boost::regex const back("^(.*[^,])?,*[]] *$");
+       static lyx::regex const back("^(.*[^,])?,*\\] *$");
+       // false positive from coverity
+       // coverity[CHECKED_RETURN]
        regex_match(output, what, back);
        if (!what[0].matched) {
                lyxerr << "Unable to sanitize LaTeX \"Option\": "
@@ -317,7 +321,7 @@ string const sanitizeLatexOption(string const & input)
        output = what.str(1);
 
        // Remove any surrounding whitespace
-       output = support::trim(output);
+       output = trim(output);
 
        // If the thing is empty, leave it so, else wrap it in square brackets.
        return output.empty() ? output : "[" + output + "]";
@@ -334,7 +338,7 @@ void extractIt(boost::any const & any_factory,
                return;
 
        Factory factory = boost::any_cast<Factory>(any_factory);
-       if (!factory.empty())
+       if (factory)
                transformer = factory(data);
 }