From: Han-Wen Nienhuys Date: Tue, 31 Jan 2006 14:42:32 +0000 (+0000) Subject: (calc_direction): take dir from visible stem in X-Git-Tag: release/2.7.31~35 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=aed0295b202901dcd07b289f94ff258a06b547e7;p=lilypond.git (calc_direction): take dir from visible stem in degenerate case. --- diff --git a/ChangeLog b/ChangeLog index 3a02ed749f..1fada840c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-31 Han-Wen Nienhuys + + * lily/beam.cc (calc_direction): take dir from visible stem in + degenerate case. + 2006-01-31 Jan Nieuwenhuizen * lily/melody-spanner.cc (spanner::calc_neutral_stem_direction): diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 89ccdb9556..0e5ad978e7 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -213,8 +213,7 @@ This feature was sponsored by Trent Johnston. This rewrite was sponsored by Trent Johnston. @item String arguments for music functions may be specified without -@code{#} marks. This allows syntactical constructs (like \clef and -\bar) to be expressed in generic music functions. +@code{#} marks. Now, \clef and \bar are also music functions. @item Ties in chords are also formatted using a scoring based formatting. This reduces the number of collisions for ties in chords, diff --git a/THANKS b/THANKS index 42ac0b46e4..c5f752f008 100644 --- a/THANKS +++ b/THANKS @@ -67,6 +67,7 @@ Joe Neeman Jukka Akkanen Lambros Lambrou Laura Conrad +Mark Steinhauser Matevž Jekovec Michael Welsh Duggan Milan Zamazal diff --git a/lily/beam.cc b/lily/beam.cc index 712c4d5c04..bb48a4572d 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -140,16 +140,18 @@ Beam::calc_direction (SCM smob) me->suicide (); return SCM_UNSPECIFIED; } - else + else { - d = to_dir (stems[0]->get_property ("default-direction")); + Grob *stem = first_visible_stem (me); + d = to_dir (stem->get_property ("default-direction")); } } - if (count >= 1) { - d = get_default_dir (me); + if (!d) + d = get_default_dir (me); + consider_auto_knees (me); } diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 6d9d03cf16..8d327c0034 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -195,39 +195,9 @@ normally inserted before elements on a line. @var{size}." (if (ly:get-option 'safe) - (interpret-markup layout props "not allowed in safe") - (let* - ((contents (ly:gulp-file file-name)) - (bbox (get-postscript-bbox contents)) - (bbox-size (if (= axis X) - (- (list-ref bbox 2) (list-ref bbox 0)) - (- (list-ref bbox 3) (list-ref bbox 1)) - )) - (factor (exact->inexact (/ size bbox-size))) - (scaled-bbox - (map (lambda (x) (* factor x)) bbox))) - - (if bbox - (ly:make-stencil - (list - 'embedded-ps - (format - - "BeginEPSF -~a ~a scale -%%BeginDocument: ~a -~a -%%EndDocument -EndEPSF" - factor factor - file-name - contents)) - (cons (list-ref scaled-bbox 0) (list-ref scaled-bbox 2)) - (cons (list-ref scaled-bbox 1) (list-ref scaled-bbox 3))) - - (ly:make-stencil "" '(0 . 0) '(0 . 0))) - ))) - + (interpret-markup layout props "not allowed in safe") + (eps-file->stencil axis size file-name) + )) (def-markup-command (postscript layout props str) (string?) "This inserts @var{str} directly into the output as a PostScript diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 04de883e6a..f7d0ee5b44 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -130,9 +130,9 @@ (ly:number->string y2) " lineto stroke")) (define (embedded-ps string) + (display (list "len " (string-length string) "\n")) string) - (define (glyph-string postscript-font-name size cid? diff --git a/scm/stencil.scm b/scm/stencil.scm index d0e220d26b..1bfa43a745 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -215,3 +215,38 @@ encloses the contents. (ly:stencil-extent annotation X) (cons 10000 -10000))) annotation)) + + +(define-public (eps-file->stencil axis size file-name) + (let* + ((contents (ly:gulp-file file-name)) + (bbox (get-postscript-bbox contents)) + (bbox-size (if (= axis X) + (- (list-ref bbox 2) (list-ref bbox 0)) + (- (list-ref bbox 3) (list-ref bbox 1)) + )) + (factor (exact->inexact (/ size bbox-size))) + (scaled-bbox + (map (lambda (x) (* factor x)) bbox))) + + (if bbox + (ly:make-stencil + (list + 'embedded-ps + (string-append + (format + "BeginEPSF +~a ~a scale +%%BeginDocument: ~a +" factor factor + file-name + ) + contents + "%%EndDocument +EndEPSF")) + + (cons (list-ref scaled-bbox 0) (list-ref scaled-bbox 2)) + (cons (list-ref scaled-bbox 1) (list-ref scaled-bbox 3))) + + (ly:make-stencil "" '(0 . 0) '(0 . 0))) + ))