X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fvaticana-ligature.cc;h=ddbe0d86bd2ffa12f3054c5b005cb21c73754d6c;hb=b872748c6aa8bb721ced458691b38ac2fac5dfc8;hp=4995aad2f04ddd0b8920c57789f36516f66bf5fd;hpb=0387f04497978e37b335a8b99eec905499d6ad0f;p=lilypond.git diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index 4995aad2f0..ddbe0d86bd 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -1,9 +1,20 @@ /* - vaticana-ligature.cc -- implement Vaticana_ligature + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2003--2015 Juergen Reuter - (c) 2003--2008 Juergen Reuter + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "vaticana-ligature.hh" @@ -20,14 +31,13 @@ Stencil vaticana_brew_cauda (Grob *me, - int pos, - int delta_pitch, - Real thickness, - Real blotdiameter) + int pos, + int delta_pitch, + Real thickness, + Real blotdiameter) { bool on_staffline = Staff_symbol_referencer::on_line (me, pos); - int interspaces = Staff_symbol_referencer::line_count (me) - 1; - bool above_staff = pos > interspaces; + bool above_staff = pos > Staff_symbol_referencer::staff_span (me)[UP]; if (delta_pitch > -1) { @@ -38,25 +48,25 @@ vaticana_brew_cauda (Grob *me, if (on_staffline) { if (delta_pitch >= -1) - length = 1.30; + length = 1.30; else if (delta_pitch >= -2) - length = 1.35; + length = 1.35; else - length = 1.85; + length = 1.85; } else { if (delta_pitch >= -1) - if (above_staff) - length = 1.30; - else - length = 1.00; + if (above_staff) + length = 1.30; + else + length = 1.00; else if (delta_pitch >= -2) - length = 1.35; + length = 1.35; else if (delta_pitch >= -3) - length = 1.50; + length = 1.50; else - length = 1.85; + length = 1.85; } Box cauda_box (Interval (0, thickness), Interval (-length, 0)); return Lookup::round_filled_box (cauda_box, blotdiameter); @@ -67,8 +77,8 @@ vaticana_brew_cauda (Grob *me, */ Stencil vaticana_brew_flexa (Grob *me, - bool solid, - Real line_thickness) + bool solid, + Real line_thickness) { Real staff_space = Staff_symbol_referencer::staff_space (me); Stencil stencil; @@ -76,12 +86,12 @@ vaticana_brew_flexa (Grob *me, Real interval; SCM flexa_height_scm = me->get_property ("flexa-height"); - if (flexa_height_scm != SCM_EOL) + if (!scm_is_null (flexa_height_scm)) interval = scm_to_int (flexa_height_scm); else { me->warning ("Vaticana_ligature: " - + _ ("flexa-height undefined; assuming 0")); + + _ ("flexa-height undefined; assuming 0")); interval = 0.0; } @@ -96,7 +106,7 @@ vaticana_brew_flexa (Grob *me, */ Real left_height = right_height - + min (0.12 * abs (interval), 0.3) * staff_space; + + min (0.12 * abs (interval), 0.3) * staff_space; /* * Compensate optical illusion regarding vertical position of left @@ -126,7 +136,7 @@ vaticana_brew_flexa (Grob *me, if (solid) { Stencil solid_head - = Lookup::bezier_sandwich (top_curve, bottom_curve); + = Lookup::bezier_sandwich (top_curve, bottom_curve, 0.0); stencil.add_stencil (solid_head); } else // outline @@ -134,13 +144,13 @@ vaticana_brew_flexa (Grob *me, Bezier inner_top_curve = top_curve; inner_top_curve.translate (Offset (0.0, -line_thickness)); Stencil top_edge - = Lookup::bezier_sandwich (top_curve, inner_top_curve); + = Lookup::bezier_sandwich (top_curve, inner_top_curve, 0.0); stencil.add_stencil (top_edge); Bezier inner_bottom_curve = bottom_curve; inner_bottom_curve.translate (Offset (0.0, +line_thickness)); Stencil bottom_edge - = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve); + = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve, 0.0); stencil.add_stencil (bottom_edge); /* @@ -152,12 +162,12 @@ vaticana_brew_flexa (Grob *me, * the left end of the bezier curve. */ Box left_edge_box (Interval (0, line_thickness), - Interval (-0.5 * left_height, +0.5 * left_height)); + Interval (-0.5 * left_height, +0.5 * left_height)); Stencil left_edge = Lookup::filled_box (left_edge_box); stencil.add_stencil (left_edge); Box right_edge_box (Interval (-line_thickness, 0), - Interval (-0.5 * right_height, +0.5 * right_height)); + Interval (-0.5 * right_height, +0.5 * right_height)); Stencil right_edge = Lookup::filled_box (right_edge_box); right_edge.translate_axis (width, X_AXIS); right_edge.translate_axis (corrected_interval / 2.0, Y_AXIS); @@ -169,19 +179,19 @@ vaticana_brew_flexa (Grob *me, Stencil vaticana_brew_join (Grob *me, int delta_pitch, - Real join_thickness, Real blotdiameter) + Real join_thickness, Real blotdiameter) { Real staff_space = Staff_symbol_referencer::staff_space (me); if (!delta_pitch) { - me->programming_error (_ ("Vaticana_ligature: " - "zero join (delta_pitch == 0)")); + me->programming_error ("Vaticana_ligature: " + "zero join (delta_pitch == 0)"); return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); } Interval x_extent = Interval (0, join_thickness); Interval y_extent = (delta_pitch > 0) - ? Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join - Interval (delta_pitch * 0.5 * staff_space, 0); // descending join + ? Interval (0, delta_pitch * 0.5 * staff_space) : // ascending join + Interval (delta_pitch * 0.5 * staff_space, 0); // descending join Box join_box (x_extent, y_extent); return Lookup::round_filled_box (join_box, blotdiameter); } @@ -190,10 +200,10 @@ Stencil vaticana_brew_primitive (Grob *me) { SCM glyph_name_scm = me->get_property ("glyph-name"); - if (glyph_name_scm == SCM_EOL) + if (scm_is_null (glyph_name_scm)) { me->programming_error ("Vaticana_ligature: " - "undefined glyph-name -> ignoring grob"); + "undefined glyph-name -> ignoring grob"); return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); } @@ -212,7 +222,7 @@ vaticana_brew_primitive (Grob *me) SCM delta_pitch_scm = me->get_property ("delta-position"); int delta_pitch; - if (delta_pitch_scm != SCM_EOL) + if (!scm_is_null (delta_pitch_scm)) delta_pitch = scm_to_int (delta_pitch_scm); else delta_pitch = 0; @@ -235,15 +245,15 @@ vaticana_brew_primitive (Grob *me) Real staff_space = Staff_symbol_referencer::staff_space (me); Real flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2) * staff_space; out - = Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0))); + = Lookup::blank (Box (Interval (0, 0.5 * flexa_width), Interval (0, 0))); } else if (glyph_name == "flexa") out = vaticana_brew_flexa (me, true, line_thickness); else { out - = Font_interface::get_default_font (me)-> - find_by_name ("noteheads.s" + glyph_name); + = Font_interface::get_default_font (me)-> + find_by_name ("noteheads.s" + glyph_name); } out.translate_axis (x_offset, X_AXIS); Real head_width = out.extent (X_AXIS).length (); @@ -251,16 +261,16 @@ vaticana_brew_primitive (Grob *me) if (add_cauda) { Stencil cauda - = vaticana_brew_cauda (me, pos, delta_pitch, - line_thickness, blotdiameter); + = vaticana_brew_cauda (me, pos, delta_pitch, + line_thickness, blotdiameter); out.add_stencil (cauda); } if (add_stem) { Stencil stem - = vaticana_brew_cauda (me, pos, -1, - line_thickness, blotdiameter); + = vaticana_brew_cauda (me, pos, -1, + line_thickness, blotdiameter); stem.translate_axis (head_width - line_thickness, X_AXIS); out.add_stencil (stem); } @@ -268,7 +278,7 @@ vaticana_brew_primitive (Grob *me) if (add_join) { Stencil join - = vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter); + = vaticana_brew_join (me, delta_pitch, line_thickness, blotdiameter); join.translate_axis (head_width - line_thickness, X_AXIS); out.add_stencil (join); } @@ -280,7 +290,7 @@ MAKE_SCHEME_CALLBACK (Vaticana_ligature, brew_ligature_primitive, 1); SCM Vaticana_ligature::brew_ligature_primitive (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); SCM primitive = vaticana_brew_primitive (me).smobbed_copy (); return primitive; } @@ -293,16 +303,16 @@ Vaticana_ligature::print (SCM) } ADD_INTERFACE (Vaticana_ligature, - "A vaticana style Gregorian ligature.", - - /* properties */ - "glyph-name " - "flexa-height " - "flexa-width " - "thickness " - "add-cauda " - "add-stem " - "add-join " - "delta-position " - "x-offset " - ); + "A vaticana style Gregorian ligature.", + + /* properties */ + "glyph-name " + "flexa-height " + "flexa-width " + "thickness " + "add-cauda " + "add-stem " + "add-join " + "delta-position " + "x-offset " + );