lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let beam thickness depend on line thickness (fix 3173) (issue 731209


From: janek . lilypond
Subject: Re: let beam thickness depend on line thickness (fix 3173) (issue 7312091)
Date: Tue, 19 Mar 2013 13:13:20 +0000

Reviewers: lemzwerg, dak,

Message:
Thanks for reviews.  Before i can continue with this patch, i have to
investigate a possible new way of specifying property values (inspired
by David here
http://code.google.com/p/lilypond/issues/detail?id=3173#c5)

best,
JAnek


https://codereview.appspot.com/7312091/diff/1/scm/define-grob-properties.scm
File scm/define-grob-properties.scm (right):

https://codereview.appspot.com/7312091/diff/1/scm/define-grob-properties.scm#newcode93
scm/define-grob-properties.scm:93: (beam-thickness ,number-pair? "Beam
thickness.  It is the sum
On 2013/02/14 19:43:00, dak wrote:
You are confusing "sum" and "pair" in this comment.

You're right, sorry.  I've copied this from the description of
ledger-line-thickness, so that one needs clarifying as well.

Description:
let beam thickness depend on line thickness (fix 3173)

One of LilyPond's design principles is "optical sizing"
(described in Essay, section Engraving details), which means
that as the font-size gets smaller, all elements get relatively
thicker.

Before now beam-thickness was defined as a fraction of
staffSpace, which meant no optical sizing (the thickness of the
beam stayed constant relative to the height of the staff). This
patch changes beam-thickness property to be a pair of numbers
(a . b). The actual thickness is calculated according to the
formula  a * lineThickness + b * staffSpace  (similarly to ledger
line thickness).

Please review this at https://codereview.appspot.com/7312091/

Affected files:
  M lily/beam.cc
  M scm/define-grob-properties.scm
  M scm/define-grobs.scm


Index: lily/beam.cc
diff --git a/lily/beam.cc b/lily/beam.cc
index 4a2e752947bcf753815e151e207f1cae6f7b562d..8a50039964ec77936dc6603905e488efbd53c551 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -106,8 +106,11 @@ Beam::add_stem (Grob *me, Grob *s)
 Real
 Beam::get_beam_thickness (Grob *me)
 {
-  return robust_scm2double (me->get_property ("beam-thickness"), 0)
-         * Staff_symbol_referencer::staff_space (me);
+  SCM bmth_pair = me->get_property ("beam-thickness");
+  Offset th = robust_scm2offset (bmth_pair, Offset (1, 0.38));
+
+  return th[X_AXIS] * Staff_symbol_referencer::line_thickness (me)
+         + th[Y_AXIS] * Staff_symbol_referencer::staff_space (me);
 }

 /* Return the translation between 2 adjoining beams. */
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index c1a3a723cb89a601c2a65dd56719467a38088859..00cf25f276a1037a6257aa7e1006f41d49494d77 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -90,8 +90,9 @@ shortest notes in a piece. Normally, pieces are spaced as if notes at
 least as short as this are present.")
      (baseline-skip ,ly:dimension? "Distance between base lines of
 multiple lines of text.")
-     (beam-thickness ,ly:dimension? "Beam thickness, measured in
address@hidden units.")
+     (beam-thickness ,number-pair? "Beam thickness.  It is the sum
+of address@hidden: The first is the factor for line thickness,
+and the second for staff space.  Both contributions are added.")
      (beam-width ,ly:dimension? "Width of the tremolo sign.")
      (beamed-stem-shorten ,list? "How much to shorten beamed stems,
 when their direction is forced.  It is a list, since the value is
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index cc4a9c76e935f7ba965f2904aedcfce460856724..dd04211cb4bf62bf5c82cc3a3ab3aa39c44af068 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -342,7 +342,7 @@
        ;; rather long.
        (auto-knee-gap . 5.5)
        (beam-segments . ,ly:beam::calc-beam-segments)
-       (beam-thickness . 0.48) ; in staff-space
+       (beam-thickness . (1 . 0.38)) ; line-thickness + staff-space

        ;; We have some unreferenced problems here.
        ;;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]