-Molecule
-Lookup::ledger_line (Interval xwid) const
-{
- Drul_array<Molecule> endings;
- endings[LEFT] = afm_find ("noteheads-ledgerending");
- Molecule * e = &endings[LEFT];
- endings[RIGHT] = *e;
-
- Real thick = e->dim_[Y_AXIS].length();
- Real len = e->dim_[X_AXIS].length () - thick;
-
- Molecule total;
- Direction d = LEFT;
- do {
- endings[d].translate_axis (xwid[d] - endings[d].dim_[X_AXIS][d], X_AXIS);
- total.add_molecule (endings[d]);
- } while ((flip(&d)) != LEFT);
-
- Real xpos = xwid [LEFT] + len;
-
- while (xpos + len + thick /2 <= xwid[RIGHT])
- {
- e->translate_axis (len, X_AXIS);
- total.add_molecule (*e);
- xpos += len;
- }
-
- return total;
-}
-
-
-Molecule
-Lookup::accidental (int j, bool cautionary) const
-{
- Molecule m(afm_find (String ("accidentals-") + to_str (j)));
- if (cautionary)
- {
- Molecule open = afm_find (String ("accidentals-("));
- Molecule close = afm_find (String ("accidentals-)"));
- m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0);
- m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0);
- }
- return m;
-}
-
-
-
-Molecule
-Lookup::afm_find (String s, bool warn) const
-{
- if (!afm_l_)
- {
- Lookup * me = (Lookup*)(this);
- me->afm_l_ = all_fonts_global_p->find_afm (font_name_);
- if (!me->afm_l_)
- {
- warning (_f("Can't open `%s'\n", font_name_));
- warning (_f("Search path %s\n", global_path.str ().ch_C()));
- error (_f("Aborting"));
- }
- }
- Adobe_font_char_metric cm = afm_l_->find_char (s, warn);
- Molecule m;
- if (cm.code () < 0)
- {
- /*
- don't want people relying on this kind of dimension.
- */
- m.set_empty (false);
- return m;
- }
-
- Atom at (gh_list (char_scm_sym,
- gh_int2scm (cm.code ()),
- SCM_UNDEFINED));
- at.font_ = ly_symbol (font_name_.ch_C());
- m.dim_ = cm.dimensions();
- m.add_atom (&at);
- return m;
-}
-
-Molecule
-Lookup::notehead (int j, String type) const
-{
- if (j > 2)
- j = 2;
-
- return afm_find (String ("noteheads-") + to_str (j) + type);
-}
-
-Molecule
-Lookup::simple_bar (String type, Real h) const
-{
- SCM thick = ly_symbol ("barthick_" + type);
- Real w = 0.0;
-
- if (paper_l_->scope_p_->elem_b (thick))
- {
- w = paper_l_->get_realvar (thick);
- }
- else
- {
- programming_error ("No bar thickness set ! ");
- w = 1 PT;
- }
- return filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
-}
-
-
-Molecule
-Lookup::bar (String str, Real h) const
-{
- if (str == "[")
- return staff_bracket (h);
- else if (str == "{")
- return staff_brace (h);
-
- Real kern = paper_l_->get_var ("bar_kern");
- Real thinkern = paper_l_->get_var ("bar_thinkern");
- Molecule thin = simple_bar ("thin", h);
- Molecule thick = simple_bar ("thick", h);
- Molecule colon = afm_find ("dots-repeatcolon");
-
- Molecule m;
-
- if (str == "")
- {
- return fill (Box (Interval(0, 0), Interval (-h/2, h/2)));
- }
- if (str == "scorepostbreak")
- {
- return simple_bar ("score", h);
- }
- else if (str == "|")
- {
- return thin;
- }
- else if (str == "|.")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- }
- else if (str == ".|")
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- }
- else if (str == ":|")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- }
- else if (str == "|:")
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ":|:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, thick, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ".|.")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thick, kern);
- }
- else if (str == "||")
- {
- m.add_at_edge (X_AXIS, RIGHT, thin, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
- }
-
- return m;
-}
-
-Molecule
-Lookup::beam (Real slope, Real width, Real thick) const