lilypond-user
[Top][All Lists]
Advanced

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

256th notes (was: How to define a non existing grob)


From: Pierre Perol-Schneider
Subject: 256th notes (was: How to define a non existing grob)
Date: Fri, 17 Apr 2015 16:36:00 +0200

Dear List,

Please find hereunder  the snippet I'd like to upload on the LSR - with bad workarounds!!
Two major issues:
1. 'warning: rest `rests.8' not found': LP print the grob but cannot affect any dimension to it
2. I cannot find any working 'Flag.stencil', probably also - or part of - because flags*.8 glyphs does not exist.

%%%%%%%%

\version "2.18.2"
#(set-global-staff-size 50)

%% Two hundred fifty-sixth notes/rests paths:
flagsd-eight =
#(ly:make-stencil
    `(path 0.001
       `(moveto   -0.05   0.00
         lineto   -0.01   0.00 
         curveto  -0.01   0.70   0.91   1.20   0.91   2.10
         curveto   0.91   2.30   0.90   2.35   0.85   2.53
         lineto    0.74   2.35
         curveto   0.77   1.90   0.75   1.45  -0.01   0.83
         lineto   -0.01   0.93
         curveto  -0.01   1.62   0.93   2.10   0.93   2.85
         curveto   0.93   3.00   0.93   3.00   0.88   3.27
         lineto    0.75   3.10
         curveto   0.86   2.65   0.58   2.15  -0.01   1.68
         lineto   -0.01   1.78
         curveto  -0.01   2.65   1.35   3.00   0.91   4.15
         lineto    0.80   4.00
         curveto   0.94   3.50   0.75   3.10  -0.01   2.57
         lineto   -0.01   2.67
         curveto  -0.01   3.53   1.40   3.80   0.95   4.95
         lineto    0.85   4.76
         curveto   0.95   4.32   0.87   4.00  -0.01   3.47
         lineto   -0.01   3.57
         curveto  -0.01   4.44   1.38   4.53   0.98   5.72
         lineto    0.86   5.58
         curveto   0.95   5.10   0.90   4.83  -0.01   4.39
         lineto   -0.01   4.49
         curveto  -0.01   5.30   1.26   5.32   1.06   6.25
         curveto   1.04   6.38   0.89   6.37   0.90   6.23
         curveto   0.98   5.83   0.85   5.58  -0.01   5.31
         lineto   -0.01   5.83
         lineto   -0.05   5.83
         closepath)
        'round
        'round
        #t))

flagsu-eight =
#(ly:make-stencil
    `(path 0.001
       `(moveto   -0.07   0.30
         lineto   -0.01   0.30
         lineto   -0.01   0.20
         curveto  -0.01  -0.45   0.93  -1.25   0.68  -2.25
         lineto    0.57  -2.05
         curveto   0.63  -1.60   0.48  -1.30  -0.01  -0.69
         lineto   -0.01  -0.79
         curveto  -0.01  -1.50   1.07  -2.20   0.69  -3.05
         lineto    0.59  -2.86
         curveto   0.67  -2.51   0.58  -2.24  -0.01  -1.60
         lineto   -0.01  -1.73
         curveto  -0.01  -2.47   1.18  -2.96   0.68  -4.00
         lineto    0.59  -3.82
         curveto   0.72  -3.45   0.70  -3.14  -0.01  -2.54
         lineto   -0.01  -2.65
         curveto  -0.01  -3.40   1.17  -3.90   0.69  -4.92
         lineto    0.59  -4.75
         curveto   0.77  -4.20   0.53  -3.95  -0.01  -3.46
         lineto   -0.01  -3.60
         curveto  -0.01  -4.25   1.22  -4.99   0.67  -5.76
         lineto    0.57  -5.62
         curveto   0.80  -5.29   0.54  -4.86  -0.01  -4.39
         lineto   -0.01  -4.50
         curveto  -0.01  -5.35   1.28  -5.68   0.67  -6.98
         curveto   0.63  -7.08   0.47  -7.00   0.52  -6.92
         curveto   0.83  -6.18   0.70  -5.92  -0.01  -5.32
         lineto   -0.01  -5.76
         lineto   -0.07  -5.76
         lineto   -0.07  -0.20
         lineto   -0.08  -0.20
         closepath)
        'round
        'round
        #t))

rests-eight =
#(ly:make-stencil
    `(path 0.001
       `(moveto    0.48 -4.00
         curveto   0.48  -4.05   0.65  -4.06   0.67  -4.00
         lineto    1.50   2.71
         curveto   1.50   2.77   1.42   2.77   1.41   2.70
         curveto   1.38   2.56   1.32   2.48   1.26   2.48
         curveto   1.11   2.48   1.21   2.81   0.90   2.81
         curveto   0.75   2.81   0.625  2.70   0.625  2.54
         curveto   0.625  2.20   1.04   2.14   1.355  2.37
         lineto    1.28   1.84
         curveto   1.24   1.47   1.13   1.43   1.11   1.43
         curveto   0.92   1.43   1.08   1.82   0.74   1.82
         curveto   0.60   1.82   0.465  1.70   0.465  1.55
         curveto   0.465  1.19   0.88   1.16   1.21   1.32
         lineto    1.13   0.74
         curveto   1.08   0.49   1.00   0.43   0.95   0.43
         curveto   0.78   0.43   0.90   0.81   0.57   0.81
         curveto   0.42   0.81   0.30   0.68   0.30   0.55
         curveto   0.30   0.18   0.70   0.15   1.075  0.32
         lineto    0.995 -0.25
         curveto   0.97  -0.40   0.87  -0.58   0.78  -0.58
         curveto   0.64  -0.58   0.71  -0.19   0.43  -0.19
         curveto   0.25  -0.19   0.14  -0.32   0.14  -0.45
         curveto   0.14  -0.87   0.63  -0.84   0.94  -0.68
         lineto    0.86  -1.23
         curveto   0.83  -1.44   0.69  -1.59   0.63  -1.59
         curveto   0.45  -1.59   0.57  -1.20   0.25  -1.20
         curveto   0.15  -1.20  -0.02  -1.28  -0.02  -1.47
         curveto  -0.02  -1.88   0.50  -1.84   0.80  -1.68
         lineto    0.73  -2.20
         curveto   0.70  -2.39   0.55  -2.59   0.47  -2.59
         curveto   0.29  -2.59   0.42  -2.21   0.10  -2.21
         curveto  -0.03  -2.21  -0.18  -2.30  -0.18  -2.48
         curveto  -0.18  -2.82   0.18  -2.90   0.66  -2.69
         closepath)
        'round
        'round
        #t))

%%% 256th defs:
%%% Does not work yet:
#(define (flag-8 grob)
   (let* (
           (stem-grob (ly:grob-parent grob X))
           (log (ly:grob-property stem-grob 'duration-log))
           (dir (ly:grob-property stem 'direction))
           (stem-up (eqv? dir UP))
           (layout (ly:grob-layout grob))
          
           ;;;;;;
           (stroke-style (ly:grob-property grob 'stroke-style)))
    
      (if (equal? stroke-style "grace")
         ;;;;;
    
     )))

#(define (stem-8 grob)
    (let* ((dur (ly:grob-property grob 'duration-log))
          (nc (ly:grob-parent grob Y))
          (beam? (ly:grob? (ly:grob-object grob 'beam)))
          (lngth (if (not beam?)(ly:grob-property grob 'length))))
          (if (and (not beam?) (> dur 7))
              (ly:grob-set-property! grob 'length (+ 1.6 lngth)))))

#(define (rest-8 grob)
    (let* ((dur (ly:grob-property grob 'duration-log)))
          (if (> dur 7)
              (set! (ly:grob-property grob 'stencil) rests-eight)
              (ly:rest::print grob))))

%%%% End defs %%%%%%%%%%%

%% tests:
\relative c'' {
  r8*1/8 r16*1/4 r32*1/2 r64 r128*2
  %% tweak here just to show something:
  \tweak stencil #rests-eight
  r  
  %% warning: rest `rests.8' not found
  r256  
}

\relative c' {
  \autoBeamOff
  c'8*1/32 a c16*1/16 a c32*1/8 a c64*1/4 a c128*1/2 a
  %% tweak here just to show something:
  \tweak Flag.stencil #flagsd-eight
  c256
  %% tweak here just to show something:
  \tweak Flag.stencil #flagsu-eight
  a
}

\relative c'' {
  c8*1/32[ c] c16*1/16[ c] c32*1/8[ c]
  c64*1/4[ c] c128*1/2[ c] c256[ c]
}

\layout {
  \context {
    \Score
    %\override Flag.stencil = #flag-8 %%% does not work yet
    \override Stem.after-line-breaking = #stem-8
    \override Rest.stencil = #rest-8
  }
}
%%%%%%%%%%%%%%%%%%%


Any help ?
Cheers,
Pierre

Attachment: 256th.png
Description: PNG image


reply via email to

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