]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/music-functions-init.ly
Makelsr.py run
[lilypond.git] / ly / music-functions-init.ly
index c2b83ef35a5cea2e388c1dd16be77e5c4eec7858..477c9c6538172a9b098b831c7542d9155ea1b3aa 100644 (file)
@@ -467,8 +467,8 @@ grobdescriptions =
 in the format of @code{all-grob-descriptions}.")
    (ly:make-context-mod
     (map (lambda (p)
-          (list 'assign (car p) (list (cdr p))))
-        descriptions)))
+          (list 'assign (car p) (ly:make-grob-properties (cdr p))))
+         descriptions)))
 
 harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?)
   (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
@@ -642,97 +642,128 @@ slurs, ties, and horizontal spacing are adjusted automatically.")
    (define unshrinkable-props
      '(
        ;; stems
-       Stem.thickness
+       (Stem thickness)
+
        ;; slurs
-       Slur.line-thickness
-       Slur.thickness
-       PhrasingSlur.line-thickness
-       PhrasingSlur.thickness
+       (Slur line-thickness)
+       (Slur thickness)
+       (PhrasingSlur line-thickness)
+       (PhrasingSlur thickness)
+
        ;; ties
-       Tie.line-thickness
-       Tie.thickness
-       LaissezVibrerTie.line-thickness
-       LaissezVibrerTie.thickness
-       RepeatTie.line-thickness
-       RepeatTie.thickness
+       (Tie line-thickness)
+       (Tie thickness)
+       (LaissezVibrerTie line-thickness)
+       (LaissezVibrerTie thickness)
+       (RepeatTie line-thickness)
+       (RepeatTie thickness)
        ))
 
    ;; these props ARE allowed to shrink below default size
    (define shrinkable-props
-     '(
-       ;; override at the 'Score level
-       SpacingSpanner.spacing-increment
-
-       ;; Beam.beam-thickness is dealt with separately below
-
-       ;; lengths and heights
-       Beam.length-fraction
-       Stem.length-fraction
-       Stem.beamlet-default-length
-       Slur.height-limit
-       Slur.minimum-length
-       PhrasingSlur.height-limit
-       PhrasingSlur.minimum-length
-
-       ;; every Slur.details prop that's
-       ;; not a factor, penalty, ratio, or slope
-       Slur.details.region-size
-       Slur.details.free-head-distance
-       Slur.details.free-slur-distance
-       Slur.details.gap-to-staffline-inside
-       Slur.details.gap-to-staffline-outside
-       Slur.details.extra-encompass-free-distance
-       Slur.details.extra-encompass-collision-distance
-       Slur.details.close-to-edge-length
-       Slur.details.encompass-object-range-overshoot
-       Slur.details.slur-tie-extrema-min-distance
-
-       ;; every PhrasingSlur.details prop that's
-       ;; not a factor, penalty, ratio, or slope
-       PhrasingSlur.details.region-size
-       PhrasingSlur.details.free-head-distance
-       PhrasingSlur.details.free-slur-distance
-       PhrasingSlur.details.gap-to-staffline-inside
-       PhrasingSlur.details.gap-to-staffline-outside
-       PhrasingSlur.details.extra-encompass-free-distance
-       PhrasingSlur.details.extra-encompass-collision-distance
-       PhrasingSlur.details.close-to-edge-length
-       PhrasingSlur.details.encompass-object-range-overshoot
-       PhrasingSlur.details.slur-tie-extrema-min-distance
-
-       ;; every Tie.details prop that's
-       ;; not a factor, penalty, ratio, or slope
-       Tie.details.center-staff-line-clearance
-       Tie.details.tip-staff-line-clearance
-       Tie.details.note-head-gap
-       Tie.details.stem-gap
-       Tie.details.height-limit
-       Tie.details.tie-tie-collision-distance
-       Tie.details.intra-space-threshold
-       Tie.details.outer-tie-vertical-gap
-       Tie.details.multi-tie-region-size
-       Tie.details.single-tie-region-size
-       Tie.details.between-length-limit
-       ))
+     (let ((baseline-skip-props
+             (find-named-props 'baseline-skip all-grob-descriptions))
+           (word-space-props
+             (find-named-props 'word-space all-grob-descriptions)))
+       (append
+         baseline-skip-props
+         word-space-props
+         '(
+           ;; TODO: uncomment spacing-increment here once Issue 3987 is fixed
+           ;; override at the 'Score level
+           ;(SpacingSpanner spacing-increment)
+
+           ;; lengths and heights
+           (Beam length-fraction)
+           (Stem length-fraction)
+           (Stem beamlet-default-length)
+           (Stem double-stem-separation)
+           (Slur height-limit)
+           (Slur minimum-length)
+           (PhrasingSlur height-limit)
+           (PhrasingSlur minimum-length)
+
+           ;; Beam.beam-thickness is dealt with separately below
+           ))))
    #{
-     \context Voice {
-       \newSpacingSection
-       #(scale-fontSize mag)
-       #(scale-props unshrinkable-props mag #f)
-       #(scale-props shrinkable-props   mag #t)
+     \context Bottom {
+       %% TODO: uncomment \newSpacingSection once Issue 3990 is fixed
+       %\newSpacingSection
+       #(scale-fontSize 'magnifyMusic mag)
+       #(scale-props    'magnifyMusic mag #f unshrinkable-props)
+       #(scale-props    'magnifyMusic mag #t shrinkable-props)
        #(scale-beam-thickness mag)
 
        #music
 
-       \newSpacingSection
+       %% TODO: uncomment \newSpacingSection once Issue 3990 is fixed
+       %\newSpacingSection
        %% reverse engineer the former fontSize value instead of using \unset
-       #(revert-fontSize mag)
-       #(revert-props (append unshrinkable-props
-                              shrinkable-props
-                              (list 'Beam.beam-thickness)))
+       #(revert-fontSize 'magnifyMusic mag)
+       #(revert-props    'magnifyMusic mag (append unshrinkable-props
+                                                   shrinkable-props
+                                                   '((Beam beam-thickness))))
      }
    #})
 
+magnifyStaff =
+#(define-music-function (parser location mag) (positive?)
+   (_i "Change the size of the staff, adjusting notation size and
+horizontal spacing automatically, using @var{mag} as a size factor.")
+
+   ;; these props are NOT allowed to shrink below default size
+   (define unshrinkable-props
+     '((StaffSymbol thickness)))
+
+   ;; these props ARE allowed to shrink below default size
+   (define shrinkable-props
+     (let* ((baseline-skip-props
+              (find-named-props 'baseline-skip all-grob-descriptions))
+            (word-space-props
+              (find-named-props 'word-space all-grob-descriptions))
+            (space-alist-props
+              (find-named-props 'space-alist all-grob-descriptions)))
+       (append
+         baseline-skip-props
+         word-space-props
+         space-alist-props
+         '(
+           ;; override at the 'Score level
+           (SpacingSpanner spacing-increment)
+
+           (StaffSymbol staff-space)
+           (BarLine kern)
+           (BarLine segno-kern)
+           (BarLine hair-thickness)
+           (BarLine thick-thickness)
+           (Stem beamlet-default-length)
+           (Stem double-stem-separation)
+           ))))
+
+   #{
+     \stopStaff
+
+     %% revert settings from last time
+     %% (but only if \magnifyStaff has already been used
+     %% and the staff magnification is changing)
+     #(revert-fontSize 'magnifyStaff mag)
+     #(revert-props    'magnifyStaff mag (append unshrinkable-props
+                                                 shrinkable-props))
+
+     %% scale settings
+     %% (but only if staff magnification is changing
+     %% and does not equal 1)
+     #(scale-fontSize 'magnifyStaff mag)
+     #(scale-props    'magnifyStaff mag #f unshrinkable-props)
+     #(scale-props    'magnifyStaff mag #t shrinkable-props)
+
+     %% this might cause problems until Issue 3990 is fixed
+     \newSpacingSection
+
+     \startStaff
+     \set Staff.magnifyStaffValue = #mag
+   #})
+
 makeClusters =
 #(define-music-function (parser location arg) (ly:music?)
    (_i "Display chords in @var{arg} as clusters.")