Am 11.12.2016 um 10:08 schrieb David Kastrup:
Noeck <noeck.marb...@gmx.de> writes:

Btw, I realized that at least visually setting the min. length to 0
already makes the non-melismata hyphens disappear even without your code
to kill them:

\layout {
     \override Lyrics.LyricExtender.minimum-length = 0.0
}

{ a a( a) }
\addlyrics { A __ B __}
But one does not want extenders indistinguishable from fly specks, so 0
is a bad size to use.

I think also the minim-length should be handled differently in the c++ code.

Imho the use of minimum-length and documentation of minimum-length do not agree 
in current master,
so we have some freedom ;-)

cu,
 Knut

>From e37b3eeaca692db26a2384548c71d180f090c4a1 Mon Sep 17 00:00:00 2001
From: Knut Petersen <knut_peter...@t-online.de>
Date: Sun, 11 Dec 2016 12:30:38 +0100
Subject: [PATCH] Better lyric extender handling

---
 lily/lyric-extender.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc
index 8afe2c5569..d05e71a41a 100644
--- a/lily/lyric-extender.cc
+++ b/lily/lyric-extender.cc
@@ -48,7 +48,7 @@ Lyric_extender::print (SCM smob)
 
   extract_grob_set (me, "heads", heads);
 
-  if (!heads.size ())
+  if (heads.size () < 2)
     return SCM_EOL;
 
   common = common_refpoint_of_array (heads, common, X_AXIS);
@@ -66,9 +66,8 @@ Lyric_extender::print (SCM smob)
 
   /* It seems that short extenders are even lengthened to go past the
      note head, but haven't found a pattern in it yet. --hwn 1/1/04  */
-  SCM minlen = me->get_property ("minimum-length");
-  Real right_point
-    = left_point + (robust_scm2double (minlen, 0));
+  Real minlen = robust_scm2double (me->get_property ("minimum-length"), 0);
+  Real right_point = left_point + minlen;
 
   right_point = min (right_point, me->get_system ()->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
 
@@ -89,7 +88,7 @@ Lyric_extender::print (SCM smob)
   left_point += paddings[LEFT];
   Real w = right_point - left_point;
 
-  if (w < 1.5 * h)
+  if (w <= minlen)
     return SCM_EOL;
 
   Stencil mol (Lookup::round_filled_box (Box (Interval (0, w),
-- 
2.11.0

\version "2.19.53"
\language "deutsch"

\pointAndClickOff

% Requires Libertine Open Fonts from http://www.linuxlibertine.org/

\header {
  title = "Brich an, o schönes Morgenlicht"
  subtitle = "12. Choral – Weihnachtsoratorium"
  composer = "J. S. Bach"
  shortcomposer = "Bach"
  maintainer = "Joram Berger"
  maintainerWeb = "http://joramberger.de";
  style = "Baroque"
  source = "Breitkopf & Härtel, Leipzig, 1856"
  mutopiacomposer = "BachJS"
  mutopiapoet = "Johann Rist"
  mutopiaopus = "BWV 248"
  mutopiainstrument = "Choir (SATB)"
  license = "cc-by-sa"
  date = "1734"

 mutopialicense = "Creative Commons Attribution-ShareAlike 4.0"
 footer = "Mutopia-2016/04/22-1900"
 copyright = \markup {\override #'(font-name . "DejaVu Sans, Bold") \override #'(baseline-skip . 0) \right-column {\with-url #"http://www.MutopiaProject.org"; {\abs-fontsize #9  "Mutopia " \concat {\abs-fontsize #12 \with-color #white \char ##x01C0 \abs-fontsize #9 "Project "}}}\override #'(font-name . "DejaVu Sans, Bold") \override #'(baseline-skip . 0 ) \center-column {\abs-fontsize #11.9 \with-color #grey \bold {\char ##x01C0 \char ##x01C0 }}\override #'(font-name . "DejaVu Sans,sans-serif") \override #'(baseline-skip . 0) \column { \abs-fontsize #8 \concat {"Typeset using " \with-url #"http://www.lilypond.org"; "LilyPond " \char ##x00A9 " 2016 " "by " \maintainer " " \char ##x2014 " " \footer}\concat {\concat {\abs-fontsize #8 { \with-url #"http://creativecommons.org/licenses/by-sa/4.0/"; "Creative Commons Attribution ShareAlike 4.0 International License "\char ##x2014 " free to distribute, modify, and perform" }}\abs-fontsize #13 \with-color #white \char ##x01C0 }}}
 tagline = ##f
}

#(define (lh-test-stencil arg)
 (lambda (grob)
   (if (ly:stencil? (ly:lyric-hyphen::print grob))
       (let* ((stil (ly:lyric-hyphen::print grob))
              (x-ext (ly:stencil-extent stil X))
              (dash-period (ly:grob-property grob 'dash-period))
              (arg-stil (grob-interpret-markup grob arg))
              (arg-stil-x-ext (ly:stencil-extent arg-stil X))
              (length-to-print (interval-length x-ext))
              (guess (max 0 (truncate (/ length-to-print dash-period))))
              (guessed-args-line-length (* guess dash-period))
              (line-length-diff (- length-to-print guessed-args-line-length))
              (line-length-diff-for-each-arg (/ line-length-diff guess))
              (first-arg-length (+ dash-period line-length-diff-for-each-arg))
              (first-arg-end-coord
                  (/ (* first-arg-length
                        (- (interval-length x-ext)
                           (interval-length arg-stil-x-ext)))
                     length-to-print))
              (list-of-starts
                (map
                  (lambda (n) (* n first-arg-end-coord))
                  (iota (+ 1 guess)))))
         (ly:stencil-translate-axis
           (apply
             ly:stencil-add
             (map
               (lambda (x-val) (ly:stencil-translate-axis arg-stil x-val X))
               list-of-starts))
           (car x-ext) X))
       (ly:grob-suicide! grob))))


newLH = #(define-music-function (mrkp)(markup?)
        #{
          \override LyricHyphen.after-line-breaking =
            #(lambda (grob)
              (if (ly:stencil? (ly:lyric-hyphen::print grob))
                  (ly:grob-set-property! grob 'stencil
                    ((lh-test-stencil mrkp ) grob))))
        #})



#(set-global-staff-size 18.1)


\paper {
  ragged-bottom = ##f
  ragged-last-bottom = ##f
  last-bottom-spacing = #'((basic-distance . 15)
                          (minimum-distance . 0)
                          (padding . 1)
                          (stretchability . 30))
  myStaffSize = #18.5
  fonts = #(make-pango-font-tree
            "Linux Libertine O"
            "Linux Biolinum O"
            "Ubuntu Mono"
            (/ myStaffSize 20))
}

\layout {
  \override Staff.ClefModifier.font-name = #"Century Schoolbook L bold italic"
  \override Staff.ClefModifier.extra-offset = #'(-0.3 . 0.07)
  \override Score.BarNumber.font-name = #"Century Schoolbook L"
}

global = {
  \key g \major
  \time 4/4
  \partial 4
  \autoBeamOff
  \accidentalStyle modern-voice
}

fe = \fermata

soprano = \relative c'' {
  \global
  \repeat volta 2 {
    g4 | g a h8[ cis] d4 | d cis d\fe
    h4 | c h a h | a2 g4
  } \break
  a4  | \once \override Score.BarNumber.break-visibility = #all-visible
  a h c c | h8[( a]) h4 a\fe
  h4 | h h c8[( d]) e4 | e dis e\fe
  fis4 | g h, c h | a2 a4\fe
  d4 | e d c h8[ c] | a2 g='4\fe
  \bar "|."
}

alto = \relative c' {
  \global
  \repeat volta 2 {
    d4 | e fis d8[ e] fis4 | e8[ fis] g4 fis\fe
    fis4 | e d8[ e] fis4 g | g( fis) d
  }
  fis8[ g] | a4. gis8 a[( gis]) a4 | a gis e\fe
  e8[ dis] | e4 e e8[( fis]) g[( fis]) | fis8[( g]) a4 g\fe
  a4 | g8[ a] h4 h8[( a]) a[( g]) | g2 fis4\fe
  g8[ fis] | e4 fis g8[( a]) d,4 | e( d) d='\fe
}

tenor = \relative c' {
  \global
  \repeat volta 2 {
    h4 | h8[ c] ~ c d h[ a] a4 | a a a\fe
    h8[a] | g[a] h[ c] d4 d | d4.( c8) h4
  }
  d8[ e] | fis[ e] d4 e fis | h, e8[ d] c4\fe
  g8[ a] | h[ c] d[ e] c4 cis | h h h\fe
  d4 | d g g,8[( a]) h4 | e8[( d e cis]) d4\fe
  d4 | d8[( c]) c[( h]) h[( a]) g4 | g8[( fis16 e] fis4) h=\fe
}

bass = \relative c' {
  \global
  \repeat volta 2 {
    g8[ fis] | e4 d g fis8[ g] | a4 a, d\fe
    dis4 | e8[ fis] g[ c,] c'[ h] a[ g] | d'4( d,) g
  }
  d4 | d'8[ c] h4 a dis, | e e a,\fe
  e'8[ fis] | g4 gis a ais | h h, e\fe
  d'8[ c] | h[ a] g[ fis] e[ fis] g[ e] | cis[ h cis a] d4\fe
  h4 | c d e8[ fis] g4 | \shape #'((0 . -0.2) (0 . -0.8) (0 . -0.8) (0 . 0)) Slur c,( d) g,=,\fe
}


text = \lyricmode {
  Brich __ an, __ o __ schö -- nes __ Mor -- gen -- licht, __ und __ lass __ den __ Him -- mel __  ta -- gen! __ 
  dass __ die -- ses __ schwa -- che __ Knä -- be -- lein __ soll __ un -- ser __ Trost __ und __ Freu -- de __ sein,
  da -- zu __ den Sa -- tan __ zwin -- gen __ und __ letzt -- lich __ Frie -- den __ brin -- gen! __ 
}

textB = \lyricmode {
  Du __ Hir -- ten -- volk, __ er -- schre -- cke __ nicht, __ weil __ dir __ die __ En -- gel __ sa -- gen: __ 
}


\score {
  \new ChoirStaff <<
    \new Staff \with {
      instrumentName = "Sopran"
    } { \soprano }
    \addlyrics { \text }
    \addlyrics { \textB }
    \new Staff \with {
      instrumentName = "Alt"
    } { \alto }
    \addlyrics { \text }
    \addlyrics { \textB }
    \new Staff \with {
      instrumentName = "Tenor"
    } { \clef "treble_8" \tenor }
    \addlyrics { \text }
    \addlyrics { \textB }
    \new Staff \with {
      instrumentName = "Bass"
    } { \clef "bass" \bass }
    \addlyrics { \text }
    \addlyrics { \textB }
  >>
  \layout {
    \context {
      \Lyrics
      \newLH "-"
      \override LyricExtender #'minimum-length = #2.0
    }
  }
}

\score {
  <<
    \soprano
    \alto
    \tenor
    \bass
  >>
  \midi {
    \set Score.midiInstrument = "oboe"
    \tempo 4 = 100
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to