(internal_print): use callback to get glyph-name.
* lily/stem.cc (calc_stem_end_position): new function.
(calc_length): new function.
document details for stem.
remove Stem::get_direction()
* lily/bar-line.cc (before_line_breaking): remove function.
remove bar-size-procedure, break-glyph-function
* lily/grob.cc (get_stencil): simplify: use callback mechanism to
calculate stencil.
(get_print_stencil): rename from get_stencil: create stencil with
transparency, color and cause.
* scm/define-grobs.scm: change print-function to stencil callback everywhere.
* lily/grob.cc: elucidate doc about after/before-line-breaking
* lily/stem.cc (height): idem.
* lily/grob.cc: change after/before-line-breaking-callback to
after/before-line-breaking dummy properties.
* lily/grob.cc (other_axis_parent_positioning): new function.
(same_axis_parent_positioning): new function
* lily/stem.cc (calc_stem_end_position): use callback.
(calc_positioning_done): idem.
(calc_direction): idem.
(calc_stem_end_position): idem
(calc_stem_info): idem.
* scm/define-grob-properties.scm (all-user-grob-properties): doc
callbacks property.
\layout { raggedright= ##t }
-\version "2.6.0"
+\version "2.7.13"
\header{
texidoc="
A square bracket on the left indicates that the player should not
-\version "2.6.0"
+\version "2.7.13"
\header {
texidoc = "Arpeggio stays clear of accidentals and flipped note heads."
-\version "2.6.0"
+\version "2.7.13"
\header{
texidoc="
Arpeggios are supported, both cross-staff and broken single staff.
-\version "2.6.0"
+\version "2.7.13"
\header{
texidoc="No auto beams will be put over (manual) repeat bars."
}
-\version "2.6.0"
+\version "2.7.13"
\layout {
raggedright = ##t
}
texidoc = "Automatic beaming is also done on tuplets."
}
-\version "2.6.0"
+\version "2.7.13"
\layout { raggedright= ##t }
\relative c''{
-\version "2.6.0"
+\version "2.7.13"
\header {
texidoc = "Tuplet-spanner should not put (visible) brackets on
beam."
}
-\version "2.6.0"
+\version "2.7.13"
\layout {
raggedright = ##t
-\version "2.6.0"
+\version "2.7.13"
\header {
texidoc = "Excercise all output functions"
}
-\version "2.6.0"
+\version "2.7.13"
\paper { raggedright = ##t }
"hair-thickness "
"thick-thickness "
"glyph "
+ "glyph-name "
"bar-size "
);
"meta "
"minimum-X-extent "
"minimum-Y-extent "
- "print-function "
"spacing-procedure "
"staff-symbol "
"stencil "
DECLARE_SCHEME_CALLBACK (brew_ez_stencil, (SCM));
DECLARE_SCHEME_CALLBACK (extent, (SCM, SCM));
DECLARE_SCHEME_CALLBACK (stem_x_shift, (SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (calc_stem_attachment, (SCM));
static bool has_interface (Grob *);
static Real stem_attachment_coordinate (Grob *, Axis a);
static int get_balltype (Grob *);
primitives_.push (info);
if (info.grob ())
{
- info.grob ()->set_property ("print-function",
+ info.grob ()->set_callback (ly_symbol2scm ("stencil"),
brew_ligature_primitive_proc);
}
}
/*
Can't do suicide, since this mucks up finding the trend.
*/
- me->set_property ("print-function", SCM_EOL);
+ me->set_property ("transparent", SCM_BOOL_T);
}
return SCM_EOL;
}
if (!scm_is_symbol (style))
style = ly_symbol2scm ("default");
- SCM log = scm_from_int (Note_head::get_balltype (me));
String suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
if (style != ly_symbol2scm ("default"))
{
- SCM proc = me->get_property ("glyph-name-procedure");
- if (ly_is_procedure (proc))
- suffix = ly_scm2string (scm_call_2 (proc, log, style));
+ SCM gn = me->get_property ("glyph-name");
+ if (scm_is_string (gn))
+ suffix = ly_scm2string (gn);
}
+
Font_metric *fm = Font_interface::get_default_font (me);
String idx = "noteheads.s" + suffix;
Real
Note_head::stem_attachment_coordinate (Grob *me, Axis a)
{
- SCM brewer = me->get_property ("print-function");
+ Offset off = robust_scm2offset (me->get_property ("stem-attachment"),
+ Offset (0,0));
+
+ return off [a];
+}
+
+MAKE_SCHEME_CALLBACK(Note_head, calc_stem_attachment, 1);
+SCM
+Note_head::calc_stem_attachment (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
Font_metric *fm = Font_interface::get_default_font (me);
+ String key;
+ internal_print (me, &key);
- if (brewer == Note_head::print_proc)
+ Offset att;
+
+ int k = fm->name_to_index (key);
+ if (k >= 0)
{
- String key;
- internal_print (me, &key);
-
- int k = fm->name_to_index (key);
- if (k >= 0)
+ Box b = fm->get_indexed_char (k);
+ Offset wxwy = fm->attachment_point (key);
+ for (int i = X_AXIS ; i < NO_AXES; i++)
{
- Box b = fm->get_indexed_char (k);
- Offset wxwy = fm->attachment_point (key);
+ Axis a = Axis (i);
+
Interval v = b[a];
if (!v.is_empty ())
- return 2 * (wxwy[a] - v.center ()) / v.length ();
+ {
+ att[a] = (2 * (wxwy[a] - v.center ()) / v.length ());
+ }
}
}
- /*
- Fallback
- */
- SCM v = me->get_property ("stem-attachment-function");
- if (!ly_is_procedure (v))
- return 0.0;
-
- SCM result = scm_call_2 (v, me->self_scm (), scm_from_int (a));
- if (!scm_is_pair (result))
- return 0.0;
-
- result = (a == X_AXIS) ? scm_car (result) : scm_cdr (result);
-
- return robust_scm2double (result, 0);
+ return ly_offset2scm (att);
}
+
int
Note_head::get_balltype (Grob *me)
{
"note-names "
"glyph-name-procedure "
"accidental-grob "
+ "stem-attachment"
"style "
- "stem-attachment-function");
+ );
"avoid-note-head "
"beam "
"beaming "
+ "details "
"direction "
"duration-log "
"flag-style "
(glyph ,string? "a string determining what (style) of glyph is
typeset. Valid choices depend on the function that is reading this
property.")
- (glyph-name-procedure ,procedure? "Return the name of a character
-within font, to use for printing a symbol.")
-
(gap ,ly:dimension? "Size of a gap in a variable symbol.")
(gap-count ,integer? "Number of gapped beams for tremolo.")
(grace-space-factor ,number? "Space grace notes at this fraction
"Pair of staff coordinates @code{(@var{left}
. @var{right})}, where both @var{left} and @var{right} are in the
staff-space unit of the current staff.")
- (print-function ,procedure? "Function taking grob as argument,
-returning a @code{Stencil} object.")
-
(ratio ,number? "Parameter for slur shape. The higher this number, the
quicker the slur attains it @code{height-limit}.")
(remove-first ,boolean? "Remove the first staff of a orchestral score?")
staff spaces, counted from the middle line.")
(stemlet-length ,number? "How long should a stem over a rest be?")
- (stem-attachment-function ,procedure? "A function that calculates
-where a stem attaches to the note head? This is a fallback when this
-information is not specified in the font. The function takes a grob
-and axis argument, and returns a (@var{x} . @var{y}) pair, specifying
-location in terms of note head bounding box.")
+ (stem-attachment ,number-pair? "A (@var{x} . @var{y}) pair where the stem attaches to the notehead.")
(stem-end-position ,number? "Where does the stem end (the end is opposite to the support-head.")
(AmbitusNoteHead
. (
(duration-log . 2)
- (callbacks . ( (stencil . ,Note_head::print)))
- (glyph-name-procedure . ,find-notehead-symbol)
+ (callbacks . ((stencil . ,Note_head::print)
+ (glyph-name . ,note-head::calc-glyph-name)
+ ))
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(meta . ((class . Item)
(interfaces . (font-interface
(NoteHead
. (
- (callbacks . ((stencil . ,Note_head::print)))
+ (callbacks . ((stencil . ,Note_head::print)
+ (stem-attachment . ,Note_head::calc_stem_attachment)
+ (glyph-name . ,note-head::calc-glyph-name)
+ ))
+
+ ;; WTF is this?
(ligature-primitive-callback . ,Note_head::print)
- (glyph-name-procedure . ,find-notehead-symbol)
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(X-offset-callbacks . (,Note_head::stem_x_shift))
- (stem-attachment-function . ,note-head-style->attachment-coordinates)
(meta . ((class . Item)
(interfaces . (rhythmic-grob-interface
rhythmic-head-interface
(callbacks . ((stencil . ,Text_interface::print)))
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(font-size . -2)
- (stem-attachment-function . ,tablature-stem-attachment-function)
+ (stem-attachment . (1.0 . 1.35))
(font-series . bold)
(meta . ((class . Item)
(interfaces
;;; Tablature functions, by Jiba (jiba@tuxfamily.org)
;; The TabNoteHead stem attachment function.
-(define (tablature-stem-attachment-function style duration)
+(define (note-head::calc-tablature-stem-attachment grob)
(cons 0.0 1.35))
;; The TabNoteHead tablatureFormat callback.
;; silly, use alist?
-(define-public (find-notehead-symbol duration style)
- (case style
- ((xcircle) "2xcircle")
- ((harmonic) "0harmonic")
- ((baroque)
- ;; Oops, I actually would not call this "baroque", but, for
- ;; backwards compatibility to 1.4, this is supposed to take
- ;; brevis, longa and maxima from the neo-mensural font and all
- ;; other note heads from the default font. -- jr
- (if (< duration 0)
- (string-append (number->string duration) "neomensural")
- (number->string duration)))
- ((mensural)
- (string-append (number->string duration) (symbol->string style)))
- ((petrucci)
- (if (< duration 0)
- (string-append (number->string duration) "mensural")
- (string-append (number->string duration) (symbol->string style))))
- ((neomensural)
- (string-append (number->string duration) (symbol->string style)))
- ((default)
- ;; The default font in mf/feta-bolletjes.mf defines a brevis, but
- ;; neither a longa nor a maxima. Hence let us, for the moment,
- ;; take these from the neo-mensural font. TODO: mf/feta-bolletjes
- ;; should define at least a longa for the default font. The longa
- ;; should look exactly like the brevis of the default font, but
- ;; with a stem exactly like that of the quarter note. -- jr
- (if (< duration -1)
- (string-append (number->string duration) "neomensural")
- (number->string duration)))
- (else
- (if (string-match "vaticana*|hufnagel*|medicaea*" (symbol->string style))
- (symbol->string style)
- (string-append (number->string (max 0 duration))
- (symbol->string style))))))
+(define-public (note-head::calc-glyph-name grob)
+ (let*
+ ((style (ly:grob-property grob 'style))
+ (log (min 2 (ly:grob-property grob 'duration-log))))
+
+ (case style
+ ((xcircle) "2xcircle")
+ ((harmonic) "0harmonic")
+ ((baroque)
+ ;; Oops, I actually would not call this "baroque", but, for
+ ;; backwards compatibility to 1.4, this is supposed to take
+ ;; brevis, longa and maxima from the neo-mensural font and all
+ ;; other note heads from the default font. -- jr
+ (if (< log 0)
+ (string-append (number->string log) "neomensural")
+ (number->string log)))
+ ((mensural)
+ (string-append (number->string log) (symbol->string style)))
+ ((petrucci)
+ (if (< log 0)
+ (string-append (number->string log) "mensural")
+ (string-append (number->string log) (symbol->string style))))
+ ((neomensural)
+ (string-append (number->string log) (symbol->string style)))
+ ((default)
+ ;; The default font in mf/feta-bolletjes.mf defines a brevis, but
+ ;; neither a longa nor a maxima. Hence let us, for the moment,
+ ;; take these from the neo-mensural font. TODO: mf/feta-bolletjes
+ ;; should define at least a longa for the default font. The longa
+ ;; should look exactly like the brevis of the default font, but
+ ;; with a stem exactly like that of the quarter note. -- jr
+ (if (< log -1)
+ (string-append (number->string log) "neomensural")
+ (number->string log)))
+ (else
+ (if (string-match "vaticana*|hufnagel*|medicaea*" (symbol->string style))
+ (symbol->string style)
+ (string-append (number->string (max 0 log))
+ (symbol->string style)))))))
;; TODO junk completely?
(define (note-head-style->attachment-coordinates grob axis)