]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/text-engraver.cc (process_acknowledged_grobs): use new
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 7 Dec 2002 14:14:24 +0000 (14:14 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 7 Dec 2002 14:14:24 +0000 (14:14 +0000)
markup  for new markup texts.

* lily/mark-engraver.cc (process_music): idem

* lily/instrument-name-engraver.cc (create_text): idem

* scm/new-markup.scm (magnify-markup): new function.

* scm/molecule.scm (stack-lines): bugfix.

* lily/font-interface.cc (get_font): take font-magnification from
alist chain.

14 files changed:
ChangeLog
input/regression/font-magnification.ly
input/regression/markup-stack.ly
input/regression/new-markup-syntax.ly
lily/font-interface.cc
lily/include/text-item.hh
lily/instrument-name-engraver.cc
lily/mark-engraver.cc
lily/paper-column.cc
lily/parser.yy
lily/text-engraver.cc
lily/text-item.cc
scm/molecule.scm
scm/new-markup.scm

index 7478c88c9c6da6a20df6d03fde18ecaabda936b1..08ece5dc401b07628676ff78f57aefd109d7f1f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2002-12-07  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/text-engraver.cc (process_acknowledged_grobs): use new
+       markup  for new markup texts.
+
+       * lily/mark-engraver.cc (process_music): idem
+       
+       * lily/instrument-name-engraver.cc (create_text): idem
+
+       * scm/new-markup.scm (magnify-markup): new function.
+
+       * scm/molecule.scm (stack-lines): bugfix.
+
+       * lily/font-interface.cc (get_font): take font-magnification from
+       alist chain.
+
 2002-12-06  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * lily/molecule-scheme.cc: move scheme functions to separate file.
index c1ce9bb5fae621fcf64a5d6c48dab7c304fa7d39..cfc7a0e88d21c56637b2511fc3fd176b093ffe31 100644 (file)
@@ -9,8 +9,9 @@ c4
 \property Voice .NoteHead \set #'font-magnification = #0.8
 
 
+c4-"normal"
   % why doesn't this  work?
-  c4-#'((font-series . bold) ((font-magnification . 2.0) ("foobar")))
+  c4-\markup \bold \magnify #2.0 "foobar"
 
   \property Voice .NoteHead \set #'font-magnification = #1.2
   \property Voice.TextScript \set #'font-magnification = #2.0
@@ -22,4 +23,3 @@ c4
 }
 
 %% new-chords-done %%
-%% new-chords-done %%
index 30fc3806a428d80cb5c5f99c882c7deb165f9278..c7c63954187b2abafdde735a6c2fcd2e8afd220a 100644 (file)
@@ -1,6 +1,6 @@
 \version "1.7.6"
 \header {texidoc="Stacking of markup scripts."}
 \paper { linewidth=-1. }
-\score { \notes { c^#`(columns "" (lines "1" (bold "2") "3"))}}
+\score { \notes { c''^\markup { "a" \column < "1" \bold "2"  "3" > } } }
 
 %% new-chords-done %%
index 5a71629707d36ee0121c78dc1fee473c8bf27048..b9a482aef61327a2a4feb8e5703a7fc009c8a453 100644 (file)
@@ -11,7 +11,7 @@ texidoc = "New markup syntax."
     \property Voice.TextScript \set #'molecule-callback = #brew-new-markup-molecule
     f'-\markup { foo
                \raise #0.2 \bold bar
-               \column < baz bazr >
+               \override #'(baseline-skip . 4) \column < baz bazr bla >
                \hspace #2.0
                \override #'(font-family . music) {
                        \lookup #"noteheads-0"
index 65d4c6a5a89629fc40b4092a6a16f1014fa39c1b..e3fc738fd46f78a4970c3136542dfaed25cb0cc3 100644 (file)
@@ -119,8 +119,10 @@ Font_interface::get_font (Grob *me, SCM chain)
       name = gh_call2 (proc, fonts, chain);
     }
   
-  SCM mag = me->get_grob_property ("font-magnification");
-  Real rmag = gh_number_p (mag) ? gh_scm2double (mag) : 1.0;
+  SCM mag = ly_assoc_chain (ly_symbol2scm ("font-magnification"), chain);
+  
+  Real rmag = gh_pair_p (mag) && gh_number_p (gh_cdr (mag))
+    ? gh_scm2double (gh_cdr (mag)) : 1.0;
   
   Font_metric *fm = me->get_paper ()->find_font (name, rmag);
   return fm;
index 70a7609d21144fb1fb94e1f1ae17101c2cbae084..4de0766c73209bd931c8dbd261a166b13f4581d5 100644 (file)
@@ -30,4 +30,8 @@ private:
   static Molecule lookup_text (Grob *me, Font_metric*, SCM text);
 };
 
+bool new_markup_p (SCM) ;
+SCM new_markup_brewer ();
+
+
 #endif /* TEXT_ITEM */
index ed9dbadcb7e47aee0fd077e8310e5d6d1c1bd0d4..593de87001cdf08b09e8b1a981d04c617a5424ec 100644 (file)
@@ -15,6 +15,7 @@
 #include "align-interface.hh"
 #include "axis-group-interface.hh"
 #include "translator-group.hh"
+#include "text-item.hh"
 
 class Instrument_name_engraver : public Engraver
 {
@@ -66,7 +67,10 @@ Instrument_name_engraver::create_text (SCM txt)
       
       if (text_->get_grob_property ("text") != txt)
        text_->set_grob_property ("text", txt);
-     
+
+      if (new_markup_p (txt))
+       text_->set_grob_property ("molecule-callback", new_markup_brewer());
+      
       if (delim_)
         text_->set_parent (delim_, Y_AXIS);
       
index 96ca4ffcbaeba118025f2faec8c297b6767f3602..6457ea1b2be685960c5752e2021c942ea1db13ae 100644 (file)
@@ -19,6 +19,7 @@
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
 #include "group-interface.hh"
+#include "text-item.hh"
 
 /**
   put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
@@ -127,6 +128,11 @@ Mark_engraver::process_music ()
        */
       
       SCM m = mark_req_->get_mus_property ("label");
+      if (new_markup_p (m))
+       {
+         text_->set_grob_property ("text",m);
+         text_->set_grob_property ("molecule-callback", new_markup_brewer ());
+       }
       if (gh_pair_p (m)) // markup text
        text_->set_grob_property ("text",m);
       else 
index bfb71a0272d6c44e0ef6dea30f235e14db897567..b9393c411e245a7de78598ef1d5d8d94c113c66f 100644 (file)
 
 
 ADD_INTERFACE (Paper_column, "paper-column-interface",
-  "  Paper_columns form the top-most item parent. (The Paper_columns X
-  parent is System, which is a spanner.)
-
-  Paper_columns form the units for the spacing engine. They are
-  numbered, the first (leftmost) is column 0. Numbering happens before
-  line-breaking, and columns are not renumbered after line breaking.
-
-  Since many columns go unused, you should only use the rank field to
-  get ordering information.  Two adjacent columns may have
-  non-adjacent numbers.
-
-  Don't be confused by right-items: each spacing wish can also contain
-  a number of items, with which a spacing constraint may be kept. It's
-  a little baroque, but it might come in handy later on?
-
-",
+  "  Paper_columns form the top-most item parent. (The Paper_columns X\n"
+"  parent is System, which is a spanner.)\n"
+"\n"
+"  Paper_columns form the units for the spacing engine. They are\n"
+"  numbered, the first (leftmost) is column 0. Numbering happens before\n"
+"  line-breaking, and columns are not renumbered after line breaking.\n"
+"\n"
+"  Since many columns go unused, you should only use the rank field to\n"
+"  get ordering information.  Two adjacent columns may have\n"
+"  non-adjacent numbers.\n"
+"\n"
+"  Don't be confused by right-items: each spacing wish can also contain\n"
+"  a number of items, with which a spacing constraint may be kept. It's\n"
+"  a little baroque, but it might come in handy later on?\n"
+"\n",
   "between-cols between-system-string when bounded-by-me shortest-playing-duration shortest-starter-duration");
 
 
index 4eb694f4090959c0190cb1042f93ee66c014f1a4..174e84ac2c5408d5b06a406b9fc8523575b7c71b 100644 (file)
@@ -79,6 +79,7 @@ TODO:
 #include "music-sequence.hh"
 #include "input-smob.hh"
 #include "event.hh"
+#include "text-item.hh"
 
 bool
 regular_identifier_b (SCM id)
@@ -95,6 +96,15 @@ regular_identifier_b (SCM id)
   return v;
 }
 
+SCM
+make_simple_markup (SCM a)
+{
+       static SCM simple;
+       if (!simple)
+       simple = scm_c_eval_string ("simple-markup");
+
+       return scm_list_n (simple, a, SCM_UNDEFINED);
+}
 
 
 bool
@@ -1638,10 +1648,7 @@ gen_text_def:
                $$ = t; 
        }
        | string {
-               Music *t = MY_MAKE_MUSIC("TextScriptEvent");
-               t->set_mus_property ("text", $1);
-               t->set_spot (THIS->here_input ());
-               $$ = t;
+               $$ = make_simple_markup ($1);
        }
        | DIGIT {
                Music * t = MY_MAKE_MUSIC("FingerEvent");
@@ -2172,11 +2179,7 @@ full_markup:
        
 markup:
        STRING {
-               static SCM simple;
-               if (!simple)
-                       simple = scm_c_eval_string ("simple-markup");
-
-               $$ = scm_list_n (simple, $1, SCM_UNDEFINED);
+               $$ = make_simple_markup ($1);
        }
        | MARKUP_HEAD_MARKUP0 markup {
                $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
@@ -2311,7 +2314,7 @@ My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
 
                *destination = p->self_scm();
                return MUSIC_OUTPUT_DEF_IDENTIFIER;
-       } else if (markup_p (sid)) {
+       } else if (new_markup_p (sid)) {
                *destination = sid;
                return MARKUP_IDENTIFIER;
        }
index 714ed9004bf6b4572712f47f45396dabbd9d360b..486de81cac7048edd78fdb61a05aba93379fbb92 100644 (file)
@@ -14,6 +14,7 @@
 #include "event.hh"
 #include "stem.hh"
 #include "rhythmic-head.hh"
+#include "text-item.hh"
 
 
 /**
@@ -111,8 +112,14 @@ Text_engraver::process_acknowledged_grobs ()
       Direction dir = to_dir (r->get_mus_property ("direction"));
       if (dir)
        Side_position_interface::set_direction (text, dir);
+
+
+      SCM mark = r->get_mus_property ("text");
+
+      if (new_markup_p (mark))
+       text->set_grob_property ("molecule-callback", new_markup_brewer());
       
-      text->set_grob_property ("text", r->get_mus_property ("text"));
+      text->set_grob_property ("text", mark);
       announce_grob (text, r->self_scm ());
       texts_.push (text);
     }
index c1a63c94c3b3e0c11a37df39046dee5ab6646c6f..916185be148c61fb244618314f1f865969c224a9 100644 (file)
@@ -251,3 +251,22 @@ Text_item::brew_molecule (SCM smob)
 ADD_INTERFACE (Text_item,"text-interface",
   "A scheme markup text",
   "text axis baseline-skip extent lookup raise kern word-space");
+
+
+bool
+new_markup_p (SCM x)
+{
+       return gh_pair_p (x)
+               && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"));
+}
+
+SCM
+new_markup_brewer ()
+{
+  static SCM proc ;
+
+  if (!proc)
+    proc = scm_c_eval_string ("brew-new-markup-molecule");
+
+  return proc;
+}
index 0e3f21ecaa673c03b38d249ea69cc43d8704f683..5de26e4a5804a18199b49b3da76c6fd455f1fe08 100644 (file)
   "Stack vertically with a baseline-skip."
   (if (null? mols)
       '()
-      (if (pair? mols)
+      (if (null? (cdr mols))
+         (car mols)
          (ly:combine-molecule-at-edge (car mols) Y dir 
-                                      (stack-lines Y dir padding (cdr mols))
-                                      padding baseline 
+                                      (stack-lines dir padding baseline (cdr mols))
+                                      padding baseline
                                       )
          )
   ))
 
-
 (define-public (fontify-text font-metric text)
   "Set TEXT with font FONT-METRIC, returning a molecule."
   (let* ((b  (ly:text-dimension font-metric text)))
@@ -45,8 +45,6 @@
     mol
   ))
 
-
-
 (define-public (box-molecule xext yext)
   "Make a filled box."
   
index 4dfb2cbdb71c89217bfc9169228cef8ebacdb847..5f90f7f3e052b8c77ba9af0df11c519cd8793927 100644 (file)
@@ -1,6 +1,3 @@
-
-
-
 (define-public (simple-markup grob props . rest)
   (Text_item::text_to_molecule grob props (car 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 bold-markup
   (font-markup 'font-series 'bold))
 (define-public dynamic-markup
@@ -32,6 +36,8 @@
 (define-public italic-markup
   (font-markup 'font-shape 'italic))
 
+
+;; TODO: baseline-skip should come from the font.
 (define-public (column-markup grob props . rest)
   (stack-lines
    -1 0.0 (cdr (chain-assoc 'baseline-skip props))
@@ -86,7 +92,7 @@
           (cons dynamic-markup 'markup0)
           (cons char-markup 'scm0)
           (cons hspace-markup 'scm0)
-          
+          (cons magnify-markup 'scm0-markup1)
           ))