Jump to content

PostScript lines: Difference between revisions

From LilyPond wiki
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
You can add solid, dashed, and dotted lines using embedded Postscript.
You can add solid, dashed, and dotted lines using embedded Postscript.
<div class="nodoc">
For technical reasons, this doesn't show up in the Wiki because <code>\postscript</code> only works with LilyPond's PS backend and is neither supported in the SVG (used in this Wiki) nor in the Cairo backend.
</div>
In general it is recommended to use LilyPond's native graphical markup commands like <code>\path</code> instead, which can be used with all LilyPond backends; see snippets [[Brackets indicating “Hauptstimme” and “Nebenstimme”]] and [[Curly end barline]] for examples.


<lilypond version="2.24">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=253
ViolinI = \new Staff \relative c' {
ViolinI = \new Staff \relative c' {
   \set Staff.instrumentName = "Violin I"
   \set Staff.instrumentName = "Violin I"
   e1 | f_\markup { \postscript "0.6 setlinewidth 1 -0.5 moveto -2 -6 rlineto stroke" }
   e1 | f_\markup \postscript "0.6 setlinewidth
   g1 | a_\markup { \postscript "1.0 setlinewidth [2 2] 0 setdash 1 1.0 moveto 2 -7 rlineto stroke" }
                              1 -0.5 moveto
   d,1 | e_\markup { \postscript "1.0 setlinewidth 1 setlinecap [1 3] 0 setdash 1 -2 moveto 0 -9 rlineto stroke" }
                              -2 -6 rlineto
   f1 | g_\markup { \postscript "1.0 setlinewidth 1 setlinecap [0 2] 0 setdash 1 -1.5 moveto 0 -10 rlineto stroke" }
                              stroke"
   a1 | b_\markup { \postscript "0.3 setlinewidth 1 setlinecap [0 1.5] 0 setdash 1 1 moveto 0 -11 rlineto stroke" }
   g1 | a_\markup \postscript "1.0 setlinewidth
   c1 | d-\markup { \postscript "0.3 setlinewidth 1 setlinecap [0 1] 0 setdash 1 2 moveto 8 -4  -8 -7  0 -11 rcurveto stroke" }
                              [2 2] 0 setdash
                              1 1.0 moveto
                              2 -7 rlineto
                              stroke"
   d,1 | e_\markup \postscript "1.0 setlinewidth
                              1 setlinecap
                              [1 3] 0 setdash
                              1 -2 moveto
                              0 -9 rlineto
                              stroke"
   f1 | g_\markup \postscript "1.0 setlinewidth
                              1 setlinecap
                              [0 2] 0 setdash
                              1 -1.5 moveto
                              0 -10 rlineto
                              stroke"
   a1 | b_\markup \postscript "0.3 setlinewidth
                              1 setlinecap
                              [0 1.5] 0 setdash
                              1 1 moveto
                              0 -11 rlineto
                              stroke"
   c1 | d-\markup \postscript "0.3 setlinewidth
                              1 setlinecap
                              [0 1] 0 setdash
                              1 2 moveto
                              8 -4  -8 -7  0 -11 rcurveto
                              stroke"
   e1
   e1
}
}
Line 37: Line 68:
[[Category:Editorial annotations]]
[[Category:Editorial annotations]]
[[Category:Specific notation]]
[[Category:Specific notation]]
[[Category:Snippet]]

Latest revision as of 12:09, 10 January 2026

You can add solid, dashed, and dotted lines using embedded Postscript.

For technical reasons, this doesn't show up in the Wiki because \postscript only works with LilyPond's PS backend and is neither supported in the SVG (used in this Wiki) nor in the Cairo backend.

In general it is recommended to use LilyPond's native graphical markup commands like \path instead, which can be used with all LilyPond backends; see snippets Brackets indicating “Hauptstimme” and “Nebenstimme” and Curly end barline for examples.

\version "2.24"

ViolinI = \new Staff \relative c' {
  \set Staff.instrumentName = "Violin I"
  e1 | f_\markup \postscript "0.6 setlinewidth
                              1 -0.5 moveto
                              -2 -6 rlineto
                              stroke"
  g1 | a_\markup \postscript "1.0 setlinewidth
                              [2 2] 0 setdash
                              1 1.0 moveto
                              2 -7 rlineto
                              stroke"
  d,1 | e_\markup \postscript "1.0 setlinewidth
                               1 setlinecap
                               [1 3] 0 setdash
                               1 -2 moveto
                               0 -9 rlineto
                               stroke"
  f1 | g_\markup \postscript "1.0 setlinewidth
                              1 setlinecap
                              [0 2] 0 setdash
                              1 -1.5 moveto
                              0 -10 rlineto
                              stroke"
  a1 | b_\markup \postscript "0.3 setlinewidth
                              1 setlinecap
                              [0 1.5] 0 setdash
                              1 1 moveto
                              0 -11 rlineto
                              stroke"
  c1 | d-\markup \postscript "0.3 setlinewidth
                              1 setlinecap
                              [0 1] 0 setdash
                              1 2 moveto
                              8 -4  -8 -7  0 -11 rcurveto
                              stroke"
  e1
}
ViolinII = \new Staff \relative c' {
  \set Staff.instrumentName = "Violin II"
  e1 | f | g | a
}
Viola = \new Staff \relative c' {
  \set Staff.instrumentName = "Viola"
  \clef alto
  e1 | f | g | a
  c,1 | d | e | f
  g1 | a | b | c | d
}

\score {
  <<
    \ViolinI
    \ViolinII
    \Viola
  >>
}