From: Han-Wen Nienhuys Date: Wed, 17 Jan 2007 13:59:42 +0000 (+0100) Subject: Remove outdated Stencil code. X-Git-Tag: release/2.11.12-1~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=98166b94174b63666a14a6a62bc16cf1b4163bce;p=lilypond.git Remove outdated Stencil code. - Stencil::origin_ - Stencil::origin() - Stencil::moved_to_edge() - ly:stencil-moved-to-edge - minimum argument for Stencil::add_at_edge and ly:stencil-combine-at-edge --- diff --git a/lily/accidental.cc b/lily/accidental.cc index 46d7d53f8b..cf47ebcbe1 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -25,8 +25,8 @@ parenthesize (Grob *me, Stencil m) Stencil close = font->find_by_name ("accidentals.rightparen"); - m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0, 0); - m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0, 0); + m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0); + m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0); return m; } @@ -177,7 +177,7 @@ Accidental_interface::print (SCM smob) if (acc.is_empty ()) me->warning (_ ("natural alteration glyph not found")); else - mol.add_at_edge (X_AXIS, LEFT, acc, 0.1, 0); + mol.add_at_edge (X_AXIS, LEFT, acc, 0.1); } if (to_boolean (me->get_property ("parenthesized"))) diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 381f6fe48f..234dbc44e3 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -84,11 +84,11 @@ Arpeggio::print (SCM smob) for (Real y = heads[LEFT]; y < heads[RIGHT]; y += squiggle.extent (Y_AXIS).length ()) - mol.add_at_edge (Y_AXIS, UP, squiggle, 0.0, 0); + mol.add_at_edge (Y_AXIS, UP, squiggle, 0.0); mol.translate_axis (heads[LEFT], Y_AXIS); if (dir) - mol.add_at_edge (Y_AXIS, dir, arrow, 0, 0); + mol.add_at_edge (Y_AXIS, dir, arrow, 0); return mol.smobbed_copy (); } diff --git a/lily/bar-line.cc b/lily/bar-line.cc index f87ebd4767..75dbc6c1be 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -78,37 +78,37 @@ Bar_line::compound_barline (Grob *me, string str, Real h, return thin; else if (str == "|." || (h == 0 && str == ":|")) { - m.add_at_edge (X_AXIS, LEFT, thick, 0, 0); - m.add_at_edge (X_AXIS, LEFT, thin, kern, 0); + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); } else if (str == ".|" || (h == 0 && str == "|:")) { - m.add_at_edge (X_AXIS, RIGHT, thick, 0, 0); - m.add_at_edge (X_AXIS, RIGHT, thin, kern, 0); + m.add_at_edge (X_AXIS, RIGHT, thick, 0); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); } else if (str == ":|") { - m.add_at_edge (X_AXIS, LEFT, thick, 0, 0); - m.add_at_edge (X_AXIS, LEFT, thin, kern, 0); - m.add_at_edge (X_AXIS, LEFT, colon, kern, 0); + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); } else if (str == "|:") { - m.add_at_edge (X_AXIS, RIGHT, thick, 0, 0); - m.add_at_edge (X_AXIS, RIGHT, thin, kern, 0); - m.add_at_edge (X_AXIS, RIGHT, colon, kern, 0); + m.add_at_edge (X_AXIS, RIGHT, thick, 0); + m.add_at_edge (X_AXIS, RIGHT, thin, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); } else if (str == ":|:") { - m.add_at_edge (X_AXIS, LEFT, thick, thinkern, 0); - m.add_at_edge (X_AXIS, LEFT, colon, kern, 0); - m.add_at_edge (X_AXIS, RIGHT, thick, kern, 0); - m.add_at_edge (X_AXIS, RIGHT, colon, kern, 0); + m.add_at_edge (X_AXIS, LEFT, thick, thinkern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + m.add_at_edge (X_AXIS, RIGHT, thick, kern); + m.add_at_edge (X_AXIS, RIGHT, colon, kern); } else if (str == ".|.") { - m.add_at_edge (X_AXIS, LEFT, thick, thinkern, 0); - m.add_at_edge (X_AXIS, RIGHT, thick, kern, 0); + m.add_at_edge (X_AXIS, LEFT, thick, thinkern); + m.add_at_edge (X_AXIS, RIGHT, thick, kern); } else if (str == "||") { @@ -116,8 +116,8 @@ Bar_line::compound_barline (Grob *me, string str, Real h, should align to other side? this never appears on the system-start? */ - m.add_at_edge (X_AXIS, RIGHT, thin, 0, 0); - m.add_at_edge (X_AXIS, RIGHT, thin, thinkern, 0); + m.add_at_edge (X_AXIS, RIGHT, thin, 0); + m.add_at_edge (X_AXIS, RIGHT, thin, thinkern); } else if (str == ":") { diff --git a/lily/beam.cc b/lily/beam.cc index a782cdfac4..ecc9d0b5a6 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -554,7 +554,7 @@ Beam::print (SCM grob) (me->layout ()->self_scm (), properties, quant_score)); if (!score.is_empty ()) - the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0, 0); + the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0); } #endif diff --git a/lily/dots.cc b/lily/dots.cc index 8a874c09b8..97ac61128e 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -52,7 +52,7 @@ Dots::print (SCM d) for (int i = scm_to_int (c); i--;) { d.translate_axis (2 * dw, X_AXIS); - mol.add_at_edge (X_AXIS, RIGHT, d, dw, 0); + mol.add_at_edge (X_AXIS, RIGHT, d, dw); } } return mol.smobbed_copy (); diff --git a/lily/hairpin.cc b/lily/hairpin.cc index f11e78def5..20808956ae 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -246,7 +246,7 @@ Hairpin::print (SCM smob) don't add another circle the hairpin is broken */ if (!broken[tip_dir]) - mol.add_at_edge (X_AXIS, tip_dir, Stencil (circle), 0, 0); + mol.add_at_edge (X_AXIS, tip_dir, Stencil (circle), 0); } mol.translate_axis (x_points[LEFT] diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 055728de05..445e461380 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -46,12 +46,6 @@ using namespace std; */ class Stencil { - /* - This provides the reference point of the symbol, for example with - characters, it is on the base line of the character. Usually, - ORIGIN is inside DIM_ - */ - Offset origin_; Box dim_; SCM expr_; @@ -60,17 +54,12 @@ public: Stencil (Box, SCM s); Stencil (); - Offset origin () const; SCM expr () const; /** Set dimensions to empty, or to (Interval (0, 0), Interval (0, 0) */ void set_empty (bool); - Stencil moved_to_edge (Axis a, Direction d, const Stencil &m, Real padding, - Real minimum) const; - - void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding, - Real minimum); + void add_at_edge (Axis a, Direction d, const Stencil &m, Real padding); void add_stencil (Stencil const &m); void translate (Offset); Stencil translated (Offset) const; diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 0db5cf7b69..7c88268b62 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -97,7 +97,7 @@ Key_signature_interface::print (SCM smob) && last_pos > pos - 6) padding = 0.3; - mol.add_at_edge (X_AXIS, LEFT, acc, padding, 0); + mol.add_at_edge (X_AXIS, LEFT, acc, padding); last_pos = pos; } } diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 8baa5363e8..f6809cda26 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -136,7 +136,7 @@ Line_spanner::line_stencil (Grob *me, Stencil mol; do - mol.add_at_edge (X_AXIS, RIGHT, m, 0, 0); + mol.add_at_edge (X_AXIS, RIGHT, m, 0); while (m.extent (X_AXIS).length () && mol.extent (X_AXIS).length () + m.extent (X_AXIS).length () < dz[X_AXIS]) diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 5be417004b..1b66670a7c 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -183,8 +183,8 @@ Multi_measure_rest::big_rest (Grob *me, Real width) Stencil m = Lookup::round_filled_box (b, blot); Stencil yb = Lookup::round_filled_box (Box (Interval (-0.5, 0.5) * ythick, Interval (-ss, ss)), blot); - m.add_at_edge (X_AXIS, RIGHT, yb, 0, 0); - m.add_at_edge (X_AXIS, LEFT, yb, 0, 0); + m.add_at_edge (X_AXIS, RIGHT, yb, 0); + m.add_at_edge (X_AXIS, LEFT, yb, 0); m.align_to (X_AXIS, LEFT); @@ -268,7 +268,7 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measures, Stencil mol; for (SCM s = mols; scm_is_pair (s); s = scm_cdr (s)) mol.add_at_edge (X_AXIS, LEFT, *unsmob_stencil (scm_car (s)), - inner_padding, 0); + inner_padding); mol.align_to (X_AXIS, LEFT); mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS); diff --git a/lily/paper-column.cc b/lily/paper-column.cc index c313475f49..4dba6bbbd5 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -160,7 +160,7 @@ Paper_column::print (SCM p) properties, ly_string2scm (when)); Stencil t = *unsmob_stencil (scm_mol); - t.add_at_edge (Y_AXIS, DOWN, *unsmob_stencil (when_mol), 0.1, 0.1); + t.add_at_edge (Y_AXIS, DOWN, *unsmob_stencil (when_mol), 0.1); t.align_to (X_AXIS, CENTER); t.align_to (Y_AXIS, DOWN); diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc index 6d37c0c619..451647fb5c 100644 --- a/lily/percent-repeat-item.cc +++ b/lily/percent-repeat-item.cc @@ -38,14 +38,14 @@ Percent_repeat_item_interface::x_percent (Grob *me, int count, Stencil s = brew_slash (me); for (int i = count; i--;) - m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern, 0); + m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern); Stencil d1 = Font_interface::get_default_font (me)->find_by_name ("dots.dot"); Stencil d2 = d1; d1.translate_axis (0.5, Y_AXIS); d2.translate_axis (-0.5, Y_AXIS); - m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern, 0); - m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern, 0); + m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern); + m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern); return m; } diff --git a/lily/slur.cc b/lily/slur.cc index 269c6b551b..1f9e605fb9 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -153,7 +153,7 @@ Slur::print (SCM smob) Stencil tm = *unsmob_stencil (Text_interface::interpret_markup (me->layout ()->self_scm (), properties, quant_score)); - a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0, 0); + a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0); } #endif diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 13c291da35..6ef0e191fd 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -85,60 +85,6 @@ LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?", return scm_from_bool (s->is_empty ()); } -LY_DEFINE (ly_stencil_origin, "ly:stencil-origin", - 2, 0, 0, (SCM stil, SCM axis), - "Return a pair of numbers signifying the origin @var{stil} in " - "@var{axis} direction (0 or 1 for x and y axis respectively).") -{ - Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); - - return scm_from_double (s->origin ()[Axis (scm_to_int (axis))]); -} - -LY_DEFINE (ly_stencil_moved_to_edge, "ly:stencil-moved-to-edge", - 4, 2, 0, (SCM first, SCM axis, SCM direction, SCM second, - SCM padding, SCM minimum), - "Similar to @code{ly:stencil-combine-edge}, but returns " - "@var{second} positioned to be next to @var{first}. ") -{ - /* - C&P from combine-at-edge. - - fixme: just used once. - */ - Stencil *s1 = unsmob_stencil (first); - Stencil *s2 = unsmob_stencil (second); - Stencil first_stencil; - - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); - SCM_ASSERT_TYPE (is_direction (direction), direction, SCM_ARG4, __FUNCTION__, "dir"); - - Real p = 0.0; - if (padding != SCM_UNDEFINED) - { - SCM_ASSERT_TYPE (scm_is_number (padding), padding, SCM_ARG5, __FUNCTION__, "number"); - p = scm_to_double (padding); - } - Real m = 0.0; - if (minimum != SCM_UNDEFINED) - { - SCM_ASSERT_TYPE (scm_is_number (minimum), minimum, SCM_ARG6, __FUNCTION__, "number"); - m = scm_to_double (minimum); - } - - if (s1) - first_stencil = *s1; - - if (s2) - return first_stencil.moved_to_edge (Axis (scm_to_int (axis)), - Direction (scm_to_int (direction)), - *s2, p, m).smobbed_copy (); - else - return Stencil ().smobbed_copy (); -} - LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", 4, 2, 0, (SCM first, SCM axis, SCM direction, SCM second, @@ -181,7 +127,7 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", if (s2) result.add_at_edge (Axis (scm_to_int (axis)), - Direction (scm_to_int (direction)), *s2, p, m); + Direction (scm_to_int (direction)), *s2, p); return result.smobbed_copy (); } diff --git a/lily/stencil.cc b/lily/stencil.cc index 0da8031c4b..b88b0c8bde 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -72,11 +72,6 @@ Stencil::extent_box () const { return dim_; } -Offset -Stencil::origin () const -{ - return origin_; -} /* * Rotate this stencil around the point [x, y] @@ -143,7 +138,6 @@ Stencil::translate (Offset o) expr_, SCM_UNDEFINED); if (!is_empty ()) dim_.translate (o); - origin_ += o; } void @@ -186,13 +180,9 @@ Stencil::align_to (Axis a, Real x) translate_axis (-i.linear_combination (x), a); } -/* FIXME: unintuitive naming, you would expect *this to be moved. - Kept (keeping?) API for compat with add_at_edge (). - - What is PADDING, what is MINIMUM, exactly? */ -Stencil -Stencil::moved_to_edge (Axis a, Direction d, Stencil const &s, - Real padding, Real minimum) const +/* See scheme Function. */ +void +Stencil::add_at_edge (Axis a, Direction d, Stencil const &s, Real padding) { Interval my_extent = dim_[a]; Interval i (s.extent (a)); @@ -210,20 +200,7 @@ Stencil::moved_to_edge (Axis a, Direction d, Stencil const &s, Stencil toadd (s); toadd.translate_axis (offset, a); - - if (minimum > 0 && d * (-origin ()[a] + toadd.origin ()[a]) < minimum) - toadd.translate_axis (-toadd.origin ()[a] - + origin ()[a] + d * minimum, a); - - return toadd; -} - -/* See scheme Function. */ -void -Stencil::add_at_edge (Axis a, Direction d, Stencil const &s, Real padding, - Real minimum) -{ - add_stencil (moved_to_edge (a, d, s, padding, minimum)); + add_stencil (toadd); } Stencil diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index d36bb8d432..8056ea89a2 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -58,7 +58,7 @@ Sustain_pedal::print (SCM smob) idx += string (&text.c_str ()[i], 1); Stencil m = Font_interface::get_default_font (e)->find_by_name (idx); if (!m.is_empty ()) - mol.add_at_edge (X_AXIS, RIGHT, m, 0, 0); + mol.add_at_edge (X_AXIS, RIGHT, m, 0); } return mol.smobbed_copy (); diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index a42d73c16d..206ccd84db 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -42,7 +42,7 @@ System_start_delimiter::staff_bracket (Grob *me, Real height) Stencil bracket = Lookup::filled_box (box); Direction d = DOWN; do - bracket.add_at_edge (Y_AXIS, d, tips[d], -overlap, 0.0); + bracket.add_at_edge (Y_AXIS, d, tips[d], -overlap); while (flip (&d) != DOWN); bracket = Stencil (box, bracket.expr ()); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 273fe1c56c..c4afd8caa0 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -106,8 +106,8 @@ Time_signature::numbered_time_signature (Grob *me, int num, int den) Stencil m; if (den) { - m.add_at_edge (Y_AXIS, UP, n, 0.0, 0); - m.add_at_edge (Y_AXIS, DOWN, d, 0.0, 0); + m.add_at_edge (Y_AXIS, UP, n, 0.0); + m.add_at_edge (Y_AXIS, DOWN, d, 0.0); } else { diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc index 53636c709e..49018d8adb 100644 --- a/lily/volta-bracket.cc +++ b/lily/volta-bracket.cc @@ -99,7 +99,7 @@ Volta_bracket_interface::print (SCM smob) num.align_to (Y_AXIS, UP); num.translate_axis (-0.5, Y_AXIS); total.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length () - - 1.0, 0); + - 1.0); } total.translate_axis (left, X_AXIS); diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index aef9e3aa28..12dd691634 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -716,7 +716,7 @@ alignment accordingly." (let* ((m1 (interpret-markup layout props arg1)) (m2 (interpret-markup layout props arg2))) - (ly:stencil-combine-at-edge m1 axis dir m2 0.0 0.0) + (ly:stencil-combine-at-edge m1 axis dir m2 0.0) )) (define-builtin-markup-command (transparent layout props arg) (markup?) @@ -1465,80 +1465,6 @@ that. (let ((th 0.1) ;; todo: take from GROB. (m (interpret-markup layout props arg))) (bracketify-stencil m Y th (* 2.5 th) th))) - -(define-builtin-markup-command (bracketed-y-column layout props indices args) - (list? markup-list?) - "Make a column of the markups in @var{args}, putting brackets around -the elements marked in @var{indices}, which is a list of numbers. - -" -;; -;; DROPME? This command is a relic from the old figured bass implementation. -;; - - (define (sublist lst start stop) - (take (drop lst start) (- (1+ stop) start))) - - (define (stencil-list-extent ss axis) - (cons - (apply min (map (lambda (x) (car (ly:stencil-extent x axis))) ss)) - (apply max (map (lambda (x) (cdr (ly:stencil-extent x axis))) ss)))) - - - (define (stack-stencils-vertically stencils bskip last-stencil) - (cond - ((null? stencils) '()) - ((not (ly:stencil? last-stencil)) - (cons (car stencils) - (stack-stencils-vertically (cdr stencils) bskip (car stencils)))) - (else - (let* ((orig (car stencils)) - (dir (chain-assoc-get 'direction props DOWN)) - (new (ly:stencil-moved-to-edge last-stencil Y dir - orig - 0.1 bskip))) - - (cons new (stack-stencils-vertically (cdr stencils) bskip new)))))) - - (define (make-brackets stencils indices acc) - (if (and stencils - (pair? indices) - (pair? (cdr indices))) - (let* ((encl (sublist stencils (car indices) (cadr indices))) - (x-ext (stencil-list-extent encl X)) - (y-ext (stencil-list-extent encl Y)) - (thick 0.10) - (pad 0.35) - (protusion (* 2.5 thick)) - (lb - (ly:stencil-translate-axis - (ly:bracket Y y-ext thick protusion) - (- (car x-ext) pad) X)) - (rb (ly:stencil-translate-axis - (ly:bracket Y y-ext thick (- protusion)) - (+ (cdr x-ext) pad) X))) - - (make-brackets - stencils (cddr indices) - (append - (list lb rb) - acc))) - acc)) - - (let* ((stencils - (map (lambda (x) - (interpret-markup - layout - props - x)) args)) - (leading - (chain-assoc-get 'baseline-skip props)) - (stacked (stack-stencils-vertically - (remove ly:stencil-empty? stencils) 1.25 #f)) - (brackets (make-brackets stacked indices '()))) - - (apply ly:stencil-add - (append stacked brackets)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scm/fret-diagrams.scm b/scm/fret-diagrams.scm index a682a824be..69194956f3 100644 --- a/scm/fret-diagrams.scm +++ b/scm/fret-diagrams.scm @@ -80,44 +80,44 @@ Line thickness is given by @var{th}, fret & string spacing by (ly:stencil-combine-at-edge (draw-strings (- string-count 1) fret-range th size) X RIGHT string-stencil - gap 0)))) + gap)))) (define (draw-fret-lines fret-count string-count th size) - "Draw @var{fret-count} frets (horizontal lines) for a fret diagram + "Draw @var{fret-count} frets (horizontal lines) for a fret diagram with @var{string-count} strings. Line thickness is given by @var{th}, fret & string spacing by @var{size}. " - (let* ((fret-length (* (- string-count 1) size)) - (sth (* size th)) - (half-thickness (* sth 0.5)) - (gap (- size sth)) - (fret-line (ly:make-stencil (list 'draw-line sth half-thickness size (- fret-length half-thickness) size) - (cons 0 fret-length) - (cons (- size half-thickness) (+ size half-thickness))))) - (if (= fret-count 1) - fret-line - (ly:stencil-combine-at-edge fret-line Y UP - (draw-fret-lines (- fret-count 1) string-count th size) - gap 0)))) - + (let* ((fret-length (* (- string-count 1) size)) + (sth (* size th)) + (half-thickness (* sth 0.5)) + (gap (- size sth)) + (fret-line (ly:make-stencil (list 'draw-line sth half-thickness size (- fret-length half-thickness) size) + (cons 0 fret-length) + (cons (- size half-thickness) (+ size half-thickness))))) + (if (= fret-count 1) + fret-line + (ly:stencil-combine-at-edge fret-line Y UP + (draw-fret-lines (- fret-count 1) string-count th size) + gap)))) + (define (draw-thick-top-fret props string-count th size) - "Draw a thick top fret for a fret diagram whose base fret is not 1." - (let* ((sth (* th size)) -; (top-fret-thick (* sth (chain-assoc-get 'top-fret-thickness props 3.0))) - (top-fret-thick (* sth 3.0)) -; (top-half-thick (* top-fret-thick 0.5)) - (half-thick (* sth 0.5)) - (x1 half-thick) - (x2 (+ half-thick (* size (- string-count 1)))) - (y1 (- half-thick)) - (y2 (+ top-fret-thick half-thick)) - (x-extent (cons (- x1) x2)) - (y-extent (cons 0 y2))) - (ly:make-stencil (list 'round-filled-box x1 x2 y1 y2 sth) - x-extent y-extent))) - - + "Draw a thick top fret for a fret diagram whose base fret is not 1." + (let* ((sth (* th size)) + ; (top-fret-thick (* sth (chain-assoc-get 'top-fret-thickness props 3.0))) + (top-fret-thick (* sth 3.0)) + ; (top-half-thick (* top-fret-thick 0.5)) + (half-thick (* sth 0.5)) + (x1 half-thick) + (x2 (+ half-thick (* size (- string-count 1)))) + (y1 (- half-thick)) + (y2 (+ top-fret-thick half-thick)) + (x-extent (cons (- x1) x2)) + (y-extent (cons 0 y2))) + (ly:make-stencil (list 'round-filled-box x1 x2 y1 y2 sth) + x-extent y-extent))) + + (define (draw-frets layout props fret-range string-count th size) - "Draw the frets (horizontal lines) for a fret diagram with + "Draw the frets (horizontal lines) for a fret diagram with @var{string-count} strings and frets as indicated in @var{fret-range}. Line thickness is given by @var{th}, fret & string spacing by @var{size}. " @@ -125,13 +125,13 @@ Line thickness is given by @var{th}, fret & string spacing by (fret-length (* (- string-count 1) size)) (half-thickness (* th 0.5)) (base-fret (car fret-range))) - (ly:stencil-combine-at-edge - (draw-fret-lines fret-count string-count th size) Y UP - (if (= base-fret 1) - (draw-thick-top-fret props string-count th size) - (draw-fret-lines 1 string-count th size)) - (- size th) 0))) - + (ly:stencil-combine-at-edge + (draw-fret-lines fret-count string-count th size) Y UP + (if (= base-fret 1) + (draw-thick-top-fret props string-count th size) + (draw-fret-lines 1 string-count th size)) + (- size th)))) + (define (draw-dots layout props string-count fret-range size finger-code dot-position dot-radius dot-thickness dot-list) @@ -383,11 +383,11 @@ indications per string. (if (not (null? xo-list)) (set! fret-diagram-stencil (ly:stencil-combine-at-edge fret-diagram-stencil Y UP - (draw-xo layout props string-count fret-range size xo-list) xo-padding 0))) + (draw-xo layout props string-count fret-range size xo-list) xo-padding))) (if (> (car fret-range) 1) (set! fret-diagram-stencil (ly:stencil-combine-at-edge fret-diagram-stencil X label-dir - (label-fret layout props string-count fret-range size) label-space 0))) + (label-fret layout props string-count fret-range size) label-space))) (ly:stencil-aligned-to fret-diagram-stencil X alignment) )) diff --git a/scm/page.scm b/scm/page.scm index 40fd537557..3e25bdaaee 100644 --- a/scm/page.scm +++ b/scm/page.scm @@ -158,7 +158,7 @@ (set! head-stencil (ly:stencil-combine-at-edge stencil Y dir head-stencil - sep 0.0)) + sep)) ;; add arrow markers diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 65c5bfa6dd..c47f05583b 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -125,7 +125,6 @@ ly:stencil-combine-at-edge ly:stencil-expr ly:stencil-extent - ly:stencil-moved-to-edge ly:stencil-translate ly:stencil-translate-axis ly:stencil? diff --git a/scm/stencil.scm b/scm/stencil.scm index 62b43cebc2..410e0eebe1 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -240,11 +240,11 @@ encloses the contents. (set! annotation (center-stencil-on-extent text-stencil)) (set! annotation - (ly:stencil-combine-at-edge arrows X RIGHT annotation 0.5 0)) + (ly:stencil-combine-at-edge arrows X RIGHT annotation 0.5)) (set! annotation (ly:stencil-combine-at-edge annotation X LEFT (center-stencil-on-extent dim-stencil) - 0.5 0)) + 0.5)) (set! annotation (ly:make-stencil (list 'color color (ly:stencil-expr annotation)) (ly:stencil-extent annotation X)