-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::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 find font: `%s'", font_name_));
- warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
- error (_ ("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 (ly_symbol2scm ("char"),
- gh_int2scm (cm.code ()),
- SCM_UNDEFINED));
-
- at.fontify (afm_l_);
- m.dim_ = cm.dimensions();
- m.add_atom (&at);
- return m;
-}
-
-Molecule
-Lookup::simple_bar (String type, Real h, Paper_def* paper_l) const
-{
- SCM thick = ly_symbol2scm (("barthick_" + type).ch_C());
- 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, Paper_def *paper_l) const
-{
- if (str == "bracket")
- return staff_bracket (h, paper_l);
- else if (str == "brace")
- {
- Real staffht = paper_l->get_var ("staffheight");
- return staff_brace (h,staffht);
- }
- Real kern = paper_l->get_var ("bar_kern");
- Real thinkern = paper_l->get_var ("bar_thinkern");
-
- Molecule thin = simple_bar ("thin", h, paper_l);
- Molecule thick = simple_bar ("thick", h, paper_l);
- Molecule colon = afm_find ("dots-repeatcolon", paper_l);
-
- Molecule m;
-
- if (str == "")
- {
- return fill (Box (Interval(0, 0), Interval (-h/2, h/2)));
- }
- if (str == "scorepostbreak")
- {
- return simple_bar ("score", h, paper_l);
- }
- 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