From: Han-Wen Nienhuys Date: Sat, 8 Mar 2003 01:55:55 +0000 (+0000) Subject: * scm/chords-ignatzek.scm (alteration->text-accidental-markup): X-Git-Tag: release/1.7.15~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=66354f084f87e23fe64863952a4ab18cd0c5e82b;p=lilypond.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 3e070f3a3f..89f68e25e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-03-08 Han-Wen Nienhuys + + * 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 * ly/engraver-init.ly: use Hara kiri by default for diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index eefc5e5637..174ede68d3 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -150,10 +150,10 @@ distribution supports g++ 3.x and flex. At the time of writing (Fri 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}. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 5a4a5e6d53..131a0b2d4f 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -21,6 +21,7 @@ @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 diff --git a/input/regression/figured-bass.ly b/input/regression/figured-bass.ly index ddfe89032d..9f454db3c2 100644 --- a/input/regression/figured-bass.ly +++ b/input/regression/figured-bass.ly @@ -12,13 +12,19 @@ numbers, like @code{<4 6+>}. \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 } diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index b65a03dad8..dacd7ad867 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -1,11 +1,20 @@ +/* +figured-bass-engraver.cc -- implement Figured_bass_engraver + +source file of the GNU LilyPond music typesetter + +(c) 2002, 2003 Han-Wen Nienhuys + + */ + #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 figures_; @@ -65,14 +74,20 @@ Figured_bass_engraver::process_music () } 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 self_scm(), l); + + SCM markup = scm_call_2 (proc, l, daddy_trans_->self_scm ()); - for (int i = 0; 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 + } } } @@ -82,5 +97,5 @@ ENTER_DESCRIPTION(Figured_bass_engraver, /* creats*/ "BassFigure", /* accepts */ "rest-event bass-figure-event", /* acks */ "", -/* reads */ "", +/* reads */ "bassFigureFormatFunction", /* write */ ""); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 3a4c4d764c..7358d74550 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -452,6 +452,10 @@ ScoreContext = \translator { stringTunings = #guitar-tunings tablatureFormat = #fret-number-tablature-format + %% + bassFigureFormatFunction = #make-bass-figure-markup + + \grobdescriptions #all-grob-descriptions } diff --git a/mf/feta-nummer-code.mf b/mf/feta-nummer-code.mf index aef2e9168b..236d9da5be 100644 --- a/mf/feta-nummer-code.mf +++ b/mf/feta-nummer-code.mf @@ -175,7 +175,7 @@ save dot_diam; 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; diff --git a/scm/bass-figure.scm b/scm/bass-figure.scm index 2753dc5e11..cfe44b6b94 100644 --- a/scm/bass-figure.scm +++ b/scm/bass-figure.scm @@ -1,92 +1,62 @@ ;;;; 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)) diff --git a/scm/chords-ignatzek.scm b/scm/chords-ignatzek.scm index 3549a779c6..99d3b90ef6 100644 --- a/scm/chords-ignatzek.scm +++ b/scm/chords-ignatzek.scm @@ -4,18 +4,22 @@ -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 ))) diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 61be7083c4..44bc694e13 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -115,14 +115,12 @@ (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)))) diff --git a/scm/lily.scm b/scm/lily.scm index 19a599ecc7..df687d0f6b 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -1,4 +1,4 @@ -;;;; 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 ;;;; diff --git a/scm/new-markup.scm b/scm/new-markup.scm index 7afe63a25a..5cccdc2697 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -49,6 +49,7 @@ for the reader. (Text_item::text_to_molecule grob props (car rest)) ) + (define-public (stack-molecule-line space molecules) (if (pair? molecules) (if (pair? (cdr molecules)) @@ -142,6 +143,18 @@ for the reader. (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* ( @@ -160,6 +173,7 @@ for the reader. (car rest)) ) + (define-public (lookup-markup grob props . rest) "Lookup a glyph by name." (ly:find-glyph-by-name @@ -429,6 +443,7 @@ for the reader. (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?))