source file of the GNU LilyPond music typesetter
- (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1998--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include <math.h>
#include "all-font-metrics.hh"
#include "afm.hh"
#include "lookup.hh"
-
+#include "virtual-font-metric.hh"
/*
}
return Molecule ();
}
-
+
+
+MAKE_SCHEME_CALLBACK(Text_item,text_to_molecule,3);
+SCM
+Text_item::text_to_molecule (SCM grob, SCM props, SCM markup)
+{
+ Grob *me = unsmob_grob (grob);
+
+ return Text_item::text2molecule (me, markup, props).smobbed_copy();
+}
+
+
Molecule
Text_item::string2molecule (Grob *me, SCM text, SCM alist_chain)
{
}
+
Molecule
Text_item::lookup_text (Grob *, Font_metric*fm, SCM text)
{
SCM list = scm_list_n (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
- list = fontify_atom (fm, list);
+
+ if (dynamic_cast<Virtual_font_metric*> (fm))
+ {
+ /*
+ ARGH.
+ */
+ programming_error ("Can't use virtual font for text.");
+ }
+ else
+ list = fontify_atom (fm, list);
return Molecule (fm->text_dimension (ly_scm2string (text)), list);
}
Text_item::markup_text2molecule (Grob *me, SCM markup_text,
SCM alist_chain)
{
- SCM sheet = me->get_paper ()->style_sheet_;
- SCM f = ly_cdr (scm_assoc (ly_symbol2scm ("markup-to-properties"), sheet));
+ SCM f = me->get_paper ()->lookup_variable (ly_symbol2scm ("markup-to-properties"));
SCM markup = ly_car (markup_text);
SCM text = ly_cdr (markup_text);
- SCM p = gh_cons (gh_call2 (f, sheet, markup), alist_chain);
+ /* ARGRGRRGRARGRA
+ */
+
+ SCM abbrev = me->get_paper ()->lookup_variable (ly_symbol2scm ("abbreviation-alist"));
+ SCM style = me->get_paper ()->lookup_variable (ly_symbol2scm ("style-alist"));
+
+ SCM p = gh_cons (scm_call_3 (f, abbrev, style, markup), alist_chain);
Real staff_space = Staff_symbol_referencer::staff_space (me);
}
- /* Set extend to markup requested value. */
+ /* Set extend to markup evented value. */
if (extent_b)
{
Box b = mol.extent_box ();
Molecule m;
m.set_empty (false);
mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)
- * Staff_symbol_referencer::staff_space (me));
+ * Staff_symbol_referencer::staff_space (me), 0);
}
return mol.smobbed_copy ();
}
ADD_INTERFACE (Text_item,"text-interface",
- "A scheme markup text",
- "text align baseline-skip lookup raise kern word-space magnify");
+ "A scheme markup text, see @ref{Markup functions}.",
+ "text baseline-skip word-space");
+
+
+/*
+ Ugh. Duplicated from Scheme.
+ */
+bool
+new_markup_p (SCM x)
+{
+ return
+ gh_string_p (x) ||
+ (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;
+}
+
+
+Molecule
+Text_item::interpret_new_markup (SCM grob, SCM achain,
+ SCM markup)
+{
+ static SCM proc;
+ if (!proc)
+ proc = scm_c_eval_string ("interpret-markup");
+
+ if (new_markup_p (markup))
+ return *unsmob_molecule (scm_call_3 (proc, grob, achain, markup));
+ else
+ return Molecule();
+}