|
From: | Andreas Schneider |
Subject: | Re: Incipit |
Date: | Tue, 26 Dec 2023 12:30:16 +0100 |
User-agent: | Mozilla Thunderbird |
Thanks again for your help. Using ScoreIndent I arrive at a script that does what I expect: ;;;StaffIncipit (let ((tag "StaffIncipit") (current "") (incipitLength 10) (indent "15.0") (indentLength 15) ) (set! current (d-DirectiveGet-voice-data tag)) (if (not (string? current)) (set! current "")) (set! current (d-GetUserInput (_ "Incipit") (_ "Give incipit for current staff:") current)) (if (string? current) (begin (d-DirectivePut-voice-data tag current) (d-DirectivePut-voice-prefix tag (string-append "\\incipit { " current " }")) (d-DirectivePut-layout-postfix tag (string-append " incipit-width = " (number->string incipitLength) "\n")) (set! indent (d-DirectiveGet-score-data "ScoreIndent")) (if (and (string? indent) (string->number indent)) (begin (set! indentLength (string->number indent)) (if (> incipitLength indentLength) (d-ScoreIndent (+ incipitLength indentLength)))))))) The only deficiency I still see is that the incipit length is fixed and hard-coded in the script, but I have no idea how to calculate it and I can live with that. If you want, you can take over the script. Andreas Am 17.12.23 um 11:49 schrieb Richard Shann:
On Sat, 2023-12-16 at 21:25 +0100, Andreas Schneider wrote:Thank you very much for your help. One more question: how can I get the current indentThere are two indent commands Command: Indent Alter the indent of the opening system for the current movement. Location: Object Menu ▶ Movements ▶ Typesetter ▶ Print Layout Internal Name: Indent and Command: Indent Indent the first system of every movement by the given amount. Location: Object Menu ▶ Score ▶ Typesetter ▶ Print Layout Internal Name: ScoreIndent The Instrument name command Command: Instrument Name Print Instrument name before staff at start of score, Location: Object Menu ▶ Staffs/Voices ▶ Staff Properties Internal Name: InstrumentName runs the second (*) of those Indent commands, so to retrieve the value set you need (d-DirectiveGet-score-data "ScoreIndent") to get that value. The value set by InstrumentName is just a very crude guess based on the length of the name, a proper job would require querying LilyPond about how much space is required ... Richard (*) I don't know why this is so, it was a long time ago and perhaps it would be better to do otherwise...
[Prev in Thread] | Current Thread | [Next in Thread] |