X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=scm%2Ffret-diagrams.scm;h=041d180c04ddb6d624283e729b3937c1bc66274e;hb=c7acad264e49f23e333dd66a0e1d50005c630068;hp=a1daae33213f724d8ecd087a4218c349b6279fc7;hpb=0fe24db3936774a8fb913cb14c997036db7aeb1c;p=lilypond.git diff --git a/scm/fret-diagrams.scm b/scm/fret-diagrams.scm index a1daae3321..041d180c04 100644 --- a/scm/fret-diagrams.scm +++ b/scm/fret-diagrams.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2014 Carl D. Sorensen +;;;; Copyright (C) 2004--2015 Carl D. Sorensen ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -109,11 +109,12 @@ to end-point." (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 @@ -260,6 +261,9 @@ with magnification @var{mag} of the string @var{text}." (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 @@ -668,10 +672,37 @@ fret-diagram overall parameters." ((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