svg-native-viewer icon indicating copy to clipboard operation
svg-native-viewer copied to clipboard

Incorrect viewbox translate

Open WarWithinMe opened this issue 4 years ago • 1 comments

Given these two images: 1.

<svg
  xmlns="http://www.w3.org/2000/svg" width="105" height="14" role="img" focusable="false" viewBox="0 0 6617 910"
  xmlns:xlink="http://www.w3.org/1999/xlink" vertical-align="-3" stroke="#000" fill="#000" style="">
  <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 705)">
    <g data-mml-node="math">
      <g data-mml-node="mi">
        <path id="MJX-1-TEX-I-1D453" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path>
      </g>
    </g>
  </g>
</svg>
<svg
  xmlns="http://www.w3.org/2000/svg" width="105" height="14" role="img" focusable="false" viewBox="0 -705 6617 910"
  xmlns:xlink="http://www.w3.org/1999/xlink" vertical-align="-3" stroke="#000" fill="#000" style="">
  <g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
    <g data-mml-node="math">
      <g data-mml-node="mi">
        <path id="MJX-1-TEX-I-1D453" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path>
      </g>
    </g>
  </g>
</svg>

Chrome renders these images correctly, that is a character of "f". However, svg-native-viewer failed to render the later one (result is blank image.).

I think it's because of translation and scale are applied inverted here: https://github.com/adobe/svg-native-viewer/blob/1901c27b85e66809144e94b4de86f5b181158b1e/svgnative/src/SVGDocumentImpl.cpp#L968-L969

WarWithinMe avatar Aug 08 '20 02:08 WarWithinMe

@mpsuzuki I see that #112 references this issue. However, I don't see how the 2 are related. Maybe a mistake?

dirkschulze avatar Nov 01 '20 21:11 dirkschulze