]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/chords-ignatzek.scm (alteration->text-accidental-markup):
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Mar 2003 01:55:55 +0000 (01:55 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 8 Mar 2003 01:55:55 +0000 (01:55 +0000)
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.

12 files changed:
ChangeLog
Documentation/topdocs/INSTALL.texi
Documentation/user/refman.itely
input/regression/figured-bass.ly
lily/figured-bass-engraver.cc
ly/engraver-init.ly
mf/feta-nummer-code.mf
scm/bass-figure.scm
scm/chords-ignatzek.scm
scm/grob-description.scm
scm/lily.scm
scm/new-markup.scm

index 3e070f3a3f372f6b84d0cd953fd8f166a28ddfdc..89f68e25e2e95e3c8537cec56d6dd91dda6caf31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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 
index eefc5e563791683d75f9a08b207fa8068ee0d2bd..174ede68d36ab2bc406780824e3acffe47f4a0b8 100644 (file)
@@ -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}.
 
index 5a4a5e6d53de9925c5f01e643006c438851519a5..131a0b2d4f9f277eef7a35964c8a2a71aca6671d 100644 (file)
@@ -21,6 +21,7 @@
 <!--- @@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
index ddfe89032dd1d23376411d371f2d90c01dd88d40..9f454db3c24d4694ab78ecffaa77f2b25d7a1a8d 100644 (file)
@@ -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
   }
  
index b65a03dad8411856407231ef966bb075d9e443c2..dacd7ad8679755f9c06e777458a3de2be0d5c6f4 100644 (file)
@@ -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 <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_;
@@ -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 <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
+       }
     }
 }
 
@@ -82,5 +97,5 @@ ENTER_DESCRIPTION(Figured_bass_engraver,
 /* creats*/       "BassFigure",
 /* accepts */     "rest-event bass-figure-event",
 /* acks  */      "",
-/* reads */       "",
+/* reads */       "bassFigureFormatFunction",
 /* write */       "");
index 3a4c4d764c11eb7590b0185efcb595e443e6ceba..7358d74550ddf84ee42eecc7aadf125011f12f26 100644 (file)
@@ -452,6 +452,10 @@ ScoreContext = \translator {
        stringTunings   = #guitar-tunings
        tablatureFormat = #fret-number-tablature-format
 
+       %%
+       bassFigureFormatFunction = #make-bass-figure-markup
+
+
        \grobdescriptions #all-grob-descriptions
 }
 
index aef2e9168be6f46225b8d1802643fde22e5767bd..236d9da5be0db438ace3377f7892b710d9da760e 100644 (file)
@@ -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;
index 2753dc5e11852e9fd6f95bffc5aed23d244642a3..cfe44b6b94d9796dfbefb716e9c65c3f5989faa2 100644 (file)
@@ -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))
index 3549a779c62348becf5286b6d6343538856183e3..99d3b90ef6e2361c1566090fd235dc6825eab8c3 100644 (file)
@@ -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
        )))
 
index 61be7083c4dcc4049f81a0d6a80b57c9156e41fa..44bc694e13c5d31975cfb1ed564ede3244db4159 100644 (file)
 
     (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))))
index 19a599ecc72c5b0ca34de929e182a6f0513d60c3..df687d0f6b579bdf4fa6eb2238c3058c2741e7a7 100644 (file)
@@ -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
 ;;;; 
index 7afe63a25a4bb349e5746ea257d770c52aba97f8..5cccdc2697756ef1d555d386a91e8cbb100d5440 100644 (file)
@@ -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?))