X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Ftranslation-functions.scm;h=4479d3ae1b24f51e87671fccdc99cf100f889715;hb=0b544cfb7332615ef809b71b57ab656741311ae1;hp=5d40da8cfaaabfeafd3efc7e9368e1497669e4e8;hpb=f8d17f1f0f891280bb7d3ee498c3ba175ae4343a;p=lilypond.git diff --git a/scm/translation-functions.scm b/scm/translation-functions.scm index 5d40da8cfa..4479d3ae1b 100644 --- a/scm/translation-functions.scm +++ b/scm/translation-functions.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; (c) 1998--2012 Han-Wen Nienhuys +;;;; (c) 1998--2014 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify @@ -38,33 +38,53 @@ way the transposition number is displayed." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; metronome marks -(define-public (format-metronome-markup event context) - (let ((hide-note (ly:context-property context 'tempoHideNote #f)) - (text (ly:event-property event 'text)) - (dur (ly:event-property event 'tempo-unit)) - (count (ly:event-property event 'metronome-count))) - - (metronome-markup text dur count hide-note))) - -(define-public (metronome-markup text dur count hide-note) - (let* ((note-mark (if (and (not hide-note) (ly:duration? dur)) - (make-smaller-markup - (make-note-by-number-markup (ly:duration-log dur) - (ly:duration-dot-count dur) - 1)) - #f)) +;; We give 'styled-metronome-markup' an optional argument, 'glyph-font', to +;; prepare using other fonts than 'fetaMusic. +;; Currently it ensures that the default-fonts are used by the +;; markup-command 'note-by-number' in 'metronome-markup' (see below). +(define*-public + ((styled-metronome-markup #:optional (glyph-font 'default)) + event context) + (let ((hide-note (ly:context-property context 'tempoHideNote #f)) + (text (ly:event-property event 'text)) + (dur (ly:event-property event 'tempo-unit)) + (count (ly:event-property event 'metronome-count))) + + (metronome-markup glyph-font text dur count hide-note))) + +(define-public format-metronome-markup + (styled-metronome-markup)) + +(define (metronome-markup glyph-font text dur count hide-note) + (let* ((note-mark + (if (and (not hide-note) (ly:duration? dur)) + (make-smaller-markup + ;; We insert the (default)-font for flag-glyphs and + ;; note-head-glyphs to prepare the possibility to use + ;; other fonts and to make possible using + ;; \override MetronomeMark #'font-name = # + ;; without affecting the note/flag-glyphs. + (make-override-markup (cons 'font-name glyph-font) + (make-note-by-number-markup + (ly:duration-log dur) + (ly:duration-dot-count dur) + UP))) + #f)) (count-markup (cond ((number? count) (if (> count 0) - (make-simple-markup (number->string count)) + (make-simple-markup + (number->string count)) #f)) ((pair? count) (make-concat-markup (list - (make-simple-markup (number->string (car count))) + (make-simple-markup + (number->string (car count))) (make-simple-markup " ") (make-simple-markup "–") (make-simple-markup " ") - (make-simple-markup (number->string (cdr count)))))) + (make-simple-markup + (number->string (cdr count)))))) (else #f))) (note-markup (if (and (not hide-note) count-markup) (make-concat-markup @@ -321,14 +341,14 @@ along with @var{minimum-fret}, @var{maximum-stretch}, and if no fingering is present." (let* ((articulations (ly:event-property ev 'articulations)) (finger-found #f)) - (map (lambda (art) - (let* ((num (ly:event-property art 'digit))) - - (if (and (ly:in-event-class? art 'fingering-event) - (number? num) - (> num 0)) - (set! finger-found num)))) - articulations) + (for-each (lambda (art) + (let* ((num (ly:event-property art 'digit))) + + (if (and (ly:in-event-class? art 'fingering-event) + (number? num) + (> num 0)) + (set! finger-found num)))) + articulations) finger-found)) (define (delete-free-string string) @@ -582,7 +602,7 @@ only ~a fret labels provided") (make-vcenter-markup (format #f "~a" fret-number))) -;; The 5-string banjo has got a extra string, the fifth (duh), which +;; The 5-string banjo has got an extra string, the fifth (duh), which ;; starts at the fifth fret on the neck. Frets on the fifth string ;; are referred to relative to the other frets: ;; the "first fret" on the fifth string is really the sixth fret