lilypond-user
[Top][All Lists]
Advanced

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

Re: changing the font of moderntab clef


From: Rachael Thomas Carlson
Subject: Re: changing the font of moderntab clef
Date: Tue, 03 Sep 2013 09:23:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8

Hello Harm:

On 09/03/2013 09:04 AM, Thomas Morley wrote:


Hi Rachael,

I'm in a hurry: For now a first sketch.

\version "2.16.2"

%% -> tablature.scm

%% define tab-Clefs as a markup:
#(define-markup-command (customTabClefII
                         layout props num-strings staff-space)
   (integer? number?)
   #:category music
   "Draw a tab clef sans-serif style."
   (define (square x) (* x x))
   (let* ((scale-factor (/ staff-space 1.5))
          (font-size (- (* num-strings 1.5 scale-factor) 7))
          (base-skip (* (square (+ (* num-strings 0.195) 0.4)) scale-factor)))
;font-name
     (interpret-markup layout props
                  (markup #:vcenter #:bold
;; !!!!!!!!!!!!!!!!!!!!!!!!!!!
                          ;; change 'font-family and/or 'font-name
                          ;; to fit your needs
                          #:override (cons 'font-family 'roman) ;; default: 
'sans
                          ;#:override (cons 'font-name "Purisa")
                          #:fontsize font-size
                          #:override (cons 'baseline-skip base-skip)
                          #:left-align #:center-column ("T" "A" "B")))))

%% this function decides which clef to take
#(define-public (clef::print-modern-custom-tab-if-set grob)
   (let ((glyph (ly:grob-property grob 'glyph)))

     ;; which clef is wanted?
     (if (string=? glyph "markup.moderntabII")
         ;; if it is "moderntabII", we'll draw it
         (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
                (line-count (if (ly:grob? staff-symbol)
                                (ly:grob-property staff-symbol 'line-count)
                                0))
                (staff-space (ly:staff-symbol-staff-space grob)))

           (grob-interpret-markup grob (make-customTabClefII-markup line-count
                                                                  staff-space)))
         ;; otherwise, we simply use the default printing routine
         (ly:clef::print grob))))

%% definitions for the "moderntabII" clef:
%% the "moderntabII" clef will be added to the list of known clefs,
%% so it can be used as any other clef: \clef "moderntabII"
#(add-new-clef "moderntabII" "markup.moderntabII" 0 0 0)


%% DELETE ME
%{
%% Displaying some glyph/lists
displayClefGlyph =
     \override Staff.Clef #'before-line-breaking =
       #(lambda (grob)
         (let* ((glyph (ly:grob-property grob 'glyph)))
        (newline)
        (display glyph)))

#(use-modules (ice-9 pretty-print))
#(pretty-print supported-clefs)
#(newline)
#(newline)
#(newline)
#(pretty-print (@@ (lily) c0-pitch-alist))
%}

\layout {
   \context {
     \TabStaff
     \override Clef #'stencil = #clef::print-modern-custom-tab-if-set
     %% DELETE ME
     %\displayClefGlyph
   }
}

\new TabStaff {
     \clef moderntabII
     a1
}

Below the line indicated with
;; !!!!!!!!!!!!!!!!!!!!!!!!!!!
you may want to change the values for font-name and/or font-family

There are some lines introduced with
%% DELETE ME
I let them in for now. If you're interested in some internals you may
want to uncomment them, otherwise delete them.

Disadvantage of this approach:
You can't change back the clef to 'moderntab'
Maybe I find something better this evening...

HTH,
   Harm

This looks incredible! I was able to scale things a little bit to ensure that the font was lining up as it should. Thank you kindly!!!!

Wonderful!

Rachael



reply via email to

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