summaryrefslogtreecommitdiff
path: root/scm
diff options
context:
space:
mode:
authorMike Solomon <mike@apollinemike.com>2013-03-22 07:29:57 +0100
committerMike Solomon <mike@apollinemike.com>2013-03-22 07:29:57 +0100
commit6f13ef4a292625c1a9d528ac88aec98071ba6388 (patch)
tree8f4f678834315bcdd0aefd79db5a7ed685ea4edb /scm
parent5f75b253841ce28f10701051b5ab0b5242c893cc (diff)
Permits all positive and zero-length buildings in skylines (issue 3161)
This allows point stencils to figure into vertical spacing, as shown in the new regtest input/regression/skyline-point-extent.ly. Some issues regarding floating point errors were raised while reviewing this patch, but it was concluded that the math in this patch likely does not risk triggering those errors with the way GCC compiles the code.
Diffstat (limited to 'scm')
-rw-r--r--scm/define-grobs.scm2
-rw-r--r--scm/lily-library.scm2
-rw-r--r--scm/output-lib.scm22
3 files changed, 10 insertions, 16 deletions
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index effaf131fa..a65ff1782a 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1994,7 +1994,7 @@
(extra-spacing-height . ,pure-from-neighbor-interface::extra-spacing-height)
; we want this to be ignored, so empty, but the extra spacing height
; should preserve the span bar's presence for horizontal spacing
- (Y-extent . ,pure-from-neighbor-interface::unobtrusive-height)
+ (Y-extent . ,pure-from-neighbor-interface::height-if-pure)
(meta . ((class . Item)
(object-callbacks . ((pure-Y-common . ,ly:axis-group-interface::calc-pure-y-common)
(pure-relevant-grobs . ,ly:pure-from-neighbor-interface::calc-pure-relevant-grobs)))
diff --git a/scm/lily-library.scm b/scm/lily-library.scm
index 736d0c3810..d87bca208a 100644
--- a/scm/lily-library.scm
+++ b/scm/lily-library.scm
@@ -57,6 +57,8 @@
(define-safe-public DOUBLE-SHARP 1)
(define-safe-public SEMI-TONE 1/2)
+(define-safe-public INFINITY-INT 1000000)
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; moments
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 09f526b8af..f52203468e 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -91,13 +91,6 @@
ly:grob::horizontal-skylines-from-element-stencils
ly:grob::pure-horizontal-skylines-from-element-stencils))
-;; Sometimes, in horizontal spacing, we want grobs to block other grobs.
-;; They thus need to have a non-empty height. We give them a point height
-;; so that, minimally, they block grobs directly to the right of them.
-;; Often this is complimented by an extra-spacing-height.
-;; We don't, however, want these grobs to factor into vertical spacing
-;; decisions, so we make their unpure height #f.
-
;; Using this as a callback for a grob's Y-extent promises
;; that the grob's stencil does not depend on line-spacing.
;; We use this promise to figure the space required by Clefs
@@ -283,8 +276,8 @@
(if (stem-stub::do-calculations grob)
(let* ((dad (ly:grob-parent grob X))
(refp (ly:grob-common-refpoint grob dad Y))
- (stem_ph (ly:grob-pure-height dad refp 0 1000000))
- (my_ph (ly:grob-pure-height grob refp 0 1000000))
+ (stem_ph (ly:grob-pure-height dad refp 0 INFINITY-INT))
+ (my_ph (ly:grob-pure-height grob refp 0 INFINITY-INT))
;; only account for distance if stem is on different staff than stub
(dist (if (grob::has-interface refp 'hara-kiri-group-spanner-interface)
0
@@ -505,13 +498,13 @@ and duration-log @var{log}."
(cons -0.1 0.1)))
(define-public (pure-from-neighbor-interface::extra-spacing-height grob)
- (let* ((height (ly:grob-pure-height grob grob 0 10000000))
+ (let* ((height (ly:grob-pure-height grob grob 0 INFINITY-INT))
(from-neighbors (interval-union
height
(ly:axis-group-interface::pure-height
grob
0
- 10000000))))
+ INFINITY-INT))))
(coord-operation - from-neighbors height)))
;; If there are neighbors, we place the height at their midpoint
@@ -526,13 +519,13 @@ and duration-log @var{log}."
(let* ((height (ly:axis-group-interface::pure-height
grob
0
- 10000000))
+ INFINITY-INT))
(c (interval-center height)))
(if (interval-empty? height) empty-interval (cons c c))))
;; Minimizes the impact of the height on vertical spacing while allowing
;; it to appear in horizontal skylines of paper columns if necessary.
-(define-public pure-from-neighbor-interface::unobtrusive-height
+(define-public pure-from-neighbor-interface::height-if-pure
(ly:make-unpure-pure-container #f pure-from-neighbor-interface::pure-height))
(define-public (pure-from-neighbor-interface::account-for-span-bar grob)
@@ -915,8 +908,7 @@ and duration-log @var{log}."
(ly:grob-relative-coordinate spanner common-y Y)))
(interval-end
(ly:grob-robust-relative-extent dots common X))
- ;; TODO: use real infinity constant.
- -10000))))
+ (- INFINITY-INT)))))
(right-x (max (- (interval-start
(ly:grob-robust-relative-extent right-span common X))
padding)