Jump to content

Adjusting vertical positioning of lyric hyphens: 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
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
For joining syllables, LilyPond doesn't use the hyphen of the text font but instead draws a simple line with variable length. Its standard vertical position doesn't always fit the proportions of the text font. When using a font with a large x-height, it may be too low.
For joining syllables, LilyPond doesn’t use the hyphen of the text font but instead draws a simple line with variable length (this limitation is tracked as {{Issue|1255}}). Its standard vertical position doesn’t always fit the proportions of the text font. When using a font with a large x-height, it may be too low.


You can adjust the vertical positioning of the hyphens manually. To get a good result you may want to insert a “real” hyphen for comparision (the l-e in the snippet).
You can adjust the vertical positioning of the hyphens manually. To get a good result you may want to insert a “real” hyphen for comparison (like between ‘l-e’ in the snippet).  You may also want to adjust the thickness of LilyPond hyphens using the <code>thickness</code> property of the <code>LyricHyphen</code> grob to match the font's hyphen character.


<lilypond version="2.24">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=793
% LSR contributed by Hannes Kuhnert <hannes.kuhnert@gmx.de> 1.2.2012.
 
% Hannes Kuhnert <hannes.kuhnert@gmx.de>
% contributed to LilyPond Snippet Repository <http://lsr.di.unimi.it/>
% 1.2.2012


\score {
\score {
   <<
   <<
     \context Voice="Lied" {
     \new Voice = "Lied" {
       \relative c' {
       \relative {
         \clef G
         \clef G
         \key c \major
         \key c \major
         e2 d c1
         e'2 d c1
       }
       }
     }
     }


     \context Lyrics="Lied" {
     \new Lyrics = "Lied"
      \lyricsto Lied {
    \lyricsto Lied {
        La -- l-e -- lu.
      La -- l-e -- lu.
      }
     }
     }
   >>
   >>
Line 31: Line 26:
       \Lyrics
       \Lyrics
       \override LyricHyphen.Y-offset = #0.16
       \override LyricHyphen.Y-offset = #0.16
      \override LyricHyphen.thickness = #2.1
     }
     }
   }
   }
Line 38: Line 34:
   #(define fonts
   #(define fonts
     (make-pango-font-tree
     (make-pango-font-tree
      "Serif"
    "Serif"
      "Sans"
    "Sans"
      "Monospace"
    "Monospace"
      (/ 20 20)
    (/ 20 20)))
    )
  )
}
}
</lilypond>
</lilypond>


[[Category:Paper and layout]]
[[Category:Text]]
[[Category:Text]]
[[Category:Vocal music]]
[[Category:Vocal music]]
[[Category:Paper and layout]]
[[Category:Snippet]]

Latest revision as of 08:55, 2 March 2026

For joining syllables, LilyPond doesn’t use the hyphen of the text font but instead draws a simple line with variable length (this limitation is tracked as Issue #1255). Its standard vertical position doesn’t always fit the proportions of the text font. When using a font with a large x-height, it may be too low.

You can adjust the vertical positioning of the hyphens manually. To get a good result you may want to insert a “real” hyphen for comparison (like between ‘l-e’ in the snippet). You may also want to adjust the thickness of LilyPond hyphens using the thickness property of the LyricHyphen grob to match the font's hyphen character.

\version "2.24"

% LSR contributed by Hannes Kuhnert <hannes.kuhnert@gmx.de> 1.2.2012.

\score {
  <<
    \new Voice = "Lied" {
      \relative {
        \clef G
        \key c \major
        e'2 d c1
      }
    }

    \new Lyrics = "Lied"
    \lyricsto Lied {
      La -- l-e -- lu.
    }
  >>

  \layout {
    \context {
      \Lyrics
      \override LyricHyphen.Y-offset = #0.16
      \override LyricHyphen.thickness = #2.1
    }
  }
}

\paper {
  #(define fonts
    (make-pango-font-tree
     "Serif"
     "Sans"
     "Monospace"
     (/ 20 20)))
}