Menu

#1130 SVG closepath bug

v1.0_(example)
open
nobody
None
1
2017-03-15
2017-03-15
Nong LO
No

When SVG is using a closepath command, TCPDF is not resetting coords to the beginning of the subpath.

I successfully tried a path in the SVGPath function to memorise the initial coords of the subpath and to reset the coords when closepath is issued.

                case 'M': { // moveto
                    foreach ($params as $ck => $cp) {
                        if (($ck % 2) == 0) {
                            $x = $cp + $xoffset;
                        } else {
                            $y = $cp + $yoffset;
                            if ($firstcmd OR (abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
                                if ($ck == 1) {
                                    $this->_outPoint($x, $y);
                                    $firstcmd = false;
                                } else {
                                    $this->_outLine($x, $y);
                                }
                                $x0 = $x;
                                $y0 = $y;
                            }
                            $xmin = min($xmin, $x);
                            $ymin = min($ymin, $y);
                            $xmax = max($xmax, $x);
                            $ymax = max($ymax, $y);
                            if ($relcoord) {
                                $xoffset = $x;
                                $yoffset = $y;
                            }
                        }
                    }
                    $sx = $x;
                    $sy = $y;
                    break;
                }
                case 'Z': {
                    $this->_out('h');
                    $x = $sx;
                    $y = $sy;
                    break;
                }
1 Attachments

Discussion


Log in to post a comment.