Hej all, > On Tue, Mar 24, 2026, 11:36 AM Kieren MacMillan <[email protected]> > > wrote: > > Hi all, > > > > > Looking at the code for \magnifyStaff, there doesn't seem to be a way > > > to apply it at the StaffGroup level. So I think you're stuck with > > > including the \with {} expression for each staff in the StaffGroup, as > > > Mats shows in his file. > > > > > > Fixing this would require a serious rewrite of \magnifyStaff. > > > > What about that “hack” that Lukas gave me for “forcing” a command into a > > different context? > > Could that be applied to \magnifyStaff? > > I don't think so, because \magnifyStaff doesn't set context properties. > Rather, it directly modifies the data structures. But I might be wrong. > > Carl
Actually only requires a slight modification:
%%%
magnifyContext =
#(define-music-function (mag) (positive-number?)
(_i "Change the staff size by factor @var{mag}.
This adjusts notation size and horizontal spacing automatically.")
;; 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 'magnifyMusic mag)
#(revert-props 'magnifyMusic mag (append unshrinkable-props
shrinkable-props))
%% scale settings
%% (but only if staff magnification is changing
%% and does not equal 1)
#(scale-fontSize 'magnifyMusic mag)
#(scale-props 'magnifyMusic mag #f unshrinkable-props)
#(scale-props 'magnifyMusic mag #t shrinkable-props)
%% this might cause problems until Issue 3990 is fixed
\newSpacingSection
\startStaff
\set Staff.magnifyStaffValue = #mag
#})
\new StaffGroup \with {
\magnifyContext #0.7
fontSize = -2
} <<
\new Staff { c }
\new Staff { c }
>>
%%%
(although since we probably are only going to use this in \with block this
could be reduced to:
%%%
magnifyContext =
#(define-music-function (mag) (positive-number?)
(_i "Change the staff size by factor @var{mag}.
This adjusts notation size and horizontal spacing automatically.")
;; 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)
))))
#{
%% scale settings
#(scale-fontSize 'magnifyMusic mag)
#(scale-props 'magnifyMusic mag #f unshrinkable-props)
#(scale-props 'magnifyMusic mag #t shrinkable-props)
#})
\new StaffGroup \with {
\magnifyContext #0.7
fontSize = -2
} <<
\new Staff { c }
\new Staff { c }
>>
%%%
The only reason why \magnifyStaff does not work on StaffGroup level is that the
scale-* functions if called with `'magnifyStaff` will try to find the parent
Staff
context. With `'magnifyMusic` it uses the context it is called in, but
\magnifyMusic explicitely calls things in \context Bottom and is designed as
toggle on, add music argument, toggle off.
Cheers,
Tina
signature.asc
Description: This is a digitally signed message part.
