question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing SVG density affect text scaling

See original GitHub issue

I’m not sure if this is a bug or intended functionality but if I renderer the following SVG with different densities the text is scaled out of proportions.

If it’s intended, how do I create a text that can scale with the image?

<svg viewBox="0 0 100 24" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="#4CBB17"/><text xmlns="http://www.w3.org/2000/svg" x="50%" y="75%" font-size="100%" fill="#000000" text-anchor="middle" font-family="Arial,Helvetica">Fancy text</text></svg>

density: 72 image

density: 144 image

density: 288 image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Mar 19, 2019

sharp v0.22.0 now available, providing libvips v8.7.4 and librsvg v2.45.5.

0reactions
uditaliascommented, Feb 19, 2019

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Scale SVG | CSS-Tricks
Here, she shares an epic guide to scaling SVG, covering all the ways you ... the text inside to scale when you change...
Read more >
SVG: fixed font size - Stack Overflow
The short answer is no. If the text is in an SVG with a viewBox , and the SVG gets scaled, its contents...
Read more >
SVG scaling on import and export - MuseScore
SVG Export currently does no scaling relative to MuseScore::physicalDotsPerInch(). So, when you view the exported SVG in your browser or other ...
Read more >
convert svg to png; font size changes with density - ImageMagick
BAD IDEA.. Specifying in pixels means you loose the ability to scale the image for different densities. The problem sounds like the SVG...
Read more >
T36947 Incorrect text positioning in SVG rasterization (scale ...
I don't know if it is relevant, but the Bosch Composition.svg text was stroked. Stroked text can grow or shrink depending on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found