Inkscape.org
Beyond the Basics custom line styles
  1. #1
    imrevarga imrevarga @imrevarga

    The line style dialogue has an option "custom". But what then? How do I actually define a custom line style? Shouldn't there be a line style editor to go with that option? If defining custom lines is only possible through xml, can somebody give an example?

  2. #2
    Xav Xav @Xav👹
    *

    I believe the "custom" option is more of an output than an input. Inkscape displays this when you select a line whose dash style doesn't match any of the others in the menu - such as might happen if you've loaded an SVG file from another editor.

    You can prove this to some extent by setting a non-standard dash via the XML editor, but it's not the easiest of things to do unless you're familiar with XML and CSS syntax:

    1. Create an object with a stroke, and give it one of the pre-defined dashed line styles.
    2. Open the XML editor and select the stroked object.
    3. In the Attributes pane of the editor you should see an entry for "style".
    4. You need to edit the "stroke-dash-array" CSS property in the string that constitutes the style's value, but without breaking the CSS syntax.
    5. The values you enter will be used to set the length of each dash segment and space, automatically repeating as necessary.
    6. If you enter values in here that don't correspond to Inkscape's defaults the menu shows "Custom".

     

    For example, if you set the value as follows, you'll get one of Inkscape's defaults:

    stroke-dash-array: 1, 1;

    Whereas the following will result in "Custom":

    stroke-dash-array: 10, 10;

     

    As an aside, note that the list of numbers is not limited to 2. You could enter any even number of values to get a repeating series of dashes and gaps of different lengths. If you enter an odd number of entries, the values repeat but alternate between setting the dash or gap widths on each iteration, so a complete cycle is effectively twice as long. With that in mind a value of "1" gives the same result as a value of "1, 1" - but the former appears as "Custom" in the menu, where the latter doesn't.

     

  3. #3
    imrevarga imrevarga @imrevarga

    Thanks for the answer.