lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with accent placement


From: Thomas Morley
Subject: Re: problem with accent placement
Date: Sun, 27 Dec 2015 19:21:18 +0100

2015-12-27 19:12 GMT+01:00 Thomas Morley <address@hidden>:
> 2015-12-27 18:18 GMT+01:00 Alex Jones <address@hidden>:
>> I’m using the Script.priority-order to place an accidental above a trill 
>> ornament, but when combining with a note accent it creates an ordering 
>> property as per the documentation example.  However with the following 
>> snippet:
>>
>> \version "2.18.0"
>>
>> \relative c''' {
>> a2-> \trill
>>
>> \once \override Script.script-priority = #-100
>> a2-> ^\trill^\markup { \sharp }
>> }
>>
>>
>> The first note places the accent adjacent to the note and the trill above 
>> (which is correct)
>>
>> when adding the \sharp and getting it above the tr it swaps the accent and 
>> trill ornament creates this side-effect.
>>
>> Is there a way to specify the order between the three expressive marks?
>>
>> Thanks!!!
>>
>> -akj
>
> \relative c''' {
> a2-> \trill
>
> a2-\tweak script-priority #99 ->
>   -\tweak script-priority #100 ^\trill
>   ^\markup { \sharp }
> }
>
>
> HTH,
>   Harm


\relative c''' {
  a2-> \trill

  a2-> -\tweak script-priority #101 ^\trill
    ^\markup { \sharp }
}

would have been enough.
Or use this generalized approach:

\version "2.19.32"

#(define (get-script-type grob)
"Get the type of a Script with the direction-indicator (if any),
outputs a string."
  (let* ((script-stencil (ly:grob-property grob 'script-stencil))
         (direction (ly:grob-property grob 'direction))
         (dir-script-type
           (if (and (pair? script-stencil) (pair? (cdr script-stencil)))
               (if (>= 0 direction)
                   (cadr script-stencil)
                   (cddr script-stencil))
               '())))
    ;(write-me "\n\tscript-type: " dir-script-type)
    dir-script-type))

#(define script-names
;; Returns all script-types and their script-stencil-names as a list of strings
  (append-map
    (lambda (s)
      (let ((script-stencils (cdr (assoc-get 'script-stencil (cdr s)))))
      (cons (car s)
            (list (car script-stencils) (cdr script-stencils)))))
    default-script-alist))

#(define ((set-script-property scripts property value) grob)
"Sets @code{property} to @var{value} for all script-types of @var{scripts}."
      (for-each
        (lambda (type)
          (if (not (member (symbol->string type) script-names))
              (ly:warning "~a is not a Script, ignoring" type))
          (if (or (eq? type (string->symbol (get-script-type grob)))
                  (eq? type
                       (string->symbol (string-drop (get-script-type grob) 1))))
              (ly:grob-set-property! grob property value)))
        scripts))

setScriptTypeProperty =
#(define-music-function (parser location types-property value)
  (symbol-list? scheme?)
  "Sets specified grob-property of @var{types-property} to @var{value} for
script-types of @var{types-property}"
  ;; TODO keep previous overrides of 'before-line-breaking
  (if (< (length types-property) 2)
      (ly:warning "script-type or property missing in ~a, skipping \n~a"
                  types-property
                  (*location*)))
  #{
    \temporary
      \override Script.before-line-breaking =
        #(set-script-property
           (drop-right types-property 1)
           (car (last-pair types-property))
           value)
  #})


\relative c''' {
  a2-> \trill

  \setScriptTypeProperty trill.script-priority #101
  a2-> ^\trill ^\markup { \sharp }
}


Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]