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-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.
\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
}
%% new-chords-done %%
-%% new-chords-done %%
\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 %%
\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"
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;
static Molecule lookup_text (Grob *me, Font_metric*, SCM text);
};
+bool new_markup_p (SCM) ;
+SCM new_markup_brewer ();
+
+
#endif /* TEXT_ITEM */
#include "align-interface.hh"
#include "axis-group-interface.hh"
#include "translator-group.hh"
+#include "text-item.hh"
class Instrument_name_engraver : public Engraver
{
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);
#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,
*/
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
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");
#include "music-sequence.hh"
#include "input-smob.hh"
#include "event.hh"
+#include "text-item.hh"
bool
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
$$ = 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");
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);
*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;
}
#include "event.hh"
#include "stem.hh"
#include "rhythmic-head.hh"
+#include "text-item.hh"
/**
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);
}
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;
+}
"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)))
mol
))
-
-
(define-public (box-molecule xext yext)
"Make a filled box."
-
-
-
(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
(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))
(cons dynamic-markup 'markup0)
(cons char-markup 'scm0)
(cons hspace-markup 'scm0)
-
+ (cons magnify-markup 'scm0-markup1)
))