W3C SVG Strokes introduces stroke-dashadjust
but no browser implements it yet.
Adobe Illustrator's stroke panel has a button for this feature – its tooltip reads Aligns dashes to corners and path ends, adjusting lengths to fit
When you set it and export SVG what it does is take your initial settings, say 0pt dash, 5pt gap
and tweak them, outputting a stroke-dasharray
attribute like 0,4.9121
.
I wanted to use this for connecting text with plots on charts, before support for this new attribute arrives in browsers. My use case only involved straight lines (so not worrying about paths with corners yet): connecting label text with bars in a bar chart.
More details:
Proposals/Stroke dash adjustment - SVG