- stencils = scm_cons (me->smobbed_copy (), stencils);
-
- /* Output stencils in three layers: 0, 1, 2. Default layer: 1.
-
- Start with layer 3, since scm_cons prepends to list. */
- SCM all = get_property ("all-elements");
-
- Real penalty = 0;
- for (int i = LAYER_COUNT; i--;)
- for (SCM s = all; ly_c_pair_p (s); s = ly_cdr (s))
- {
- Grob *g = unsmob_grob (ly_car (s));
- Stencil *stil = g->get_stencil ();
-
- /* Skip empty stencils and grobs that are not in this layer. */
- if (!stil
- || robust_scm2int (g->get_property ("layer"), 1) != i)
- continue;
-
- Offset o (g->relative_coordinate (this, X_AXIS),
- g->relative_coordinate (this, Y_AXIS));
-
- Offset extra = robust_scm2offset (g->get_property ("extra-offset"),
- Offset (0, 0))
- * Staff_symbol_referencer::staff_space (g);
-
- /* Must copy the stencil, for we cannot change the stencil
- cached in G. */
- SCM my_stencil = stil->smobbed_copy ();
- unsmob_stencil (my_stencil)->translate (o + extra);
- stencils = scm_cons (my_stencil, stencils);
-
- if (g->original_)
- {
- if (Item *it = dynamic_cast <Item*> (g))
- {
- Grob *col = it->get_column ();
- SCM s = col->get_property ("page-penalty");
- // FIXME; page breaking is not discrete at +-10000
- if (ly_c_number_p (s)) // && fabs (ly_scm2double (s)) < 10000)
- penalty += ly_scm2double (s);
- }
- }
- }