[svgwg] stroke-linecap and markers (#798)

GLRoylance has just created a new issue for https://github.com/w3c/svgwg:

== stroke-linecap and markers ==
* https://www.w3.org/TR/SVG2/painting.html#LineCaps

The `stroke-linecap` attribute may be `butt`, `round`, or `square`.

It should have another value of something such as `short`. The property means the line starts and ends about a stroke width away from its starting and ending points. (We could even have a `shortStart` and `shortEnd` or `shortMarker` (line is shortened if a marker will be drawn.)

Consider the problem of drawing a dimension line with sharp arrows at the end. Say the dimension line should end at (100,0) with a sharp arrow. The arrow is defined as a marker and invoked with `marker-end="url(#arrow)"`. Make the stroke width for the line 20px to emphasize the problem.

The the ending arrow point will not be sharp because the wide line will cover the arrow point; instead of a 0 width ending point, the ending width will be the 20px line width. To get around this problem, the user must make the dimension line shorter by about the stroke width. Instead of drawing the line to (100, 0), the user must draw the line to (80,0) and then fudge the marker to extend 20px past the end point.

There are some other uglies. if the marker scales by stroke width, then increasing the stroke width requires the endpoint of the line to be moved back.

It would be easier if setting `stroke-linecap` to `short` would just not draw the last `stroke-width` of the line.

Next consider `orient="auto"`.  If the endpoint of a line needs to be shortened to make a sharp arrow, then the direction of `auto` will be slightly off. Say we have a 90-degree circular arc starting at (0, -100) and bending upward to end at (100,0). The ending tangent points straight up. If I shorten the arc to get a sharp arrow point ending at (100,0), then `auto` will give a direction that is not parallel to the y-axis but rather pointed a little bit to the right.

Drawing short lines would give cleaner geometry because lines could start and end at their obvious positions.



Please view or discuss this issue at https://github.com/w3c/svgwg/issues/798 using your GitHub account

Received on Sunday, 17 May 2020 23:28:58 UTC