1 #include "font-interface.hh"
6 TODO: insert support for smaller cautionaries, tie-break-reminders.
7 Either here or in new-accidental-engraver.
9 'accidentals should go, for a single 'accidental property -- see
10 accidental-placement.cc
13 class Accidental_interface
16 DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
17 DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
18 static bool has_interface (Grob*);
22 parenthesize (Grob*me, Molecule m)
24 Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-leftparen"));
25 Molecule close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-rightparen"));
26 m.add_at_edge (X_AXIS, LEFT, Molecule (open), 0);
27 m.add_at_edge (X_AXIS, RIGHT, Molecule (close), 0);
33 MAKE_SCHEME_CALLBACK (Accidental_interface,after_line_breaking,1);
35 Accidental_interface::after_line_breaking (SCM smob)
37 Grob *me = unsmob_grob (smob);
38 Grob *tie = unsmob_grob (me->get_grob_property ("tie"));
40 if (tie && !tie->original_l_)
44 return SCM_UNSPECIFIED;
47 MAKE_SCHEME_CALLBACK (Accidental_interface,brew_molecule,1);
49 Accidental_interface::brew_molecule (SCM smob)
51 Grob *me = unsmob_grob (smob);
55 bool caut = to_boolean (me->get_grob_property ("cautionary"));
58 SCM cstyle = me->get_grob_property ("cautionary-style");
59 parens = gh_equal_p (cstyle, ly_symbol2scm ("parentheses"));
60 smaller = gh_equal_p (cstyle, ly_symbol2scm ("smaller"));
63 SCM scm_style = me->get_grob_property ("style");
65 if (gh_symbol_p (scm_style))
67 style = ly_scm2string (scm_symbol_to_string (scm_style));
72 preferably no name for the default style.
81 SCM ac = Font_interface::font_alist_chain (me);
82 ac = gh_cons (gh_cons (gh_cons
83 (ly_symbol2scm ("font-relative-size"),
84 gh_int2scm (-1)), SCM_EOL),
86 fm = Font_interface::get_font (me, ac);
89 fm = Font_interface::get_default_font (me);
92 for (SCM s = me->get_grob_property ("accidentals");
93 gh_pair_p (s); s= gh_cdr (s))
95 SCM entry = gh_car (s);
98 Molecule acc (fm->find_by_name (String ("accidentals-") +
100 to_str (gh_scm2int(entry))));
102 mol.add_at_edge (X_AXIS, RIGHT, acc, 0.1);
106 mol = parenthesize (me, mol);
108 return mol.smobbed_copy();
113 ADD_INTERFACE(Accidental_interface, "accidental-interface",
114 "a single accidental",
115 "style tie accidentals");