;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 2004--2014 Carl D. Sorensen <c_sorensen@byu.edu>
+;;;; Copyright (C) 2004--2015 Carl D. Sorensen <c_sorensen@byu.edu>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
(car this-list)
;; fret
(- (second this-list) base-fret)
- ;; finger
- (if (or (null? (cddr this-list))
- (not (number? (caddr this-list))))
- '()
- (third this-list))
+ ;; finger-number or markup
+ (if (and (not (null? (cddr this-list)))
+ (or (markup? (caddr this-list))
+ (number? (caddr this-list))))
+ (third this-list)
+ '())
;; inverted
(dot-is-inverted this-list)
;; parenthesis
(if (> fretval maxfret) (set! maxfret fretval))
(if (< fretval minfret) (set! minfret fretval))
(updatemax (cdr fret-list)))))
+ ;; take frets of 'barre-settings into account
+ (if (not (null? barre-list))
+ (set! minfret (apply min minfret (map last barre-list))))
(if (or (> maxfret my-fret-count) (> capo-fret 1))
(set! fret-range
(cons minfret
((or (eq? finger '())(eq? finger-code 'none))
positioned-dot)
((eq? finger-code 'in-dot)
- (let ((finger-label
- (centered-stencil
- (sans-serif-stencil
- layout props dot-label-font-mag finger))))
+ (let* ((finger-stil
+ (if (not (null? finger))
+ (sans-serif-stencil
+ layout props dot-label-font-mag finger)
+ empty-stencil))
+ (finger-stil-length
+ (interval-length (ly:stencil-extent finger-stil X)))
+ (finger-stil-height
+ (interval-length (ly:stencil-extent finger-stil Y)))
+ (dot-stencil-radius
+ (/ (interval-length (ly:stencil-extent dot-stencil Y))
+ 2))
+ (scale-factor
+ (/ dot-stencil-radius
+ ;; Calculate the radius of the circle through the
+ ;; corners of the box containing the finger-stil.
+ ;; Give it a little padding. The value, (* 2 th),
+ ;; is my choice
+ (+
+ (sqrt
+ (+ (expt (/ finger-stil-length 2) 2)
+ (expt (/ finger-stil-height 2) 2)))
+ (* 2 th))))
+ (finger-label
+ (centered-stencil
+ (ly:stencil-scale
+ (sans-serif-stencil
+ layout props
+ dot-label-font-mag
+ finger)
+ scale-factor scale-factor))))
(ly:stencil-translate
(ly:stencil-add
final-dot-stencil
(number-type
(assoc-get 'number-type details 'roman-lower))
(label-text
- (cond
- ((equal? number-type 'roman-lower)
- (fancy-format #f "~(~@r~)" base-fret))
- ((equal? number-type 'roman-upper)
- (fancy-format #f "~@r" base-fret))
- ((equal? 'arabic number-type)
- (fancy-format #f "~d" base-fret))
- ((equal? 'custom number-type)
- (fancy-format #f
- (assoc-get 'fret-label-custom-format
- details "~a")
- base-fret))
- (else (fancy-format #f "~(~@r~)" base-fret))))
+ (number-format number-type base-fret
+ (assoc-get 'fret-label-custom-format
+ details "~a")))
(label-stencil
(centered-stencil
(sans-serif-stencil