Skip to content

Commit 9b97cf3

Browse files
authored
Fix curve parameter extraction once more
The switch from `preg_match_all` to `preg_split` in PR #855 broke parsing of "optimized" svg paths. In these, the "-" can be used as delimiter between numbers as well.
1 parent e1e2ade commit 9b97cf3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tcpdf.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23726,10 +23726,8 @@ protected function SVGPath($d, $style='') {
2372623726
$params = array();
2372723727
if (isset($val[2])) {
2372823728
// get curve parameters, see https://github.com/tecnickcom/TCPDF/issues/767
23729-
$rawparams = preg_split('/([\,\s]+)/si', trim($val[2]));
23730-
$rawparams = array_filter($rawparams, function($p) {
23731-
return trim($p) != '';
23732-
});
23729+
preg_match_all('/[+-]?(?:\d*\.\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?/', trim($val[2]), $matches);
23730+
$rawparams = $matches[0];
2373323731
$params = array();
2373423732
foreach ($rawparams as $ck => $cp) {
2373523733
$params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false);

0 commit comments

Comments
 (0)