]> git.donarmstrong.com Git - lilypond.git/commitdiff
use new syntax.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 8 Dec 2002 23:01:01 +0000 (23:01 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 8 Dec 2002 23:01:01 +0000 (23:01 +0000)
15 files changed:
ChangeLog
input/regression/new-markup-syntax.ly
input/test/chord-markup.ly
input/test/dynamic-extra.ly
input/test/markup.ly
input/test/metronome.ly
input/test/new-markup.ly [deleted file]
input/test/script-priority.ly
input/test/super-sub.ly [deleted file]
input/test/textscript.ly
lily/molecule-scheme.cc
lily/parser.yy
ly/params-init.ly
scm/new-markup.scm
tex/lilyponddefs.tex

index f49f6842a67df129d0a0d1ca120f4ba5f9d06a13..8433ef7762d271c20ade78ef8e22b860ba24c3dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2002-12-09  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * input/test/markup.ly: use new syntax.
+
+2002-12-08  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * ly/params-init.ly (interscoreline): add word-space
+
+       * input/test/metronome.ly (eighthNote): idem.
+
+       * input/test/script-priority.ly: use new markup
+
+       * lily/parser.yy (markup): allow HEAD markup0 markup1 
+
+       * lily/molecule-scheme.cc (ly:molecule-translate): new function.
+
+       * lily/parser.yy (gen_text_def): bugfix.
+       (full_markup): allow markup identifier.
+
 2002-12-09  Heikki Junes <hjunes@cc.hut.fi>
 
        * lilypond-mode.el (LilyPond-kill-job): Kill all Lilypond compiling
index b9a482aef61327a2a4feb8e5703a7fc009c8a453..9235105a2bbe94ef180e78f232ce103c44a7427a 100644 (file)
@@ -17,6 +17,10 @@ texidoc = "New markup syntax."
                        \lookup #"noteheads-0"
                        \char #53
                }
+
+               \combine "X" "+"   
+               \combine "o" "/"
+               "$\\emptyset$"
                \italic Norsk
                \dynamic sfzp
        }       
index e60b94d7514cbb47f5de2e88b1fd84f6921a75a1..8304d904e58f387874e3e0db2f5401cb209a53b9 100644 (file)
@@ -8,14 +8,14 @@
 \score{
     <
        \context Staff \notes \relative c'' {
-           c^#'(columns "foe" ((raise . 3) "bar"))
+           c^\markup {  "foe" \raise #3 "bar" }
            c
-           c^#'(columns "foe" (super "12") (sub "3 4"))
+           c^\markup { "foe" \super "12" \sub { "3 4" } }
            c
 
            %% broken for now
-           %%  c^#`(columns (lines "" ";" "") (lines "1" (bold "2") "3"))
-           c^#`(columns (lines "" ";" "") (lines "1" (columns (bold "2")) "3"))
+           c^\markup { \column < "" ";" "" >
+                       \column <  "1"  { \bold "2" "3" } > }
                }
        \context ChordNames \chords {
            c:7+.9-^3.5
index 8bc998acb92591448be27071089d4bf4b98e1af5..552a5ddd296ff7a0b1b7b59bd830f5237fef1ad4 100644 (file)
@@ -3,12 +3,10 @@
     texidoc = "Additional tricks for dynamics.  Pi`u forte dynamic script"
 }
 
-piuf = #'(columns (italic "pi\\`u") " " (dynamic "f"))
+piuf = \markup {  \italic "pi\\`u" \dynamic "f" }
 
 \score{
     \notes\relative c''{
-       c4-#'(italic "pi\\`u")-\f
-       c-#'(columns (italic "pi\\`u") " " (dynamic "f"))
        c-\piuf
        c
        c2\< \! c2
index 45ae734ef8b0b1f5a8e224ea387fb451b4c8125d..2e5fcab5e733cfa7ae0882f49efac49a38f0acd4 100644 (file)
@@ -1,65 +1,37 @@
 \version "1.7.6"
 
 \header {
-  texidoc ="Test font selection and scm text markup"
+  texidoc ="Test font selection and scm text markup
+"
 }
 
 
 \score{
   \notes\relative c''{
     \stemUp
-                               % {
     a-"text"
-    b-#"texta"
-    c-#'(bold "textb")
+    b-"texta"
+    c-\markup \bold "textb"
+
+    d-\markup { "one" "two" "three" } |
+    e1-\markup { \column < \bold "one"
+    { "and" "there" "is" \override #'(font-family . number) "2" }
+       \italic "three" > }
+    e2.
+    f4-\markup \teeny \number "3"
+    f2.
+    b4-\markup { "a" \hspace #-8 \raise #2 "b"  "c" }
+    b4-\markup { "1" \raise #-2 \hspace #-1 "2"  "3" }
+    d4-\markup { \column <  "Violoncello" "    e" "Contrabasso" > }
+    d4_\markup {\override #'(baseline-skip . 0.0)
+               \override #'(word-space . 1.5)
+               \column <  "Violoncello" "    e" "Contrabasso" > }
 
-    d-#'(lines "one" "two" "three")
-    e-#'(lines (bold "one") 
-    (columns "and" "there" "is" ((font-family . number) "2"))
-    (italic "three"))
-    f-#'(finger "3")
-    g-#'(music (named "noteheads-2"
-    ((kern . -0.1) "flags-stem")
-    (((kern . -0.1) (raise . 3.5)) "flags-u3")))
-    b-#'(columns "a" (((kern . 3) (raise . 2)) "b") "c")
-    c-#'(columns "1" (((raise . -2) (kern . -1)) "2") "3")
-                               % }
-    d-#'(lines "Violoncello" "    e" "Contrabasso")
-    e-#'((lines (baselineskip . 0) (kern . 1.5)) "Violoncello" "    e" "Contrabasso")
-    e-#'(((baselineskip . 0) (kern . 1.5) lines) "Violoncello" "    e" "Contrabasso")
-    g-"ÅÖÄÜÇÕ"
-    c,,
-    c1 c1
-    
-    \stemUp
-    c4^#'(lines "1" "" "2")
-    c^#'(lines "3" "4" "5")
-    \stemDown
-    c_#'(lines "6" "" "7")
-    c_#'(lines "8" "9" "0")
     
-    \stemUp
-    c4^#'(lines "1" "")
-    c^#'(lines "2" "3")
-    \stemDown
-    c_#'(lines "" "4")
-    c_#'(lines "5" "6")
+    g1-"ÅÖÄÜÇÕ"
+    c,,
+    c1 
     
-    c^#'(columns "foe" ((raise . 3) "bar"))
-    c^#'(columns "foe" (super "12") (sub "3 4"))
-    %% UGHUGH
-    c^#'(columns "foe" (super ((raise . 1) "12")) (sub ((raise . -1) "3 4")))
-    c^#'(columns "foe" (super (overstrike "o") "/") (sub "x"))
-    c^#'(columns "foe" (overstrike "o") "/")
-    c^#'(columns "foe" ((bold roman overstrike) "o") "/")
-    c^#'(columns "foe" ((extent . (0 . 0)) "o") "/")
-    c^#'(columns "foo" (super "bar" (super "baz")))
-    c
-    %% c^#`(columns (lines "" ";" "") (lines "1" ((bold) "2") "3"))
-    c^#`(columns (lines "" ";" "") (lines "1" "2" "3"))
-    c^#`(columns (lines "" ";" "") (lines "1" (bold "2") "3"))
-    c^#`(columns (lines "" ";" "") (lines "1" (columns (bold "2")) "3"))
-       
     
   }
   \paper{
index 65fd4ee4dc9b969be8de8cb3327ddbfaee4a1cb5..3325a056f65b696c26427401b296d99fc0839c78 100644 (file)
 %
 % FIXME: put in an item, and typeset by an engraver.
 
-#(define note '(columns (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
-#(define eight-note `(columns ,note ((kern . -0.1) (music ((raise . 3.5) "flags-u3")))))
-#(define dotted-eight-note `(columns ,eight-note (music "dots-dot")))
+eigthStem = \markup \combine
+       \musicglyph #"flags-stem"
+       \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
+eighthNote = \markup
+       \override #'(word-space . 0.0)
+       { \musicglyph #"noteheads-2"
+         \translate #'(-0.05 . 0.1) \eigthStem }
 
 \score {
   \notes\relative c'' {
-    a1^#`((columns (font-relative-size . -1)) ,dotted-eight-note " = 64")
+    a1^\markup { \magnify #0.9 \eighthNote " = 64" }
   }
   \paper {
     linewidth = -1.
diff --git a/input/test/new-markup.ly b/input/test/new-markup.ly
deleted file mode 100644 (file)
index 3dca2cd..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-\version "1.7.7"
-\header {
-    texidoc =" New markup scheme. Semantically more sane. We haven't
-    invented a nice syntax yet."
-}
-
-\score {
-  \notes \context Voice {
-     \property Voice.TextScript \set #'molecule-callback = #brew-new-markup-molecule
-     c4^#`(,simple-markup "foo")
-     c4^#`(,column-markup (
-                          (,bold-markup (,simple-markup "foo"))
-                          (,simple-markup "bar")))
-     }
-}
index 7f4606d5c52b5809cb13b817eec082dbf683e1ac..62be41769f39d0af4a76edca47de68a18eb92f4c 100644 (file)
@@ -4,17 +4,19 @@
 by overriding script-priority."
 }
 \paper { linewidth = -1. } 
+
 \score{
     \context Staff \notes \relative g''{
        
        \property Score.TextScript \override #'script-priority = #-100
-       a4^\prall^#'((music (font-relative-size . -2)) "accidentals-1")
+       a4^\prall^\markup \fontsize #-2 \musicglyph #"accidentals-1"
 
        
        \property Score.Script \override #'script-priority = #-100
        \property Score.TextScript \revert #'script-priority
        
-       a4^\prall^#'((music (font-relative-size . -2)) "accidentals-1")
+       a4^\prall^\markup \fontsize  #-2 \musicglyph #"accidentals-1"
     }
 }
+
 %% new-chords-done %%
diff --git a/input/test/super-sub.ly b/input/test/super-sub.ly
deleted file mode 100644 (file)
index d68dba8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-\version "1.7.6"
-\header {
-texidoc="Test super/sub, raise and overstrike."
-}
-
-
-
-\score {
-  \notes \relative a'' {
-    c^#'("bar")
-    c^#'(("bar"))
-    c^#'((("bar")))
-    c^#'(bold "bar")
-    c^#'((bold) "bar")
-    c^#'(((bold)) "bar")
-    c^#'(bold ("bar"))
-    c^#'(bold "bar")
-    c^#'(columns "foe" ((raise . 3) "bar"))
-    c^#'(columns "foe" (((raise . 3) "bar")))
-    c^#'(columns "foe" (((raise . 3)) "bar"))
-    c^#'(columns "foe" (super "12") (sub "3 4"))
-    c^#'(columns "foe" (super (overstrike "o") "/") (sub "x"))
-    c^#'(columns "foe" (overstrike "o") "/")
-    c^#'(columns "foe" ((bold roman overstrike) "o") "/")
-    c^#'(columns "foe" ((extent . (0 . 0)) "o") "/")
-    c^#'(columns "foo" (super "bar" (super "baz")))
-    c
-    %% Hmm
-    c^#`(columns (lines "" ";" "") (lines "1" ((bold) "2") "3"))
-    c^#`(columns (lines "" ";" "") (lines "1" (columns (bold "2")) "3"))
-  }
-}%% new-chords-done %%
index 96efbdd31d8d974d9e5cbe5ca93d965051bb7ead..753a10fd00d258935ba51e5340297e9b48e757ea 100644 (file)
@@ -1,23 +1,16 @@
 \version "1.7.6"
-
-
-%
-% Test font selection and scm text markup
-%
+\header {
+texidoc = "Test font selection and scm text markup"
+}
 
 \score{
   \notes\relative c''{
-    c'1^#'(columns (dynamic "p") " ma sosten.") 
-    c^#'(bold "ABCD")
-    c^#'(columns "Dal " (music "scripts-segno")) 
-    c^#'(Large "ABCD") 
-    \break
     \property Voice . TextScript \override #'font-shape = #'upright
-    c1^#'(columns (dynamic "p") " ma sosten.")  
-    c^#'(bold "ABCD")
+    c1^\markup { \dynamic "p" "ma sosten." }  
+    c^\markup \Large "ABCD" 
     \property Voice . TextScript \override #'font-series = #'bold
-    c^#'(columns "Dal " (music "scripts-segno")) 
-    c^#'(Large "ABCD")
+    c^\markup { \bold "Dal" " " \raise #0.8 \musicglyph #"scripts-segno" }
+    c^\markup \huge "ABCD"
   }
 }
 %% new-chords-done %%
index 353b9a589d5c8fba5d632d3f2e0034b9d0a6bd8d..312de70b1e263e8b257ab37ee769f55b6e3c4a27 100644 (file)
@@ -30,7 +30,7 @@ LY_DEFINE(ly_set_molecule_extent_x,"ly:set-molecule-extent!", 3 , 0, 0,
 }
 
 
-LY_DEFINE(ly_translate_molecule,"ly:molecule-translate-axis", 3, 0, 0, 
+LY_DEFINE(ly_translate_molecule_axis,"ly:molecule-translate-axis", 3, 0, 0, 
          (SCM mol, SCM amount, SCM axis),
          "Return a @var{mol}, but translated by @var{amount} in @var{axis} direction")
 {
@@ -46,6 +46,20 @@ LY_DEFINE(ly_translate_molecule,"ly:molecule-translate-axis", 3, 0, 0,
   return q.smobbed_copy();
 }
 
+LY_DEFINE(ly_translate_molecule,"ly:molecule-translate", 2, 0, 0, 
+         (SCM mol, SCM offset),
+         "Return a @var{mol}, but translated by @var{offset} (a pair of numbers).")
+{
+  Molecule* m = unsmob_molecule (mol);
+  SCM_ASSERT_TYPE (m, mol, SCM_ARG1, __FUNCTION__, "molecule");
+  SCM_ASSERT_TYPE (ly_number_pair_p (offset), offset, SCM_ARG2, __FUNCTION__, "number pair");
+  Offset o = ly_scm2offset (offset);
+  
+  Molecule q (*m);
+  q.translate (o);
+  return q.smobbed_copy();
+}
+
 LY_DEFINE(ly_get_molecule_extent,
          "ly:get-molecule-extent", 2 , 0, 0,  (SCM mol, SCM axis),
          "Return a pair of numbers signifying the extent of @var{mol} in "
index 174e84ac2c5408d5b06a406b9fc8523575b7c71b..3483bbc3f67845178f1445780cdc856bb651bca5 100644 (file)
@@ -1648,7 +1648,11 @@ gen_text_def:
                $$ = t; 
        }
        | string {
-               $$ = make_simple_markup ($1);
+               Music *t = MY_MAKE_MUSIC("TextScriptEvent");
+               t->set_mus_property ("text", make_simple_markup ($1));
+               t->set_spot (THIS->here_input ());
+               $$ = t;
+       
        }
        | DIGIT {
                Music * t = MY_MAKE_MUSIC("FingerEvent");
@@ -2169,7 +2173,10 @@ questions:
 
 
 full_markup:
-       MARKUP 
+       MARKUP_IDENTIFIER {
+               $$ = $1;
+       }
+       | MARKUP 
                { THIS->lexer_->push_markup_state (); }
        markup
                { $$ = $3;
@@ -2184,6 +2191,9 @@ markup:
        | MARKUP_HEAD_MARKUP0 markup {
                $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
        }
+       | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
+               $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
+       }
        | MARKUP_HEAD_SCM0_MARKUP1 SCM_T markup {
                $$  = scm_list_n ($1, $2, $3, SCM_UNDEFINED); 
        }
index 555a5dd71bb4e815efd314b3a863778fd3c083e6..e45871fd43af9ea24b91846605dd9d7b4ffaa8b0 100644 (file)
@@ -53,13 +53,14 @@ interscoreline = 4. \mm
 
 
 %%
-%% TODO: baseline-skip should come from the font.
+%% TODO: baseline-skip, word-space should come from the font.
 %%
 #(define font-defaults
       '((font-family . music)
        (font-relative-size . 0)
        (font-shape . upright)
-       (baseline-skip . 2) 
+       (baseline-skip . 2)
+       (word-space . 0.6)
        (font-series . medium)
        ))
 
index 5f90f7f3e052b8c77ba9af0df11c519cd8793927..7e3b37b6355cf854f386b2c125bfb0940a4940fe 100644 (file)
@@ -2,9 +2,26 @@
   (Text_item::text_to_molecule grob props (car rest))
   )
 
+(define-public (stack-molecule-line space molecules)
+  (if (pair? molecules)
+      (if (pair? (cdr molecules))
+         (let* (
+                (tail (stack-molecule-line  space (cdr molecules)))
+                (head (car molecules))
+                (xoff (+ space (cdr (ly:get-molecule-extent head X))))
+                )
+           
+           (ly:add-molecule
+            head
+            (ly:molecule-translate-axis tail xoff X))
+         )
+         (car molecules))
+      '())
+  )
+
 (define-public (line-markup grob props . rest)
-  (stack-molecules
-   X 1 1.0 
+  (stack-molecule-line
+   (cdr (chain-assoc 'word-space props))
    (map (lambda (x) (interpret-markup grob props x)) (car rest)))
   )
 
       ))
 
 (define-public (combine-markup grob props . rest)
-   (combine-molecule-list (map (lambda (x) (interpret-markup grob props x)) (car rest))))
+  (ly:add-molecule
+   (interpret-markup grob props (car rest))
+   (interpret-markup grob props (cadr rest))))
+  
+;   (combine-molecule-list (map (lambda (x) (interpret-markup grob props x)) (car rest))))
 
 (define (font-markup qualifier value)
   (lambda (grob props . rest)
   
   ))
 
-(define-public (magnify-markup grob props . rest  )
-  (interpret-markup grob
-                   (cons (cons `(font-magnification . ,(car rest))
-                               (car props)) (cdr props))
-                   (cadr rest))
-  )
+
+(define-public (set-property-markup qualifier)
+  (lambda (grob props . rest  )
+    (interpret-markup grob
+                     (cons (cons `(,qualifier . ,(car rest))
+                                 (car props)) (cdr props))
+                     (cadr rest))
+    ))
+
+
+(define-public fontsize-markup (set-property-markup 'font-relative-size))
+(define-public magnify-markup (set-property-markup 'font-magnification))
 
 (define-public bold-markup
   (font-markup 'font-series 'bold))
+(define-public number-markup
+  (font-markup 'font-family 'number))
+
+
+(define-public huge-markup
+  (font-markup 'font-relative-size 2))
+(define-public large-markup
+  (font-markup 'font-relative-size 1))
+(define-public small-markup
+  (font-markup 'font-relative-size -1))
+(define-public tiny-markup
+  (font-markup 'font-relative-size -2))
+(define-public teeny-markup
+  (font-markup 'font-relative-size -3))
 (define-public dynamic-markup
   (font-markup 'font-family 'dynamic))
 (define-public italic-markup
@@ -44,7 +85,7 @@
    (map (lambda (x) (interpret-markup grob props x)) (car rest)))
   )
 
-(define-public (music-markup grob props . rest)
+(define-public (musicglyph-markup grob props . rest)
   (ly:find-glyph-by-name
    (ly:get-font grob (cons '((font-family . music)) props))
    (car rest))
   )
 
 (define-public (char-markup grob props . rest)
+  "Syntax: \\char NUMBER. "
   (ly:get-glyph  (ly:get-font grob props) (car rest))
                 
   )
 (define-public (raise-markup grob props  . rest)
+  "Syntax: \\raise AMOUNT MARKUP. "
   (ly:molecule-translate-axis (interpret-markup grob props (cadr rest))
                              (car rest) Y)
   )
 
-;; this is too simplistic: doesn't do backup for negative dimensions.
-(define (hspace-markup grob props . rest)
-  (ly:make-molecule "" (cons 0 (car rest)) '(-1 . 1) )
+(define-public (super-markup grob props  . rest)
+  "Syntax: \\super MARKUP. "
+  (ly:molecule-translate-axis (interpret-markup grob props (car rest))
+                             (* 0.5 (cdr (chain-assoc 'baseline-skip props)))
+                             Y)
   )
 
+(define-public (translate-markup grob props . rest)
+  "Syntax: \\translate OFFSET MARKUP. "
+  (ly:molecule-translate (interpret-markup  grob props (cadr rest))
+                        (car rest))
+
+  )
+
+(define-public (sub-markup grob props  . rest)
+  "Syntax: \\sub MARKUP."
+  (ly:molecule-translate-axis (interpret-markup grob props (car rest))
+                             (* -0.5 (cdr (chain-assoc 'baseline-skip props)))
+                             Y)
+  )
+
+;; todo: fix negative space
+(define (hspace-markup grob props . rest)
+  "Syntax: \\hspace NUMBER."
+  (let*
+      ((amount (car rest)))
+    (if (> amount 0)
+       (ly:make-molecule "" (cons 0 amount) '(-1 . 1) )
+       (ly:make-molecule "" (cons amount amount) '(-1 . 1)))
+  ))
+
 (define-public (override-markup grob props . rest)
   "Tack the 1st args in REST onto PROPS."
   (interpret-markup grob (cons (list (car rest)) props)
 (map (lambda (x)
        (set-object-property! (car x) 'markup-signature (cdr x))
        )
-     (list (cons bold-markup 'markup0)
-          (cons column-markup 'markup-list0)
-          (cons line-markup  'markup-list0)
-          (cons combine-markup 'markup0-markup1)
-          (cons simple-markup 'markup0)
-          (cons music-markup 'scm0)
-          (cons override-markup 'scm0-markup1)
-          (cons lookup-markup 'scm0)
-          (cons raise-markup 'scm0-markup1)
-          (cons italic-markup 'markup0)
-          (cons dynamic-markup 'markup0)
-          (cons char-markup 'scm0)
-          (cons hspace-markup 'scm0)
-          (cons magnify-markup 'scm0-markup1)
-          ))
+     (list
+      (cons bold-markup 'markup0)
+      (cons teeny-markup 'markup0)
+      (cons tiny-markup 'markup0)
+      (cons small-markup 'markup0)
+      (cons italic-markup 'markup0)
+      (cons dynamic-markup 'markup0)
+      (cons large-markup 'markup0) 
+      (cons huge-markup 'markup0) 
+      (cons sub-markup 'markup0)
+      (cons super-markup 'markup0)
+      (cons number-markup 'markup0)
+
+      (cons column-markup 'markup-list0)
+      (cons line-markup  'markup-list0)
+
+      (cons combine-markup 'markup0-markup1)
+
+      (cons simple-markup 'markup0)
+      (cons musicglyph-markup 'scm0)
+      (cons translate-markup 'scm0-markup1)
+      (cons override-markup 'scm0-markup1)
+      (cons lookup-markup 'scm0)
+      (cons raise-markup 'scm0-markup1)
+      (cons char-markup 'scm0)
+      (cons hspace-markup 'scm0)
+      (cons magnify-markup 'scm0-markup1)
+      (cons fontsize-markup 'scm0-markup1)
+      (cons translate-markup 'scm0-markup1)
+      ))
 
 
 (define markup-module (current-module))
index 8f6bae4167d6754e7fb9a707d10f7252cd76fdc9..880545417ff9cef62406c58d6b3dbf1ef032a038 100644 (file)
   \lilypondnext
 }
 
-\newread\lilypondinput
-
 % the following macro is executed only once
 \gdef\lilypondspecial{
   \special{header=music-drawing-routines.ps}
       {\input lily-ps-defs }
       {
         \pdfoutput = 1
-        \input lily-pdf-defs
+        \input lily-pdf-defs %
       }
   }
   {}