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.

Stroke-width and BoundingBox

See original GitHub issue

Hi, I’ve a simple text with the stroke-width parameter set at “0.001px”, when I try to render this into the WpfTestSvgSample I have a bounding box bigger that my text. If I set the parameter at “0.002px” or bigger the issue disappear. I try to find the error in the code but I still don’t know where it could be.

I try to solve it by adding a simple line into the GetStrokeWidth() function strokeWidthLength.Value = Math.Max(strokeWidthLength.Value, 0.002); but I know it’s an orrible solution.

Have you any solution for this?

Thanks

M1OUHAVlbQ

text_test.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
LucaPassarellacommented, Nov 8, 2020

I found another case with the same problem, and the fix does not work. Probably it’s due to the position of the red circle.

file.zip

0reactions
paulushubcommented, Nov 8, 2020

@LucaPassarella Yes, it was clear. On investigating, I found it was resulting from the translation transform applied after the drawing is rendered to try and position it within the viewbox. As I stated, it was a work around the issue, since I could not tell why applying the transform changes the size in such case. What I did was to get the size of the drawing before and after applying the transform, if it changes, I discard the transform all together.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the bounding box of an SVG line or path ...
If I have a line with a stroke width of x, the height or width of the line should account for it. In...
Read more >
Stroke width not being taken into account for path ...
Bounding box incorrect: image. Workaround Adding a rectangle to the shape layer (in additon to the path) that's large enough to be outside ......
Read more >
Why does the dimension of an object rely on stroke width?
My current process is to draw the box, change the stroke width to zero, ... Tools "Set Bounding Box to Geometric" is the...
Read more >
SVGGraphicsElement: getBBox() method - Web APIs | MDN
An options dictionary used to control which parts of the element are included in the bounding box. The available options are: fill. A...
Read more >
Unable to compute stroke width variation - MATLAB Answers
Compute the aspect ratio using bounding box data. bbox = vertcat(mserStats.BoundingBox); w = bbox(:,3); h = bbox(:,4); aspectRatio = w.
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