Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect viewbox translate #115

Open
WarWithinMe opened this issue Aug 8, 2020 · 1 comment
Open

Incorrect viewbox translate #115

WarWithinMe opened this issue Aug 8, 2020 · 1 comment

Comments

@WarWithinMe
Copy link
Contributor

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:

graphicStyle.transform->Translate(-1 * mViewBox[0], -1 * mViewBox[1]);
graphicStyle.transform->Scale(scale, scale);

@dirkschulze
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants