filter/source/svg/units.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit fa17cfd7e006c73f1360a5a974f38d9875f347c5 Author: Xisco Fauli <aniste...@gmail.com> Date: Wed Nov 25 20:03:19 2015 +0100 tdf#96046 SVG: Parse 'em' and 'ex' units correctly the problem is that real_p parses the 'e' in 'em' and 'ex' as the exponential operator instead of as a str. Change it to parse sequencies like: (11) (1.1) (1,1) (.1) (,1) (1.) (1,) but now the parser returns a std::string so we need to convert it to double, and make sure the commas are converted to dots too. Change-Id: I913be7975e7db1be4773f528fd0d586db67c9461 Reviewed-on: https://gerrit.libreoffice.org/20181 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/filter/source/svg/units.cxx b/filter/source/svg/units.cxx index d0165b1..691305e 100644 --- a/filter/source/svg/units.cxx +++ b/filter/source/svg/units.cxx @@ -71,12 +71,12 @@ double convLength( const OUString& sValue, const State& rState, char dir ) OString aUTF8 = OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ); - double nVal=0.0; + std::string sVal; SvgUnit eUnit=SVG_LENGTH_UNIT_PX; const bool bRes = parse(aUTF8.getStr(), // Begin grammar ( - real_p[assign_a(nVal)] + (*digit_p >> *((str_p(".") | str_p(",")) >> *digit_p))[assign_a(sVal)] >> ( str_p("cm") [assign_a(eUnit,SVG_LENGTH_UNIT_CM)] | str_p("em") [assign_a(eUnit,SVG_LENGTH_UNIT_EM)] | str_p("ex") [assign_a(eUnit,SVG_LENGTH_UNIT_EX)] @@ -95,7 +95,9 @@ double convLength( const OUString& sValue, const State& rState, char dir ) if( !bRes ) return 0.0; - return convLength(nVal,eUnit,rState,dir); + OUString oVal = OUString::createFromAscii(sVal.c_str()).replaceAll(",","."); + + return convLength(oVal.toDouble(),eUnit,rState,dir); } } // namespace svgi
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits