}
ENTER_DESCRIPTION(Chord_name_engraver,
-/* descr */ "Catch note-events, Tonic_reqs, Inversion_reqs, Bass_req
-and generate the appropriate chordname.",
+/* descr */ "Catch note-events, Tonic_reqs, Inversion_reqs, Bass_req "
+"and generate the appropriate chordname.",
/* creats*/ "ChordName",
/* accepts */ "note-event busy-playing-event",
/* acks */ "",
#include <ctype.h>
#include "translator-group.hh"
-
#include "bar-line.hh"
#include "staff-symbol-referencer.hh"
-
#include "engraver.hh"
#include "direction.hh"
#include "side-position-interface.hh"
#include "item.hh"
-
class Clef_engraver : public Engraver
{
public:
if (Bar_line::has_interface (info.grob_)
&& gh_string_p (get_property ("clefGlyph")))
create_clef ();
-
}
}
}
ADD_INTERFACE (Custos, "custos-interface",
- "A custos is a staff context symbol that appears at the end of a
- staff line with monophonic musical contents (i.e. with a single
- voice). It anticipates the pitch of the first note of the following
- line and thus helps the player or singer to manage line breaks
- during performance, thus enhancing readability of a score.
-
- Custodes were frequently used in music notation until the 16th
- century. There were different appearences for different notation
- styles. Nowadays, they have survived only in special forms of
- musical notation such as via the editio vaticana dating back to the
- beginning of the 20th century.
-
-[TODO: add to glossary]",
+ "Engrave custodes",
"style adjust-if-on-staffline neutral-direction neutral-position");
ADD_INTERFACE (Dots, "dots-interface",
- "The dots to go with a notehead/rest. A separate interface, since they
-are a party in collision resolution.
-#'direction is the Direction to handle staff-line collisions in.",
+ "The dots to go with a notehead/rest. A separate interface, since they "
+" are a party in collision resolution. "
+" #'direction is the Direction to handle staff-line collisions in.",
"direction dot-count");
LY_DEFINE(make_duration,
"ly:make-duration", 2, 2, 0, (SCM length, SCM dotcount,
SCM num, SCM den),
- "
-@var{length} is the negative logarithm (base 2) of the duration:
-1 is a half note, 2 is a quarter note, 3 is an eighth
-note, etc. The number of dots after the note is given by
-@var{dotcount}.
-
-The duration factor is optionally given by @var{num} and @var{den}.
-
-A duration is a musical duration, i.e. a length of time described by a
-power of two (whole, half, quarter, etc.) and a number of augmentation
-dots.
-
-")
+" \n"
+"@var{length} is the negative logarithm (base 2) of the duration:\n"
+"1 is a half note, 2 is a quarter note, 3 is an eighth\n"
+"note, etc. The number of dots after the note is given by\n"
+"@var{dotcount}.\n"
+"\n"
+"The duration factor is optionally given by @var{num} and @var{den}.\n"
+"\n"
+"A duration is a musical duration, i.e. a length of time described by a\n"
+"power of two (whole, half, quarter, etc.) and a number of augmentation\n"
+"dots. \n"
+"\n"
+"")
{
SCM_ASSERT_TYPE(gh_number_p (length), length, SCM_ARG1, __FUNCTION__, "integer");
SCM_ASSERT_TYPE(gh_number_p (dotcount), dotcount, SCM_ARG2, __FUNCTION__, "integer");
return ch;
}
+
+MAKE_SCHEME_CALLBACK(Font_interface, get_property_alist_chain, 1);
+SCM
+Font_interface::get_property_alist_chain (SCM grob)
+{
+
+ Grob * g = unsmob_grob (grob);
+ SCM_ASSERT_TYPE(g, grob, SCM_ARG1, __FUNCTION__, "grob");
+ return font_alist_chain (g);
+
+}
+
+
+
+
/*
todo: split up this func, reuse in text_item?
*/
LY_DEFINE(ly_find_glyph_by_name, "ly:find-glyph-by-name", 2 , 0, 0,
(SCM font, SCM name),
- "This function retrieves a Molecule for the glyph named @var{name} in
-@var{font}. The font must be available as an AFM file.")
+ "This function retrieves a Molecule for the glyph named @var{name} in "
+"@var{font}. The font must be available as an AFM file.")
{
Font_metric *fm = unsmob_metrics (font);
SCM_ASSERT_TYPE(fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
LY_DEFINE(ly_text_dimension,"ly:text-dimension", 2 , 0, 0,
(SCM font, SCM text),
- "Given the font metric in @var{font} and the string @var{text}, compute
-the extents of that text in that font. The return value is a pair of
-number-pairs.")
+ "Given the font metric in @var{font} and the string @var{text}, compute "
+"the extents of that text in that font. The return value is a pair of "
+"number-pairs.")
{
Box b;
Font_metric *fm = unsmob_metrics (font);
Molecule
Font_metric::get_char_molecule (int code) const
{
- Molecule m ;
SCM at = scm_list_n (ly_symbol2scm ("char"), gh_int2scm (code),
SCM_UNDEFINED);
at = fontify_atom (this, at);
#include "lily-guile.hh"
#include "protected-scm.hh"
+#include "string.hh"
static Protected_scm doc_hash_table ;
-void ly_add_function_documentation (char const * fname,
+void ly_add_function_documentation (SCM func,
+ char const * fname,
char const * varlist,
char const * doc)
{
if (!gh_vector_p (doc_hash_table ))
doc_hash_table = scm_make_vector (gh_int2scm (59), SCM_EOL);
+ String s = String (" - ") + "LilyPond procedure: " + fname + " " + varlist
+ + "\n" + doc ;
+ scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
+ scm_makfrom0str (s.to_str0 ()));
SCM entry = gh_cons (scm_makfrom0str (varlist), scm_makfrom0str (doc));
scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry);
}
static SCM add_style (Grob*, SCM style, SCM alist_chain);
static bool wild_compare (SCM field_val, SCM val);
DECLARE_SCHEME_CALLBACK (properties_to_font_name, (SCM,SCM));
+ DECLARE_SCHEME_CALLBACK (get_property_alist_chain, (SCM));
static bool has_interface (Grob*);
};
ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \
-void ly_add_function_documentation (char const * fname,
+void ly_add_function_documentation (SCM proc, char const * fname,
char const * varlist,
char const * doc);
{\
FNAME ## _proc \
= scm_c_define_gsubr (PRIMNAME,REQ, OPT, VAR, (Scheme_function_unknown) FNAME);\
- ly_add_function_documentation (PRIMNAME, #ARGLIST, DOCSTRING);\
+ ly_add_function_documentation ( FNAME ## _proc ,PRIMNAME, #ARGLIST, DOCSTRING);\
scm_c_export (PRIMNAME,NULL);\
}\
ADD_SCM_INIT_FUNC (INITPREFIX ## init_unique_prefix, INITPREFIX ## init);\
#define IMPLEMENT_TYPE_P(CL, FUNCNAME)\
void init_type_ ## CL ()\
{\
- scm_c_define_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
- ly_add_function_documentation (FUNCNAME, "(SCM x)", "Check if @var{x} is a " #CL " object");\
+ SCM subr = scm_c_define_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
+ ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", "Check if @var{x} is a " #CL " object");\
scm_c_export (FUNCNAME, NULL);\
}\
ADD_SCM_INIT_FUNC (init_type_ ## CL, init_type_ ## CL)
private:
int lookup_keyword (String);
int scan_bare_word (String);
+ SCM scan_markup_word (String);
int scan_escaped_word (String);
int identifier_type (SCM);
char escaped_char (char) const;
{
public:
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+ DECLARE_SCHEME_CALLBACK (text_to_molecule, (SCM,SCM, SCM));
static Molecule text2molecule (Grob *me, SCM text, SCM properties);
static Molecule string2molecule (Grob *me, SCM text, SCM properties);
static Molecule markup_text2molecule (Grob *me, SCM markup_text, SCM properties);
-
static bool has_interface (Grob*);
-
-
+
private:
static Molecule lookup_character (Grob *me, Font_metric*, SCM char_name);
static Molecule lookup_text (Grob *me, Font_metric*, SCM text);
return FIGURE_OPEN;
}
}
+
<notes,figures>{
{ALPHAWORD} {
return scan_bare_word (YYText ());
}
}
+
+
+
<<EOF>> {
{
last_input_ = here_input();
}
+
+#if 0
+SCM
+My_lily_lexer::scan_markup_word (String s)
+{
+ /*
+ TODO: better implementation:
+
+ - make a table of markup functions, for quicker lookup
+
+ - error handling.
+
+ */
+ SCM s = scm_c_eval_str ((s + "-markup").to_str0());
+ yylval.scm = s;
+ return MARKUP_HEAD;
+}
+#endif
}
return -1;
}
+#if 0
+
+markup:
+ STRING {
+ $$ = scm_list_n (scm_c_eval_string ("simple-markup"), $1, SCM_UNDEFINED);
+ }
+ | MARKUP_HEAD0 markup
+ | MARKUP_HEAD1 SCM_T markup
+ | MARKUP_HEAD2 markup
+ | MARKUP_LIST_HEAD
+ | MARKUP_LIST_HEAD
+ | markup_list {
+ $$ = $1
+ ;
+
+markup_list:
+ '<' markup_list_body '>' { $$ = scm_reverse_x ($1, SCM_EOL); }
+ ;
+
+markup_line:
+ '{' markup_list_body '}' { $$ = .. scm_reverse_x ($1, SCM_EOL); }
+
+ ;
+markup_list_body:
+ /**/ { $$ = SCM_EOL; }
+ markup_list_body markup {
+ $$ = gh_cons ($2, $1) ;
+ }
+ ;
+#endif
}
return Molecule ();
}
-
+
+
+MAKE_SCHEME_CALLBACK(Text_item,text_to_molecule,3);
+SCM
+Text_item::text_to_molecule (SCM grob, SCM props, SCM markup)
+{
+ Grob *me = unsmob_grob (grob);
+
+ return Text_item::text2molecule (me, markup, props).smobbed_copy();
+}
+
+
Molecule
Text_item::string2molecule (Grob *me, SCM text, SCM alist_chain)
{
startCluster = #(make-span-event 'ClusterEvent START)
stopCluster = #(make-span-event 'ClusterEvent STOP)
+
groupOpen = #(make-span-event 'NoteGroupingEvent START)
groupClose = #(make-span-event 'NoteGroupingEvent STOP)
"script.scm"
"drums.scm"
"midi.scm"
+ "new-markup.scm"
))
--- /dev/null
+
+
+
+(define-public (simple-markup grob props . rest)
+ (Text_item::text_to_molecule grob props (car rest))
+ )
+
+(define-public (line-markup grob props . rest)
+ (stack-molecules
+ X 1 1.0
+ (map (lambda (x) (interpret_markup grob props x)) (car rest)))
+ )
+
+(define (combine-molecule-list lst)
+ (if (null? (cdr lst)) (car lst)
+ (ly:add-molecule (car lst) (combine-molecule-list (cdr lst)))
+ ))
+
+(define-public (combine-markup grob props . rest)
+ (combine-molecule-list (map (lambda (x) (interpret_markup grob props x)) (car rest))))
+
+(define-public (bold-markup grob props . rest)
+ (interpret_markup grob (cons '((font-series . bold)) props) (car rest))
+ )
+
+(define-public (column-markup grob props . rest)
+ (stack-molecules
+ Y -1 0.0
+ (map (lambda (x) (interpret_markup grob props x)) (car rest)))
+ )
+
+;; todo. Use macro?
+(map
+ (lambda (x)
+
+ (set-object-property!
+ (eval (string->symbol (string-append (symbol->string x) "-markup")) (current-module))
+ 'markup-function? #t))
+
+ '(simple column bold combine line )
+ )
+
+(define-public (brew-new-markup-molecule grob)
+ (interpret_markup grob
+ (Font_interface::get_property_alist_chain grob)
+ (ly:get-grob-property grob 'text)
+ )
+ )
+
+(define (interpret_markup grob props markup)
+ (let*
+ (
+ (func (car markup))
+ (args (cdr markup))
+ )
+
+ (apply func (cons grob (cons props args)) )
+ ))
+
+(define (new-markup? x)
+ (markup-function? (car x))
+)
+
+(define (markup-function? x)
+ (object-property 'markup-function? x))