length/bounding box of open butt cap lines too large

Bug #165935 reported by Jaspervdg
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Krzysztof Kosinski

Bug Description

If you select an open line, the length that's reported
by InkScape is too large. A simple demo is something
like this:
<svg width="100mm" height="100mm" viewBox="0 0 100 100"
version="1.1">
  <g fill="none" stroke="black" stroke-width="2" >
    <line x1="1" y1="0" x2="1" y2="100" />
  </g>
</svg>
InkScape will say the line is 2mm wide (InkScape
includes the stroke width, which is fine here) and
102mm high, which is 2mm too high.
I got the following response on the mailinglist (by
"bulia byak"):
<quote>
It's a bug. Lines' bboxes extend beyond line ends by
the line width.
This is because the bbox is now calculated simply by
adding half the
stroke width to all 4 sides of the without-stroke bbox,
but in this
case (for unclosed horizontal line) it should be added
only to the top
and bottom. It is a very difficult bug to fix because
we currently
have no code to reliably determine how far the stroke
of a given shape
extends, which may be affected not only by stroke width
but also by
(as in your case) shape orientation and closeness, join
and cap types,
and miter limit.
</quote>

Tags: selection svg
Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Raising priority because this makes it impossible to do
pattern fill with lines without gaps.

Revision history for this message
Peter Moulder (pjrm) wrote :

Re pattern fill: the workaround is to change line cap to square.
(Leaving priority unchanged.)

Revision history for this message
Peter Moulder (pjrm) wrote :

The simplest implementation would be to use stroke-to-path
(sp_selected_path_outline in splivarot.cpp) and take bbox of
the result. Would require splitting out the relevant bits
of sp_selected_path_outline.

Hystrix (hystrix-)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Fix committed in r10589 with the removal of libnr, see
<http://article.gmane.org/gmane.comp.graphics.inkscape.devel/37154>

Changed in inkscape:
assignee: nobody → Krzysztof Kosinski (tweenk)
milestone: none → 0.49
status: Confirmed → Fix Committed
su_v (suv-lp)
tags: added: selection
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.