Re: Harmonic notehead style

2016-06-02 Thread Paul

On 06/01/2016 10:03 AM, Andrew Bernard wrote:
Thanks so much for this. That has given me the impetus and 
understanding to code my solution. 


Glad to help.
In your context you are using an engraver, so you simply omit the 
notehead styles such as harmonic. In my case, I am overriding the 
notehead stencil to draw my own custom shapes, and so what I do now is 
to check when the style is ‘harmonic and provide my own drawing 
routine for that, rather than omitting it. This is really perfect, 
because the whole point of my custom override is to generate a very 
particular look and feel for my composer’s noteheads, and other 
stylistic appearance considerations.


Sounds good!  Just to clarify (in case anyone is reading that 
closely)... this custom engraver doesn't "omit" the harmonic noteheads, 
but rather leaves them unchanged.  They are drawn with the default 
harmonic note head stencil.  (Maybe that's what you meant?)


Cheers,
-Paul
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonic notehead style

2016-06-01 Thread Andrew Bernard
Hi Paul,

Thanks so much for this. That has given me the impetus and understanding to
code my solution. In your context you are using an engraver, so you simply
omit the notehead styles such as harmonic. In my case, I am overriding the
notehead stencil to draw my own custom shapes, and so what I do now is to
check when the style is ‘harmonic and provide my own drawing routine for
that, rather than omitting it. This is really perfect, because the whole
point of my custom override is to generate a very particular look and feel
for my composer’s noteheads, and other stylistic appearance considerations.

Yet again, thanks!

Andrew


On 1 June 2016 at 10:38:18 PM, Paul wrote:


Yes, you'll want to check the 'style property of the note head grob and
when it is 'harmonic then leave the default stencil alone (or provide your
own harmonic note head stencil).  There are a number of different note head
styles like this.  See my custom note head engraver below (for Clairnote
music notation[1]) which just leaves the default stencil in place for a
given list of styles.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonic notehead style

2016-06-01 Thread Paul

Hi Andrew,

On 05/31/2016 09:48 PM, Andrew Bernard wrote:
I am using a custom stencil for noteheads, to achieve a certain look 
and ellipticity and rotation compared to the default noteheads. 
Suddenly doing a guitar piece I have to use \harmonic style and this 
does not have any effect when using a custom notehead symbol.


Do I need to add scheme code in my stencil function to take cognisance 
of the \harmonic style instruction and also draw my own shapes for 
that, or am I missing something?


Yes, you'll want to check the 'style property of the note head grob and 
when it is 'harmonic then leave the default stencil alone (or provide 
your own harmonic note head stencil).  There are a number of different 
note head styles like this.  See my custom note head engraver below (for 
Clairnote music notation[1]) which just leaves the default stencil in 
place for a given list of styles.


HTH,
-Paul

[1] http://clairnote.org/software/

#(define Cn_note_heads_engraver
;; Customizes stencil, stencil-width, stem-attachment, rotation.
(make-engraver
 (acknowledgers
  ((note-head-interface engraver grob source-engraver)
   ;; make sure \omit is not in effect (i.e. stencil is not #f)
   ;; and do nothing for certain notehead styles
   (if
(and
 (ly:grob-property-data grob 'stencil)
 (not (memq (ly:grob-property-data grob 'style)
(list 'harmonic 'harmonic-black 'harmonic-mixed
  'diamond 'cross 'xcircle 'triangle 'slash
;; TODO: better handling of various notehead styles
;; http://lilypond.org/doc/v2.18/Documentation/notation/note-head-styles
;; output-lib.scm
(let*
 ((context (ly:translator-context engraver))
  (black-note (= 0 (modulo (cn-notehead-semitone grob) 2)))
  (dur-log (ly:grob-property grob 'duration-log))
  (stil-proc (ly:context-property context 'cnNoteheadStencilProcedure))
  (width-scale (ly:context-property context 'cnNoteheadWidthScale 1))
  (height-scale (ly:context-property context 'cnNoteheadHeightScale 1))
  (rot (ly:context-property context 'cnNoteheadRotation #f))
  (stem-attach (ly:context-property context 'cnStemAttachment #f)))

 (ly:grob-set-property! grob 'stencil
   (stil-proc grob context black-note dur-log))

 (if (>= dur-log 1)
 (if (not (and (= 1 width-scale) (= 1 height-scale)))
 (ly:grob-set-property! grob 'stencil
   (ly:stencil-scale
(ly:grob-property grob 'stencil)
width-scale height-scale

 (if (and rot (>= dur-log 1))
 (ly:grob-set-property! grob 'rotation (list rot 0 0)))

 (if (and stem-attach (>= dur-log 1))
 (ly:grob-set-property! grob 'stem-attachment
   (if black-note
   (car stem-attach)
   (cdr stem-attach
 ))


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user