+*/
+SCM
+Score::book_rendering (String outname,
+ Output_def *layoutbook,
+ Output_def *default_def)
+{
+ if (error_found_)
+ return SCM_EOL;
+
+ SCM scaled_bookdef = SCM_EOL;
+ Real scale = 1.0;
+
+ if (layoutbook && layoutbook->c_variable ("is-paper") == SCM_BOOL_T)
+ scale = scm_to_double (layoutbook->c_variable ("outputscale"));
+
+ SCM out = scm_makfrom0str (outname.to_str0 ());
+ SCM systems = SCM_EOL;
+ int outdef_count = defs_.size ();
+ for (int i = 0; !i || i < outdef_count; i++)
+ {
+ Output_def *def = outdef_count ? defs_[i] : default_def;
+ SCM scaled = SCM_EOL;
+ if (def->c_variable ("is-layout") == SCM_BOOL_T)
+ {
+ def = scale_output_def (def, scale);
+ def->parent_ = layoutbook;
+ scaled = def->self_scm ();
+ scm_gc_unprotect_object (scaled);
+ }
+
+ /* TODO: fix or junk --no-layout. */
+ SCM context = ly_run_translator (music_, def->self_scm ());
+ if (dynamic_cast<Global_context*> (unsmob_context (context)))
+ {
+ SCM s = ly_format_output (context, out);
+ if (s != SCM_UNDEFINED)
+ systems = s;
+ }
+
+ scm_remember_upto_here_1 (scaled);
+ }
+
+ scm_remember_upto_here_1 (scaled_bookdef);
+ return systems;
+}
+
+
+
+
+LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
+ 2, 0, 0, (SCM score, SCM layout),
+ "Run @var{score} through @var{layout}, an output definition, "
+ "scaled to correct outputscale already, "
+ "return a list of layout-lines.")