[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: markup column with baseline-skip relative to font size
From: |
Thomas Morley |
Subject: |
Re: markup column with baseline-skip relative to font size |
Date: |
Sat, 17 Nov 2018 12:03:36 +0100 |
Hi Kieren,
Am Sa., 17. Nov. 2018 um 02:36 Uhr schrieb Kieren MacMillan
<address@hidden>:
>
> Hi all,
>
> In the snippet below, you’ll see that I’m attempting to override Fingering in
> a custom context to add a caret (^) on top of the [formatted] finger number
> to make it into a scale degree.
>
> The "padding" between the caret and the number isn’t relative, as I would
> like it to be: it should always be some fraction of the font height (either
> x-height or m-height or M-height or similar).
I don't think that's the way to go.
> Is there a way to accomplish this?
Default \center-column does not adjust baseline-skip according to the
grobs font-size.
Below I wrote 'center-column-fontsize-adjusted-baseline-skip' (you
should probably rename it, lol), which does so. Modeled after how
\fontsize deals with baseline-skip.
> Bonus points if the top of the caret and the baseline of the numbers remain
> the same even when using lowercase numerals.
Not sure what you mean here, could you provide some example-code?
But here the code. I dropped all about 'UrlinieVoice', not needed for
a minimal, imho.
Is this what you aim at?
\version "2.19.82"
#(define-markup-command
(center-column-fontsize-adjusted-baseline-skip layout props args)
(markup-list?)
#:category align
#:properties ((font-size 0)
(baseline-skip))
;; 'general-column' is not public, thus copied from define-markup.scm
;; and inserted here
(define (general-column align-dir baseline mols)
"Stack @var{mols} vertically, aligned to @var{align-dir} horizontally."
(let* ((aligned-mols
(map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols))
(stacked-stencil (stack-lines -1 0.0 baseline aligned-mols))
(stacked-extent (ly:stencil-extent stacked-stencil X)))
(ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X)))
(general-column CENTER (* baseline-skip (magstep font-size))
(interpret-markup-list layout props args)))
%% Rewritten for easy exchanging procedures while testing
#(define (caret-finger proc)
(lambda (grob)
(let ((text (ly:grob-property grob 'text)))
(grob-interpret-markup grob
(make-text-markup
(make-override-markup '(baseline-skip . 1.75)
(proc (list "^" text))))))))
mus = { a'8-4 8-3 8-2 8-1 }
%% default
{
\override Fingering.stencil =
#(caret-finger make-center-column-markup)
\mus
\override Fingering.font-size = #4
\mus
}
%% new code
{
\override Fingering.stencil =
#(caret-finger make-center-column-fontsize-adjusted-baseline-skip-markup)
\mus
\override Fingering.font-size = #4
\mus
}
Cheers,
Harm
- markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/16
- Re: markup column with baseline-skip relative to font size,
Thomas Morley <=
- Re: markup column with baseline-skip relative to font size, Thomas Morley, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Aaron Hill, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/17
- Re: markup column with baseline-skip relative to font size, David Kastrup, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Aaron Hill, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Aaron Hill, 2018/11/17
- Re: markup column with baseline-skip relative to font size, Kieren MacMillan, 2018/11/17