+2003-03-08 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scm/chords-ignatzek.scm (alteration->text-accidental-markup):
+ new function
+
+ * scm/bass-figure.scm (make-bass-figure-markup): reimplement bass
+ figures using new markups. Much simpler, and should improve layout
+ a little.
+
+ * mf/feta-nummer-code.mf (code): insert space in location 32, not 33.
+
2003-03-06 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* ly/engraver-init.ly: use Hara kiri by default for
Jul 5 2002), @strong{no} distribution that we know of ships a flex
that generates gcc-3.1.x compliant C++ code.
-@item Python (version 1.5 or newer).
+@item Python (version 2.1 or newer).
Check out @uref{http://www.python.org, the python website}.
-@item GUILE (version 1.4 or newer).
+@item GUILE (version 1.6 or newer).
Check out
@uref{http://www.gnu.org/software/guile/guile.html,the GUILE webpage}.
<!--- @@WEB-TITLE@@=Reference Manual --->
@end html
+
This document describes GNU LilyPond and its input format. The last
revision of this document was made for LilyPond 1.7.10. It assumes
that you already know a little bit about LilyPond input (how to
\score { \notes <
\context FiguredBass {
\figures {
- <_! 3+ 5- _ 7! 9 >4
- < [4 6] >
+ <3 [5 7]>
+\once \property FiguredBass.BassFigure \set #'direction = #-1
+ <3 [5 7]>
+ <3 [5] 7 [9 11]>
+ <3+ 5- 7!>
+ <3 _ 5 _ 7>
+% <3 [4 6] 7>
}
}
- \context Voice {
+ \context Voice { \clef bass
c 4
+ c c c c c
g8
}
+/*
+figured-bass-engraver.cc -- implement Figured_bass_engraver
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2002, 2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
#include "engraver.hh"
#include "text-item.hh"
#include "event.hh"
#include "item.hh"
+#include "translator-group.hh"
class Figured_bass_engraver : public Engraver
{
-
TRANSLATOR_DECLARATIONS(Figured_bass_engraver);
protected:
Link_array<Music> figures_;
}
else if (figures_.size ())
{
- figure_ = new Item (get_property ("BassFigure"));
- SCM l = SCM_EOL;
+ SCM proc = get_property ("bassFigureFormatFunction");
+ if (gh_procedure_p (proc))
+ {
+ SCM l = SCM_EOL;
+
+ for (int i = 0; i <figures_.size (); i++)
+ l = gh_cons (figures_[i]->self_scm(), l);
+
+ SCM markup = scm_call_2 (proc, l, daddy_trans_->self_scm ());
- for (int i = 0; i <figures_.size (); i++)
- l = gh_cons (figures_[i]->self_scm(), l);
- figure_->set_grob_property ("causes", l);
-
- announce_grob(figure_, figures_[0]->self_scm()); // todo
+ figure_ = new Item (get_property ("BassFigure"));
+ figure_->set_grob_property ("text", markup);
+ announce_grob(figure_, figures_[0]->self_scm()); // todo
+ }
}
}
/* creats*/ "BassFigure",
/* accepts */ "rest-event bass-figure-event",
/* acks */ "",
-/* reads */ "",
+/* reads */ "bassFigureFormatFunction",
/* write */ "");
stringTunings = #guitar-tunings
tablatureFormat = #fret-number-tablature-format
+ %%
+ bassFigureFormatFunction = #make-bass-figure-markup
+
+
\grobdescriptions #all-grob-descriptions
}
dot_diam# = 7/8flare#;
define_pixels(dot_diam);
-code := 32;
+code := 31; % , 32
fet_beginchar("Space", "space", "space")
set_char_box(0, space#, 0,height#);
fet_endchar;
;;;; figured bass support ...
-;;;; todo: make interfaces as 1st level objects in LilyPond.
+(ly:add-interface
+'bass-figure-interface
+ "A bass figure, including bracket"
+ '())
+
+(define (recursive-split-at pred? l)
+ (if (null? l)
+ '()
+ (let*
+ ((x (split-at pred? l)))
+ (set-cdr! x (recursive-split-at pred? (cdr x)))
+ x
+ )))
-(define (brew-one-figure grob fig-music)
- "Brew a single column for a music figure"
- (let* (
- (chain (Font_interface::get_property_alist_chain grob))
- (mf (ly:get-font grob (cons '((font-family . music) (font-magnification . 0.8))
- chain
- )))
- (nf (ly:get-font grob
- (cons '((font-family . number))
- chain)))
- (mol (ly:make-molecule '() '(0 . 0) '(0 . 1.0)))
+(define-public (make-bass-figure-markup figures context)
+ (define (no-end-bracket? f1 f2)
+ (eq? (ly:get-mus-property f1 'bracket-stop) '())
+ )
+ (define (no-start-bracket? f1 f2)
+ (eq? (ly:get-mus-property f2 'bracket-start) '())
+ )
+
+ ;; TODO: support slashed numerals here.
+ (define (fig-to-markup fig-music)
+ (let*
+ (
(fig (ly:get-mus-property fig-music 'figure))
(acc (ly:get-mus-property fig-music 'alteration))
+ (acc-markup #f)
+ (fig-markup
+ (if (number? fig)
+ (make-number-markup (number->string fig))
+ (make-simple-markup " ")
+ ))
)
-
- (if (number? fig)
- (begin
- (set! mol (fontify-text nf (number->string fig)))
- (ly:molecule-align-to! mol Y CENTER)
- ))
-
- (if (number? acc)
- (set! mol
- (ly:molecule-combine-at-edge
- mol X RIGHT (ly:find-glyph-by-name mf (string-append "accidentals-" (number->string acc)))
- 0.2))
- )
- (if (ly:molecule? mol)
- (ly:molecule-align-to! mol X CENTER)
- )
- mol))
-(define (brew-bass-figure grob)
- "Make a molecule for a Figured Bass grob"
- (let* (
- (figs (ly:get-grob-property grob 'causes ))
- (mol (ly:make-molecule '() '(0 . 0) '(0 . 0)))
- (padding (ly:get-grob-property grob 'padding))
- (kerning (ly:get-grob-property grob 'kern))
- (thickness (*
- (ly:get-paper-variable grob 'linethickness)
- (ly:get-grob-property grob 'thickness))
- )
- (dir (ly:get-grob-property grob 'direction))
+ (if (number? acc)
+ (make-line-markup (list fig-markup
+ (alteration->text-accidental-markup acc)))
+ fig-markup)
+ ))
+
+ (define (fig-seq-to-markup figs)
+ (let*
+ (
+ (c (make-dir-column-markup (map fig-to-markup figs)))
)
-
- (define (brew-complete-figure grob figs mol)
- "recursive function: take some stuff from FIGS, and add it to MOL."
- (define (end-bracket? fig)
- (eq? (ly:get-mus-property fig 'bracket-stop) #t)
- )
-
- (if (null? figs)
- mol
- (if (eq? (ly:get-mus-property (car figs) 'bracket-start) #t)
- (let* (
- (gather-todo (take-from-list-until figs '() end-bracket?))
- (unbr-mols
- (map
- (lambda (x) (brew-one-figure grob x))
- (reverse! (car gather-todo) '())))
- (br-mol (bracketify-molecule
- (stack-molecules Y dir kerning unbr-mols)
- Y thickness (* 2 padding) padding))
- )
- (brew-complete-figure
- grob (cdr gather-todo)
- (ly:molecule-combine-at-edge mol Y dir br-mol kerning)
- )
- )
- (brew-complete-figure
- grob (cdr figs)
- (ly:molecule-combine-at-edge mol Y dir (brew-one-figure grob (car figs))
- kerning))
- )
- ))
-
-
- (set! mol (brew-complete-figure grob (reverse figs) mol))
- (ly:molecule-align-to! mol Y (- dir))
- mol
+ (if (eq? (ly:get-mus-property (car figs) 'bracket-start) #t)
+ (make-bracket-markup c)
+ c
+ )))
+
+ (let*
+ (
+ (ends (recursive-split-at no-end-bracket? (reverse figures)))
+ (starts (map (lambda (x) (recursive-split-at no-start-bracket? x)) ends))
+ )
+ (make-dir-column-markup (map fig-seq-to-markup (apply append starts)))
))
-
-(ly:add-interface
-'bass-figure-interface
- "A bass figure, including bracket"
- '(padding thickness direction))
-1
0))
+
+(define-public (alteration->text-accidental-markup alteration)
+ (make-smaller-markup
+ (make-raise-markup
+ (if (= alteration -1)
+ 0.3
+ 0.6)
+ (make-musicglyph-markup
+ (string-append "accidentals-" (number->string alteration))))))
+
(define (accidental->markup alteration)
"Return accidental markup for ALTERATION."
(if (= alteration 0)
(make-line-markup (list empty-markup))
(conditional-kern-before
- (make-smaller-markup
- (make-raise-markup
- (if (= alteration -1)
- 0.3
- 0.6)
- (make-musicglyph-markup
- (string-append "accidentals-" (number->string alteration)))))
+ (alteration->text-accidental-markup alteration)
(= alteration -1) 0.2
)))
(BassFigure
. (
- (molecule-callback . ,brew-bass-figure)
+ (molecule-callback . ,brew-new-markup-molecule)
(Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
(direction . 1)
(font-family . number)
(font-relative-size . -1)
- (padding . 0.1)
(kern . 0.2)
- (thickness . 1.0)
(meta . ((interfaces . (text-interface rhythmic-grob-interface
bass-figure-interface item-interface
self-alignment-interface font-interface))))
-;;;; lily.scm -- implement Scheme output routines for TeX and PostScript
+;;; lily.scm -- implement Scheme output routines for TeX and PostScript
;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
(Text_item::text_to_molecule grob props (car rest))
)
+
(define-public (stack-molecule-line space molecules)
(if (pair? molecules)
(if (pair? (cdr molecules))
(map (lambda (x) (interpret-markup grob props x)) (car rest)))
)
+(define-public (dir-column-markup grob props . rest)
+ "Make a column of args, going up or down, depending on DIRECTION."
+ (let*
+ (
+ (dir (cdr (chain-assoc 'direction props)))
+ )
+ (stack-lines
+ (if (number? dir) dir -1)
+ 0.0 (cdr (chain-assoc 'baseline-skip props))
+ (map (lambda (x) (interpret-markup grob props x)) (car rest)))
+ ))
+
(define-public (center-markup grob props . rest)
(let*
(
(car rest))
)
+
(define-public (lookup-markup grob props . rest)
"Lookup a glyph by name."
(ly:find-glyph-by-name
(cons bracket-markup (list markup?))
(cons column-markup (list markup-list?))
+ (cons dir-column-markup (list markup-list?))
(cons center-markup (list markup-list?))
(cons line-markup (list markup-list?))