meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
135 stars 29 forks source link

Use object matrix compounds wrong if original def values have contributory matrix. #192

Closed tatarize closed 2 years ago

tatarize commented 2 years ago
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="109.322295pt" height="27.66092pt" viewBox="0 0 109.322295 27.66092" xmlns="http://www.w3.org/2000/svg" version="1.1">
 <g id="figure_1">
  <g id="text_1">
   <g transform="translate(0 21.294961)scale(0.3 -0.3)">
    <defs>
     <path id="CMMI12-45" d="M 4448 1489 
C 4454 1508 4474 1554 4474 1579 
C 4474 1611 4448 1643 4410 1643 
C 4384 1643 4371 1637 4352 1617 
C 4339 1611 4339 1598 4282 1469 
C 3904 570 3629 185 2605 185 
L 1670 185 
C 1581 185 1568 185 1530 192 
C 1459 198 1453 211 1453 262 
C 1453 307 1466 345 1478 403 
L 1920 2176 
L 2554 2176 
C 3053 2176 3091 2066 3091 1874 
C 3091 1810 3091 1752 3046 1560 
C 3034 1534 3027 1508 3027 1489 
C 3027 1444 3059 1425 3098 1425 
C 3155 1425 3162 1469 3187 1559 
L 3552 3042 
C 3552 3073 3526 3105 3488 3105 
C 3430 3105 3424 3080 3398 2990 
C 3270 2501 3142 2361 2573 2361 
L 1965 2361 
L 2362 3930 
C 2419 4154 2432 4154 2694 4154 
L 3610 4154 
C 4397 4154 4557 3943 4557 3458 
C 4557 3451 4557 3273 4531 3062 
C 4525 3036 4518 2998 4518 2985 
C 4518 2934 4550 2915 4589 2915 
C 4634 2915 4659 2941 4672 3055 
L 4806 4174 
C 4806 4195 4819 4263 4819 4277 
C 4819 4352 4762 4352 4646 4352 
L 1523 4352 
C 1402 4352 1338 4352 1338 4229 
C 1338 4154 1382 4154 1491 4154 
C 1888 4154 1888 4114 1888 4052 
C 1888 4020 1882 3994 1862 3924 
L 998 473 
C 941 249 928 185 480 185 
C 358 185 294 185 294 70 
C 294 0 333 0 461 0 
L 3674 0 
C 3814 0 3821 6 3866 110 
L 4448 1489 
z
" transform="scale(0.015625)"/>
    </defs>
    <use xlink:href="#CMMI12-45" id="use1" transform="scale(0.996264)"/>
   </g>
  </g>
 </g>
</svg>'''

Is rendered wrongly because the matrix from the group as well as the viewport and even the original parse routine is utilized twice. The use references the use object rather than the use xml.