lookup_tex_text_dimension() first.
* lily/tfm.cc: new function ly:load-text-dimensions
SCM
substitute_mutable_property_alist (SCM alist)
{
- SCM grob_list_p = ly_scheme_function ("grob-list?");
+ SCM grob_list_p = ly_lily_module_constant ("grob-list?");
SCM l = SCM_EOL;
SCM *tail = &l;
Spanner*s = this;
bool fast_done = false;
- SCM grob_list_p = ly_scheme_function ("grob-list?");
+ SCM grob_list_p = ly_lily_module_constant ("grob-list?");
if (type == grob_list_p)
fast_done = s->fast_fubstitute_grob_list (sym, val);
scm_from_int (10));
g->set_property ("text",
- scm_list_n (ly_scheme_function ("vcenter-markup"),
+ scm_list_n (ly_lily_module_constant ("vcenter-markup"),
txt, SCM_UNDEFINED));
Side_position_interface::add_support (g,clef_);
String font_coding = m->coding_scheme ();
if (font_coding == input_coding)
return code;
- SCM s = scm_call_3 (ly_scheme_function ("encoded-index"),
+ SCM s = scm_call_3 (ly_lily_module_constant ("encoded-index"),
scm_makfrom0str (input_coding.to_str0 ()),
scm_makfrom0str (font_coding.to_str0 ()),
scm_int2num (code));
SCM
properties_to_font_size_family (SCM fonts, SCM alist_chain)
{
- return scm_call_2 (ly_scheme_function ("lookup-font"), fonts, alist_chain);
+ return scm_call_2 (ly_lily_module_constant ("lookup-font"), fonts, alist_chain);
}
Font_metric *
/*
TODO: rename me to ly_c_lily_module_eval
*/
-#define ly_scheme_function(x) \
+#define ly_lily_module_constant(x) \
({ \
static SCM cached; \
/* We store this one locally, since G++ -O2 fucks up else */ \
if (key_req_)
{
SCM pitchlist = key_req_->get_property ("pitch-alist");
- SCM proc = ly_scheme_function ("alterations-in-key");
+ SCM proc = ly_lily_module_constant ("alterations-in-key");
SCM acc = scm_call_1 (proc, pitchlist);
SCM
lookup_markup_command (String s)
{
- SCM proc = ly_scheme_function ("lookup-markup-command");
+ SCM proc = ly_lily_module_constant ("lookup-markup-command");
return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ()));
}
SCM
ly_to_string (SCM scm)
{
- return scm_call_3 (ly_scheme_function ("format"), SCM_BOOL_F,
+ return scm_call_3 (ly_lily_module_constant ("format"), SCM_BOOL_F,
scm_makfrom0str ("~S"), scm);
}
{
SCM errport = scm_current_error_port ();
ok = false;
- SCM typefunc = ly_scheme_function ("type-name");
+ SCM typefunc = ly_lily_module_constant ("type-name");
SCM type_name = scm_call_1 (typefunc, type);
/* UGH. */
SCM val = SCM_BOOL_F;
if (ly_symbol2scm ("line-column") == what)
- val = ly_scheme_function ("line-column-location");
+ val = ly_lily_module_constant ("line-column-location");
else if (what == ly_symbol2scm ("line"))
- val = ly_scheme_function ("line-location");
+ val = ly_lily_module_constant ("line-location");
scm_module_define (global_lily_module, ly_symbol2scm ("point-and-click"),
val);
}
else
{
- SCM proc = ly_scheme_function ("make-safe-lilypond-module");
+ SCM proc = ly_lily_module_constant ("make-safe-lilypond-module");
mod = scm_call_0 (proc);
}
return mod;
exit (2);
}
- SCM result = scm_call_1 (ly_scheme_function ("lilypond-main"), files);
+ SCM result = scm_call_1 (ly_lily_module_constant ("lilypond-main"), files);
(void) result;
/*
UGH. don't use eval.
*/
- SCM proc = ly_scheme_function ("midi-program");
+ SCM proc = ly_lily_module_constant ("midi-program");
SCM program = scm_call_1 (proc, ly_symbol2scm (audio_->str_.to_str0 ()));
found = (program != SCM_BOOL_F);
if (found)
&& input_encoding_ != "ASCII"
&& input_encoding_ != font_encoding)
{
- coding_vector_ = scm_call_1 (ly_scheme_function ("get-coding-vector"),
+ coding_vector_ = scm_call_1 (ly_lily_module_constant ("get-coding-vector"),
scm_makfrom0str (font_encoding.to_str0 ()));
if (!ly_c_vector_p (coding_vector_))
coding_vector_ = scm_c_make_vector (256, ly_symbol2scm (".notdef"));
}
- coding_table_ = scm_call_1 (ly_scheme_function ("get-coding-table"),
+ coding_table_ = scm_call_1 (ly_lily_module_constant ("get-coding-table"),
scm_makfrom0str (font_encoding.to_str0 ()));
coding_mapping_
- = scm_call_2 (ly_scheme_function ("make-encoding-mapping"),
+ = scm_call_2 (ly_lily_module_constant ("make-encoding-mapping"),
coding_vector_,
coding_table_);
if (scm_car (s) == Music_type_p_proc)
str += "music";
- else if (scm_car (s) == ly_scheme_function("markup?"))
+ else if (scm_car (s) == ly_lily_module_constant("markup?"))
str += "markup";
else if (ly_c_procedure_p (scm_car (s)))
str += "scm";
Music*
make_music_by_name (SCM sym)
{
- SCM make_music_proc = ly_scheme_function ("make-music");
+ SCM make_music_proc = ly_lily_module_constant ("make-music");
SCM rv = scm_call_1 (make_music_proc, sym);
/* UGH. */
Output_def *
scale_output_def (Output_def *o, Real amount)
{
- SCM proc = ly_scheme_function ("scale-layout");
+ SCM proc = ly_lily_module_constant ("scale-layout");
SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_double2num (amount));
scm_gc_protect_object (new_pap);
SCM ell = SCM_EOL;
if (scm_hash_table_p (font_table) == SCM_BOOL_T)
{
- SCM func = ly_scheme_function ("hash-table->alist");
+ SCM func = ly_lily_module_constant ("hash-table->alist");
for (SCM s = scm_call_1 (func, font_table); scm_is_pair (s);
s = scm_cdr (s))
static SCM module = SCM_BOOL_F;
if (module == SCM_BOOL_F)
{
- SCM function = ly_scheme_function ("make-safe-lilypond-module");
+ SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
module = scm_call_0 (function);
}
answer = scm_eval (form, module);
SCM
make_simple_markup (SCM encoding, SCM a)
{
- SCM simple = ly_scheme_function ("simple-markup");
+ SCM simple = ly_lily_module_constant ("simple-markup");
if (scm_is_symbol (encoding))
- return scm_list_3 (ly_scheme_function ("encoded-simple-markup"),
+ return scm_list_3 (ly_lily_module_constant ("encoded-simple-markup"),
encoding, a);
return scm_list_2 (simple, a);
}
SCM
make_chord (SCM pitch, SCM dur, SCM modification_list)
{
- SCM chord_ctor = ly_scheme_function ("construct-chord");
+ SCM chord_ctor = ly_lily_module_constant ("construct-chord");
SCM ch = scm_call_3 (chord_ctor, pitch, dur, modification_list);
scm_gc_protect_object (ch);
return ch;
}
- SCM proc = ly_scheme_function ("make-repeated-music");
+ SCM proc = ly_lily_module_constant ("make-repeated-music");
SCM mus = scm_call_1 (proc, $2);
scm_gc_protect_object (mus); // UGH.
we can not get durations and other stuff correct down the line, so we have to
add to the duration log here.
*/
- SCM func = ly_scheme_function ("shift-duration-log");
+ SCM func = ly_lily_module_constant ("shift-duration-log");
int dots = ($3 % 3) ? 0 : 1;
int shift = -intlog2 ((dots) ? ($3*2/3) : $3);
SCM args = scm_cddr ($1);
SCM sig = scm_object_property (func, ly_symbol2scm ("music-function-signature"));
- SCM type_check_proc = ly_scheme_function ("type-check-list");
+ SCM type_check_proc = ly_lily_module_constant ("type-check-list");
bool ok = true;
if (!to_boolean (scm_call_3 (type_check_proc, scm_cadr ($1), sig, args)))
add_quote:
ADDQUOTE string Music {
- SCM adder = ly_scheme_function ("add-quotable");
+ SCM adder = ly_lily_module_constant ("add-quotable");
scm_call_2 (adder, $2, $3->self_scm ());
scm_gc_unprotect_object ($3->self_scm ());
$$ = p;
}
| CLEF STRING {
- SCM proc = ly_scheme_function ("make-clef-set");
+ SCM proc = ly_lily_module_constant ("make-clef-set");
SCM result = scm_call_1 (proc, $2);
scm_gc_protect_object (result);
$$ = unsmob_music (result);
}
| TIME_T fraction {
- SCM proc = ly_scheme_function ("make-time-signature-set");
+ SCM proc = ly_lily_module_constant ("make-time-signature-set");
SCM result = scm_apply_2 (proc, scm_car ($2), scm_cdr ($2), SCM_EOL);
scm_gc_protect_object (result);
$$ = unsmob_music (result);
}
| MARK scalar {
- SCM proc = ly_scheme_function ("make-mark-set");
+ SCM proc = ly_lily_module_constant ("make-mark-set");
SCM result = scm_call_1 (proc, $2);
scm_gc_protect_object (result);
bass_number:
DIGIT {
$$ = scm_number_to_string (scm_int2num ($1), scm_int2num (10));
- $$ = scm_list_2 (ly_scheme_function ("number-markup"),
+ $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
$$);
}
| UNSIGNED {
$$ = scm_number_to_string (scm_int2num ($1), scm_int2num (10));
- $$ = scm_list_2 (ly_scheme_function ("number-markup"),
+ $$ = scm_list_2 (ly_lily_module_constant ("number-markup"),
$$);
}
| STRING { $$ = $1; }
| MULTI_MEASURE_REST optional_notemode_duration {
THIS->pop_spot ();
- SCM proc = ly_scheme_function ("make-multi-measure-rest");
+ SCM proc = ly_lily_module_constant ("make-multi-measure-rest");
SCM mus = scm_call_2 (proc, $2,
make_input (THIS->here_input ()));
scm_gc_protect_object (mus);
markup_top:
markup_list {
- $$ = scm_list_2 (ly_scheme_function ("line-markup"), $1);
+ $$ = scm_list_2 (ly_lily_module_constant ("line-markup"), $1);
}
| markup_head_1_list simple_markup {
- $$ = scm_car (scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, scm_list_1 ($2)));
+ $$ = scm_car (scm_call_2 (ly_lily_module_constant ("map-markup-command-list"), $1, scm_list_1 ($2)));
}
| simple_markup {
$$ = $1;
markup_composed_list:
markup_head_1_list markup_braced_list {
- $$ = scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, $2);
+ $$ = scm_call_2 (ly_lily_module_constant ("map-markup-command-list"), $1, $2);
}
;
THIS->lexer_->push_note_state (alist_to_hashq (nn));
} '{' score_body '}' {
Score * sc = $4;
- $$ = scm_list_2 (ly_scheme_function ("score-markup"), sc->self_scm ());
+ $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), sc->self_scm ());
scm_gc_unprotect_object (sc->self_scm ());
THIS->lexer_->pop_state ();
}
markup:
markup_head_1_list simple_markup {
- $$ = scm_car (scm_call_2 (ly_scheme_function ("map-markup-command-list"), $1, scm_list_1 ($2)));
+ $$ = scm_car (scm_call_2 (ly_lily_module_constant ("map-markup-command-list"), $1, scm_list_1 ($2)));
}
| simple_markup {
$$ = $1;
Score::set_music (SCM music, SCM parser)
{
/* URG? */
- SCM check_funcs = ly_scheme_function ("toplevel-music-functions");
+ SCM check_funcs = ly_lily_module_constant ("toplevel-music-functions");
for (; scm_is_pair (check_funcs); check_funcs = scm_cdr (check_funcs))
music = scm_call_2 (scm_car (check_funcs), music, parser);
void
Staff_performer::stop_translation_timestep ()
{
- SCM proc = ly_scheme_function ("percussion?");
+ SCM proc = ly_lily_module_constant ("percussion?");
SCM drums = scm_call_1 (proc, ly_symbol2scm (instrument_string_.to_str0 ()));
audio_staff_->channel_ = (drums == SCM_BOOL_T ? 9 : -1 );
{
Box b;
- SCM limit = ly_scheme_function ("TEX_STRING_HASHLIMIT");
+ SCM limit = ly_lily_module_constant ("TEX_STRING_HASHLIMIT");
String key_str = ly_scm2string (font->font_file_name());
int hash_code = scm_to_int (scm_hash (text, limit));
key_str = to_string (hash_code) + key_str;
if (scm_is_pair (val))
{
- b[X_AXIS][LEFT] = 0.0;
- b[X_AXIS][RIGHT] = scm_to_double (scm_car (val));
+ b[X_AXIS][LEFT] = 0.0 PT;
+ b[X_AXIS][RIGHT] = scm_to_double (scm_car (val)) PT;
val = scm_cdr (val);
- b[Y_AXIS][UP] = scm_to_double (scm_car (val));
+ b[Y_AXIS][UP] = scm_to_double (scm_car (val)) PT;
val = scm_cdr (val);
- b[Y_AXIS][DOWN] = scm_to_double (scm_car (val));
+ b[Y_AXIS][DOWN] = scm_to_double (scm_car (val)) PT;
}
return b;
tfm->char_metrics_ = reader.char_metrics_;
tfm->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_;
tfm->encoding_table_
- = scm_call_1 (ly_scheme_function ("get-coding-table"),
+ = scm_call_1 (ly_lily_module_constant ("get-coding-table"),
scm_makfrom0str (tfm->coding_scheme ().to_str0 ()));
return tfm->self_scm ();
--- /dev/null
+%
+% lilymetrics.tex
+%
+\catcode `\@=11\relax
+
+\newdimen\lily@globalscale
+\newdimen\lily@localscale
+\newbox\lily@metricsbox
+\newwrite\lily@metricsfile
+
+\def\lilyglobalscale#1{%
+ \lily@globalscale #1pt
+}
+
+\def\lilymetricsfile#1{%
+ \immediate\openout\lily@metricsfile #1\relax
+}
+
+\begingroup
+ \catcode `P=12
+ \catcode `T=12
+ \lowercase{%
+ \def\x{%
+ \def\lily@rempt##1.##2PT{%
+ ##1\ifnum ##2 > \z@ .##2\fi
+ }%
+ }%
+ }
+\expandafter\endgroup\x
+
+\def\lily@strippt{%
+ \expandafter\lily@rempt
+}
+
+\long\def\lilygetmetrics#1#2#3#4{%
+ \lily@localscale #3\lily@globalscale
+ % convert pt to 1000*sp (1000/65536)
+ \lily@localscale 0.015259\lily@localscale
+ \font\lily@font = #2 scaled \lily@localscale
+ \setbox\lily@metricsbox\hbox{%
+ \lily@font
+ #4%
+ }%
+ \edef\lily@wd{\the\wd\lily@metricsbox}%
+ \edef\lily@ht{\the\ht\lily@metricsbox}%
+ \edef\lily@dp{\the\dp\lily@metricsbox}%
+ \immediate\write\lily@metricsfile{%
+ ("#1" . (\lily@strippt\lily@wd
+ \space\lily@strippt\lily@ht
+ \space\lily@strippt\lily@dp))%
+ }%
+}
+
+\catcode `\@=13\relax
+
+\endinput