*/
Molecule
vaticana_brew_flexa (Grob *me,
- Real interval,
bool solid,
- Real width,
Real thickness,
- bool add_stem,
Direction stem_direction)
{
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Molecule molecule = Molecule ();
+ Real right_height = 0.6 * staff_space;
+
+ Real interval;
+ SCM flexa_height_scm = me->get_grob_property ("flexa-height");
+ if (flexa_height_scm != SCM_EOL)
+ {
+ interval = gh_scm2int (flexa_height_scm);
+ }
+ else
+ {
+ me->warning ("Vaticana_ligature: "
+ "flexa-height undefined; assuming 0");
+ interval = 0.0;
+ }
+
if (interval >= 0.0)
{
me->warning (_ ("ascending vaticana style flexa"));
}
- Real space = Staff_symbol_referencer::staff_space (me);
- Molecule molecule = Molecule ();
- Real right_height = 0.6 * space;
+ Real width;
+ SCM flexa_width_scm = me->get_grob_property ("flexa-width");
+ if (flexa_width_scm != SCM_EOL)
+ {
+ width = gh_scm2double (flexa_width_scm);
+ }
+ else
+ {
+ me->warning ("Vaticana_ligature:"
+ "flexa-width undefined; assuming 2.0");
+ width = 2.0 * staff_space;
+ }
+
+ bool add_stem = to_boolean (me->get_grob_property ("add-stem"));
// Compensate thickness that appears to be smaller in steep section
// of bend.
- Real left_height = right_height + min (0.12 * abs(interval), 0.3) * space;
+ Real left_height =
+ right_height +
+ min (0.12 * abs(interval), 0.3) * staff_space;
if (add_stem)
{
if (consider_interval)
{
- Real y_length = max (abs(interval)/2.0*space +
+ Real y_length = max (abs(interval)/2.0*staff_space +
(right_height-left_height),
- 1.2*space);
+ 1.2*staff_space);
stem_box_y = Interval (0, y_length);
}
else
- stem_box_y = Interval (0, space);
+ stem_box_y = Interval (0, staff_space);
Real y_correction =
(stem_direction == UP) ?
// Compensate optical illusion regarding vertical position of left
// and right endings due to curved shape.
- Real ypos_correction = -0.1*space * sign(interval);
- Real interval_correction = 0.2*space * sign(interval);
- Real corrected_interval = interval*space + interval_correction;
+ Real ypos_correction = -0.1*staff_space * sign(interval);
+ Real interval_correction = 0.2*staff_space * sign(interval);
+ Real corrected_interval = interval*staff_space + interval_correction;
- // middle curve of flexa
+ // middle curve of flexa shape
Bezier curve;
curve.control_[0] = Offset (0.00 * width, 0.0);
curve.control_[1] = Offset (0.33 * width, corrected_interval / 2.0);
return Molecule ();
}
- String glyph_name = ly_symbol2string (glyph_name_scm);
+ String glyph_name = ly_scm2string (glyph_name_scm);
if (!String::compare (glyph_name, ""))
{
- // empty head (typically, this is the right side of porrectus
- // shape, which is already typeset by the associated left side
- // head); nothing left to do
+ // empty head (typically, this is the right side of flexa shape,
+ // which is already typeset by the associated left side head);
+ // nothing left to do
return Molecule ();
}
Molecule out;
- int porrectus_height = 0;
+ int flexa_height = 0;
Real thickness = 0.0;
- Real porrectus_width = 0.0;
Real staff_space = Staff_symbol_referencer::staff_space (me);
SCM thickness_scm = me->get_grob_property ("thickness");
programming_error (_f ("Vaticana_ligature:"
"thickness undefined; assuming 1.4",
me));
- thickness = 1.4 * me->get_paper ()->get_var ("linethickness");
+ thickness = 1.4 * me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
}
Real x_offset = 0.0;
me));
}
- if (!String::compare (glyph_name, "porrectus"))
+ if (!String::compare (glyph_name, "flexa"))
{
- SCM porrectus_height_scm = me->get_grob_property ("porrectus-height");
- if (porrectus_height_scm != SCM_EOL)
- {
- porrectus_height = gh_scm2int (porrectus_height_scm);
- }
- else
- {
- me->warning ("Vaticana_ligature: "
- "porrectus-height undefined; assuming 0");
- }
-
- SCM porrectus_width_scm = me->get_grob_property ("porrectus-width");
- if (porrectus_width_scm != SCM_EOL)
- {
- porrectus_width = gh_scm2double (porrectus_width_scm);
- }
- else
- {
- me->warning ("Vaticana_ligature:"
- "porrectus-width undefined; assuming 2.0");
- porrectus_width = 2.0 * staff_space;
- }
-
- bool add_stem = to_boolean (me->get_grob_property ("add-stem"));
- out = vaticana_brew_flexa (me, porrectus_height, true,
- porrectus_width, thickness, add_stem, DOWN);
+ out = vaticana_brew_flexa (me, true, thickness, DOWN);
}
else
{
out.add_molecule (mol);
}
- SCM join_left_scm = me->get_grob_property ("join-left");
- if (join_left_scm != SCM_EOL)
+ if (to_boolean (me->get_grob_property ("join-left")))
{
- int join_left = gh_scm2int (join_left_scm);
- if (!join_left)
- programming_error (_f ("Vaticana_ligature: (join_left == 0)"));
- Real blotdiameter = (me->get_paper ()->get_var ("blotdiameter"));
- Interval x_extent =
- Interval (-0.5 * thickness, +0.5 * thickness);
- Interval y_extent = (join_left > 0) ?
- Interval (-join_left * 0.5 * staff_space, 0) : // ascending join
- Interval (0, -join_left * 0.5 * staff_space); // descending join
- Box stem_box (x_extent, y_extent);
-
- Molecule stem = Lookup::roundfilledbox (stem_box, blotdiameter);
- out.add_molecule (stem);
+ SCM delta_pitch_scm = me->get_grob_property ("delta-pitch");
+ if (delta_pitch_scm != SCM_EOL)
+ {
+ int delta_pitch = gh_scm2int (delta_pitch_scm);
+ if (!delta_pitch)
+ programming_error (_f ("Vaticana_ligature: (delta_pitch == 0)"));
+ Real blotdiameter = (me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter")));
+ Interval x_extent = Interval (0, thickness);
+ Interval y_extent = (delta_pitch > 0) ?
+ Interval (-delta_pitch * 0.5 * staff_space, 0) : // ascending join
+ Interval (0, -delta_pitch * 0.5 * staff_space); // descending join
+ Box stem_box (x_extent, y_extent);
+
+ Molecule stem = Lookup::roundfilledbox (stem_box, blotdiameter);
+ out.add_molecule (stem);
+ }
+ else
+ {
+ programming_error (_f ("Vaticana_ligature:"
+ "delta-pitch -> ignoring join",
+ me));
+ }
}
int pos = (int)rint (Staff_symbol_referencer::get_position (me));
vaticana_add_ledger_lines(me, &out, pos, 0, ledger_take_space);
- if (!String::compare (glyph_name, "porrectus"))
+ if (!String::compare (glyph_name, "flexa"))
{
- pos += porrectus_height;
- vaticana_add_ledger_lines(me, &out, pos, 0.5*porrectus_height, ledger_take_space);
+ pos += flexa_height;
+ vaticana_add_ledger_lines(me, &out, pos, 0.5*flexa_height, ledger_take_space);
}
return out;
ADD_INTERFACE (Vaticana_ligature, "vaticana-ligature-interface",
"A vaticana style gregorian ligature",
- "glyph-name porrectus-height porrectus-width thickness join-left "
- "add-stem x-offset ligature-primitive-callback");
+ "glyph-name flexa-height flexa-width thickness join-left "
+ "delta-pitch add-stem x-offset ligature-primitive-callback");