[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bracket questions
From: |
Chris Jackson |
Subject: |
Re: bracket questions |
Date: |
Mon, 17 Jun 2002 14:52:19 +0100 |
User-agent: |
Mutt/1.3.28i |
On Wed, Jun 12, 2002 at 11:44:54PM +0200, Han-Wen wrote:
> address@hidden writes:
> > > * have the same sign convention for the left edge ?
> > >
> > > * have better names (eg. bracket-flare iso. edge-width) ?
> > >
> > > and double check that all other bracket code follows the same
> > > conventions?
> >
> > If so, then the edge-width property of the text spanner and the piano pedal
> > bracket should also be changed to bracket-flare as well. Fair enough - I
> > suppose it makes sense to change the sign convention. The edges of a bracket
> > should usually be symmetrical, so it's easier for both the numbers to have
> > the same sign.
>
> Yeps, that was what I was aiming at. BTW, in the examples of in the
> reference manual, the Ped and the ____ overlap. Maybe you can alos
> have a look at that. Thanks!
Here's the necessary edits to change the left-edge sign. Also, recalling
this conversation a while ago:
From: Han-Wen Nienhuys <address@hidden>
> address@hidden writes:
> > Han-Wen Nienhuys <address@hidden> writes:
> >
> > > it is, angle-{left,right} should go, and edge-width should be renamed
> > > to something like "bracket-edge-flare", or "edge-flare"
> >
> > a flare is something of a bulb or circle, why not edge-line or
> > edge-serif or so.
>
> Edge-widen?
I renamed the property to edge-widen. After all, it only controls the edge
of the bracket, and not the main part. Feel free to change it again.
(btw, I'm on the case with the pedal bugs)
--
chris
Index: ChangeLog
===================================================================
RCS file: /home/lilypond/lilypond/ChangeLog,v
retrieving revision 1.205
diff -p -u -r1.205 ChangeLog
--- ChangeLog 17 Jun 2002 11:56:38 -0000 1.205
+++ ChangeLog 17 Jun 2002 13:39:11 -0000
@@ -1,3 +1,14 @@
+2002-06-17 Chris Jackson <address@hidden>
+
+ * lily/tuplet-bracket.cc:
+ * lily/text-spanner.cc:
+ * lily/piano-pedal-engraver.cc:
+ * scm/grob-description.scm:
+ * scm/grob-property-description.scm: Changed the
+ edge-width property of brackets to edge-widen. Changed the sign of
+ the left element of edge-widen so a pair of equal numbers produces
+ a symmetrical bracket.
+
2002-06-17 Han-Wen Nienhuys <address@hidden>
* ly/espanol.ly: added.
Index: lily/piano-pedal-engraver.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/piano-pedal-engraver.cc,v
retrieving revision 1.37
diff -p -u -r1.37 piano-pedal-engraver.cc
--- lily/piano-pedal-engraver.cc 15 May 2002 23:03:14 -0000 1.37
+++ lily/piano-pedal-engraver.cc 17 Jun 2002 13:39:12 -0000
@@ -72,7 +72,7 @@ private:
/*
Left and right flare widths of a \___/, as specified by the grob
- property edge-width.
+ property edge-widen.
*/
Drul_array<SCM> edge_width_drul_;
@@ -310,9 +310,9 @@ Piano_pedal_engraver::create_bracket_gro
Set properties so that the molecule-creating function will
know whether the right edge should be flared ___/
*/
- SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-width"));
+ SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-widen"));
SCM eright = (p->req_l_drul_[START] ? edge_width_drul_[RIGHT] :
gh_double2scm (0));
- p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+ p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
p->finished_bracket_p_ = p->bracket_p_;
p->bracket_p_ = 0;
@@ -332,7 +332,7 @@ Piano_pedal_engraver::create_bracket_gro
know whether the left edge should be flared \___
*/
- SCM ew = p->bracket_p_->get_grob_property ("edge-width");
+ SCM ew = p->bracket_p_->get_grob_property ("edge-widen");
edge_width_drul_[LEFT] = ly_car (ew);
edge_width_drul_[RIGHT] = ly_cdr (ew);
@@ -340,7 +340,7 @@ Piano_pedal_engraver::create_bracket_gro
edge_width_drul_[LEFT] :
gh_double2scm (0));
SCM eright = gh_double2scm (0);
- p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright));
+ p->bracket_p_->set_grob_property ("edge-widen", gh_cons (eleft, eright));
/* Set this property for 'mixed style' pedals, Ped._______/\ ,
so the molecule function will shorten the ____ line by the length of
the Ped. text.
Index: lily/text-spanner.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/text-spanner.cc,v
retrieving revision 1.55
diff -p -u -r1.55 text-spanner.cc
--- lily/text-spanner.cc 9 Jun 2002 23:16:29 -0000 1.55
+++ lily/text-spanner.cc 17 Jun 2002 13:39:12 -0000
@@ -144,7 +144,7 @@ Text_spanner::brew_molecule (SCM smob)
Drul_array<Molecule> edge_line;
s = me->get_grob_property ("edge-height");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
if (gh_pair_p (s))
{
Direction d = LEFT;
@@ -152,7 +152,7 @@ Text_spanner::brew_molecule (SCM smob)
do
{
Real dx = ( gh_pair_p (ew) ?
- gh_scm2double (index_cell (ew, d)) * - dir :
+ gh_scm2double (index_cell (ew, d)) * d :
0 );
Real dy = gh_scm2double (index_cell (s, d)) * - dir;
if (dy)
@@ -206,7 +206,7 @@ Text_spanner::setup_pedal_bracket(Spanne
Drul_array<Real> height, width, shorten, r;
SCM pa = me->get_grob_property ("if-text-padding");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
SCM eh = me->get_grob_property ("edge-height");
SCM sp = me->get_grob_property ("shorten-pair");
@@ -230,7 +230,7 @@ Text_spanner::setup_pedal_bracket(Spanne
height[d] = 0;
shorten[d] = 0;
if ( ly_number_pair_p (ew) )
- width[d] += gh_scm2double (index_cell (ew, d)) * d;
+ width[d] += gh_scm2double (index_cell (ew, d));
if ( !broken[d] && (ly_number_pair_p (eh) ) )
height[d] += gh_scm2double (index_cell (eh, d));
if ( ly_number_pair_p (sp) )
@@ -276,7 +276,7 @@ Text_spanner::setup_pedal_bracket(Spanne
}
me->set_grob_property ("edge-height", ly_interval2scm (height));
- me->set_grob_property ("edge-width", ly_interval2scm(width));
+ me->set_grob_property ("edge-widen", ly_interval2scm(width));
me->set_grob_property ("shorten-pair", ly_interval2scm (shorten));
}
@@ -287,9 +287,9 @@ struct Pianopedal
};
ADD_INTERFACE (Pianopedal,"piano-pedal-interface",
"",
- "pedal-type edge-width edge-height shorten-pair text-start
left-widen right-widen");
+ "pedal-type edge-widen edge-height shorten-pair text-start
left-widen right-widen");
ADD_INTERFACE (Text_spanner,"text-spanner-interface",
"generic text spanner",
- "dash-period if-text-padding dash-length edge-height edge-width
edge-text shorten-pair type");
+ "dash-period if-text-padding dash-length edge-height edge-widen
edge-text shorten-pair type");
Index: lily/tuplet-bracket.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/tuplet-bracket.cc,v
retrieving revision 1.20
diff -p -u -r1.20 tuplet-bracket.cc
--- lily/tuplet-bracket.cc 9 Jun 2002 23:16:29 -0000 1.20
+++ lily/tuplet-bracket.cc 17 Jun 2002 13:39:13 -0000
@@ -163,7 +163,7 @@ Tuplet_bracket::brew_molecule (SCM smob)
lt *= gh_scm2double (thick);
SCM gap = me->get_grob_property ("gap");
- SCM ew = me->get_grob_property ("edge-width");
+ SCM ew = me->get_grob_property ("edge-widen");
SCM eh = me->get_grob_property ("edge-height");
SCM sp = me->get_grob_property ("shorten-pair");
@@ -172,9 +172,9 @@ Tuplet_bracket::brew_molecule (SCM smob)
do {
width[d] = height[d] = shorten[d] = 0.0;
if ( ly_number_pair_p (ew) )
- width[d] += gh_scm2double (index_cell (ew, d)) * d;
+ width[d] += gh_scm2double (index_cell (ew, d));
if ( ly_number_pair_p (eh) )
- height[d] += gh_scm2double (index_cell (eh, d));
+ height[d] += gh_scm2double (index_cell (eh, d)) * - dir;
if ( ly_number_pair_p (sp) )
shorten[d] += gh_scm2double (index_cell (sp, d));
}
@@ -182,10 +182,10 @@ Tuplet_bracket::brew_molecule (SCM smob)
Molecule brack = make_bracket (Y_AXIS,
w, ry - ly, lt,
- -height[LEFT]*dir, -height[RIGHT]*dir,
+ height,
gh_scm2double (gap),
- width[LEFT], width[RIGHT],
- shorten[LEFT], shorten[RIGHT]);
+ width,
+ shorten);
mol.add_molecule (brack);
}
@@ -196,46 +196,43 @@ Tuplet_bracket::brew_molecule (SCM smob)
/*
should move to lookup?
-
- argh. this interface is confusing : we have a shorten as well as a
- widen.
-
- arg. should use drul_arrays here.
*/
Molecule
Tuplet_bracket::make_bracket (Axis protusion_axis,
- Real dx, Real dy, Real thick, Real left_height,
- Real right_height,
+ Real dx, Real dy, Real thick, Drul_array<Real>
height,
Real gap,
- Real left_widen, Real right_widen,
- Real left_shorten, Real right_shorten)
+ Drul_array<Real> widen,
+ Drul_array<Real> shorten)
{
Real len = Offset (dx,dy).length ();
Real gapx = dx * (gap / len);
Real gapy = dy * (gap / len);
- Real lshortx = dx * (left_shorten / len);
- Real lshorty = dy * (left_shorten / len);
- Real rshortx = dx * (right_shorten / len);
- Real rshorty = dy * (right_shorten / len);
+ Drul_array<Real> shortx, shorty;
+ Direction d = LEFT;
+ do {
+ shortx[d] = dx * (shorten[d] / len);
+ shorty[d] = dy * (shorten[d] / len);
+ }
+ while (flip (&d) != LEFT);
Axis other = other_axis (protusion_axis);
- Molecule l1 = Lookup::line (thick, Offset(lshortx, lshorty),
+ Molecule l1 = Lookup::line (thick, Offset(shortx[LEFT], shorty[LEFT]),
Offset ( (dx - gapx)/2, (dy - gapy)/2 ));
Molecule l2 = Lookup::line (thick, Offset((dx + gapx) / 2,(dy + gapy) / 2),
- Offset (dx - rshortx, dy - rshorty));
+ Offset (dx - shortx[RIGHT], dy - shorty[RIGHT]));
Offset protusion;
- protusion[other] = -left_widen;
- protusion[protusion_axis] = left_height;
+ protusion[other] = -widen[LEFT];
+ protusion[protusion_axis] = height[LEFT];
Molecule p1 = Lookup::line (thick,
- Offset(lshortx, lshorty),
- Offset(lshortx, lshorty) + protusion);
- protusion[other] = right_widen;
- protusion[protusion_axis] = right_height;
+ Offset(shortx[LEFT], shorty[LEFT]),
+ Offset(shortx[LEFT], shorty[LEFT]) + protusion);
+ protusion[other] = widen[RIGHT];
+ protusion[protusion_axis] = height[RIGHT];
Molecule p2 = Lookup::line (thick,
- Offset(dx - rshortx, dy - rshorty),
- Offset(dx - rshortx, dy - rshorty) + protusion);
+ Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]),
+ Offset(dx - shortx[RIGHT], dy - shorty[RIGHT]) +
protusion);
Molecule m;
m.add_molecule (p1);
@@ -489,5 +486,5 @@ Tuplet_bracket::add_column (Grob*me, Ite
ADD_INTERFACE (Tuplet_bracket,"tuplet-bracket-interface",
"A bracket with a number in the middle, used for tuplets.",
- "note-columns edge-width edge-height shorten-pair padding gap left-position
right-position bracket-visibility number-visibility thickness direction");
+ "note-columns edge-widen edge-height shorten-pair padding gap left-position
right-position bracket-visibility number-visibility thickness direction");
Index: lily/include/tuplet-bracket.hh
===================================================================
RCS file: /home/lilypond/lilypond/lily/include/tuplet-bracket.hh,v
retrieving revision 1.4
diff -p -u -r1.4 tuplet-bracket.hh
--- lily/include/tuplet-bracket.hh 21 Apr 2002 13:52:04 -0000 1.4
+++ lily/include/tuplet-bracket.hh 17 Jun 2002 13:39:13 -0000
@@ -32,10 +32,9 @@ public:
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
static Molecule make_bracket (Axis protusion_axis,
- Real dx, Real dy, Real thick, Real left_height,
- Real right_height, Real gap, Real left_widen,
- Real right_widen, Real left_shorten,
- Real right_shorten);
+ Real dx, Real dy, Real thick, Drul_array<Real>
height,
+ Real gap, Drul_array<Real> widen,
+ Drul_array<Real> shorten);
static Direction get_default_dir (Grob*);
};
Index: scm/grob-description.scm
===================================================================
RCS file: /home/lilypond/lilypond/scm/grob-description.scm,v
retrieving revision 1.96
diff -p -u -r1.96 grob-description.scm
--- scm/grob-description.scm 14 Jun 2002 14:38:43 -0000 1.96
+++ scm/grob-description.scm 17 Jun 2002 13:39:13 -0000
@@ -625,7 +625,7 @@
(width-correct . 0)
(outer . #t)
(direction . -1)
- (edge-width . (0.5 . 0.5))
+ (edge-widen . (0.5 . 0.5))
(edge-height . (1.0 . 1.0))
(shorten-pair . (0.0 . 0.0))
(thickness . 1.0)
@@ -975,7 +975,7 @@
(gap . 2.0)
(padding . 0.9)
(thickness . 1.6)
- (edge-width . (0.0 . 0.0))
+ (edge-widen . (0.0 . 0.0))
(edge-height . (0.7 . 0.7))
(shorten-pair . (-0.2 . -0.2))
(before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
Index: scm/grob-property-description.scm
===================================================================
RCS file: /home/lilypond/lilypond/scm/grob-property-description.scm,v
retrieving revision 1.80
diff -p -u -r1.80 grob-property-description.scm
--- scm/grob-property-description.scm 14 Jun 2002 14:38:43 -0000 1.80
+++ scm/grob-property-description.scm 17 Jun 2002 13:39:14 -0000
@@ -133,7 +133,7 @@ mean centre distance weighted per note
(grob-property-description 'dot-count integer? "number of dots.")
(grob-property-description 'duration-log integer? "2-log of the notehead
duration, i.e. 0=whole note, 1 = half note, etc.")
(grob-property-description 'edge-height pair? "a cons that specifies the
heights of the vertical edges '(LEFT-height . RIGHT-height).")
-(grob-property-description 'edge-width pair? "a cons that specifies the widths
of the slanted edges '(LEFT-width . RIGHT-width).")
+(grob-property-description 'edge-widen pair? "a cons that specifies the widths
of the slanted edges '(LEFT-width . RIGHT-width).")
(grob-property-description 'edge-text pair? "a cons that specifies the texts
to be set at the edges '(LEFT-text . RIGHT-text).")
(grob-property-description 'elements list? "list of grobs, type depending on
the Grob where this is set in.")
(grob-property-description 'expand-limit integer? "maximum number of measures
expanded in church rests.")
@@ -204,7 +204,7 @@ For barline, space after a thick line.")
(grob-property-description 'right-head ly-grob? "")
(grob-property-description 'left-head ly-grob? "")
-(grob-property-description 'left-widen boolean? "Whether the left edge of a
piano pedal bracket should be widened by the first element of edge-width.")
+(grob-property-description 'left-widen boolean? "Whether the left edge of a
piano pedal bracket should be widened by the first element of edge-widen.")
(grob-property-description 'length number? "Stem length for unbeamed stems,
only for user override.")
(grob-property-description 'lengths list? "Stem length given multiplicity of
flag.")
@@ -278,7 +278,7 @@ as a real penalty.")
(grob-property-description 'raise number? "height for text to be raised (a
negative value lowers the text.")
(grob-property-description 'right-padding number? "space right of accs.")
(grob-property-description 'right-trim-amount number? "shortening of the lyric
extender on the right.")
-(grob-property-description 'right-widen boolean? "Whether the right edge of a
piano pedal bracket should be widened by the second element of edge-width")
+(grob-property-description 'right-widen boolean? "Whether the right edge of a
piano pedal bracket should be widened by the second element of edge-widen")
(grob-property-description 'script-priority number? "A sorting key that
determines in what order a script is within a stack of scripts.")
(grob-property-description 'self-alignment-X number-or-grob? "real number: -1 =
left aligned, 0 = center, 1 right-aligned in X direction.