-Molecule
-Text_item::text2molecule (Grob *me, SCM text, SCM alist_chain)
-{
- if (gh_string_p (text))
- return string2molecule (me, text, alist_chain);
- else if (gh_pair_p (text))
- {
- /* urg, why not just do this in markup_text2molecule ? */
- if (gh_string_p (ly_car (text)))
- return markup_text2molecule (me,
- gh_append2 (scm_list_n (SCM_EOL,
- SCM_UNDEFINED),
- text),
- alist_chain);
- /*
- Allow (faulty) texts that are in an extra list:
- #'(("foo"))
- */
- else if (scm_ilength (text) <= 1)
- return text2molecule (me, ly_car (text), alist_chain);
- else
- return markup_text2molecule (me, text, alist_chain);
- }
- return Molecule ();
-}
-
-Molecule
-Text_item::string2molecule (Grob *me, SCM text, SCM alist_chain)
-{
- SCM style = ly_assoc_chain (ly_symbol2scm ("font-style"),
- alist_chain);
- if (gh_pair_p (style) && gh_symbol_p (ly_cdr (style)))
- alist_chain = Font_interface::add_style (me, ly_cdr (style), alist_chain);
-
- Font_metric *fm = Font_interface::get_font (me, alist_chain);
-
- SCM lookup = ly_assoc_chain (ly_symbol2scm ("lookup"), alist_chain);
-
- Molecule mol;
- if (gh_pair_p (lookup) && ly_cdr (lookup) ==ly_symbol2scm ("name"))
- mol = lookup_character (me, fm, text);
- else
- mol = lookup_text (me, fm, text);
-
- return mol;
-}
-
-Molecule
-Text_item::lookup_character (Grob *, Font_metric*fm, SCM char_name)
-{
- return fm->find_by_name (ly_scm2string (char_name));
-}
-
-
-Molecule
-Text_item::lookup_text (Grob *me, Font_metric*fm, SCM text)
-{
- SCM list = scm_list_n (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
- list = fontify_atom (fm, list);
-
- return Molecule (fm->text_dimension (ly_scm2string (text)), list);
-}
-
-
-/*
- TODO:
-
- DOCME.