]> git.donarmstrong.com Git - lilypond.git/blob - lily/vaticana-ligature-engraver.cc
Issue 4884: Remove DECLARE_* translator callback macros
[lilypond.git] / lily / vaticana-ligature-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2003--2015 Juergen Reuter <reuter@ipd.uka.de>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "gregorian-ligature-engraver.hh"
21
22 #include "font-interface.hh"
23 #include "gregorian-ligature.hh"
24 #include "international.hh"
25 #include "output-def.hh"
26 #include "paper-column.hh"
27 #include "separation-item.hh"
28 #include "spanner.hh"
29 #include "staff-symbol-referencer.hh"
30 #include "stream-event.hh"
31 #include "vaticana-ligature.hh"
32 #include "warn.hh"
33 #include "dot-column.hh"
34 #include "rhythmic-head.hh"
35 #include "pitch.hh"
36 #include "translator.icc"
37
38 /*
39  * This class implements the notation specific aspects of Vaticana
40  * style ligatures for Gregorian chant notation.
41  */
42
43 /*
44  * TODO: Maybe move handling of dots/mora to
45  * Gregorian_ligature_engraver?  It's probably common for all types of
46  * Gregorian chant notation that have dotted notes.
47  *
48  * FIXME: The horizontal alignment of the mora column is bad (too far
49  * to the left), if the last dotted note is not the last primitive in
50  * the ligature.  Fortunately, in practice this bug should have no
51  * negative impact, since dotted notes appear within a ligature
52  * usually always at the end of the ligature, such that the bug never
53  * should apply for valid ligatures.
54  *
55  * TODO: Graduale Triplex, tempus per annum, hebdomada septima,
56  * alleluia (page 280) shows a counter-example for collecting dots
57  * always in a single column behind the ligature.  Maybe only the last
58  * two dots in a ligature should be collected and all other dots put
59  * behind or on top of the head?
60  */
61 class Vaticana_ligature_engraver : public Gregorian_ligature_engraver
62 {
63
64 private:
65   static bool
66   need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
67                                int context_info, int delta_pitch);
68   bool is_stacked_head (int prefix_set,
69                         int context_info);
70   Real align_heads (vector<Grob_info> const &primitives,
71                     Real flexa_width,
72                     Real thickness);
73   void check_for_prefix_loss (Item *primitive);
74   void check_for_ambiguous_dot_pitch (Grob_info primitive);
75   void add_mora_column (Paper_column *column);
76   vector<Grob_info> augmented_primitives_;
77
78 public:
79   TRANSLATOR_DECLARATIONS (Vaticana_ligature_engraver);
80   TRANSLATOR_INHERIT (Gregorian_ligature_engraver)
81 protected:
82   virtual Spanner *create_ligature_spanner ();
83   virtual void transform_heads (Spanner *ligature,
84                                 vector<Grob_info> const &primitives);
85   void listen_pes_or_flexa (Stream_event *);
86   void listen_ligature (Stream_event *);
87 };
88
89 void
90 Vaticana_ligature_engraver::listen_pes_or_flexa (Stream_event *ev)
91 {
92   Gregorian_ligature_engraver::listen_pes_or_flexa (ev);
93 }
94
95 void
96 Vaticana_ligature_engraver::listen_ligature (Stream_event *ev)
97 {
98   Ligature_engraver::listen_ligature (ev);
99 }
100
101 Vaticana_ligature_engraver::Vaticana_ligature_engraver ()
102 {
103   brew_ligature_primitive_proc
104     = Vaticana_ligature::brew_ligature_primitive_proc;
105   augmented_primitives_.clear ();
106 }
107
108 Spanner *
109 Vaticana_ligature_engraver::create_ligature_spanner ()
110 {
111   return make_spanner ("VaticanaLigature", SCM_EOL);
112 }
113
114 bool
115 Vaticana_ligature_engraver::is_stacked_head (int prefix_set,
116                                              int context_info)
117 {
118   bool is_stacked;
119
120   // upper head of pes is stacked upon lower head of pes ...
121   is_stacked = context_info & PES_UPPER;
122
123   // ... unless this note starts a flexa
124   if (context_info & FLEXA_LEFT)
125     is_stacked = false;
126
127   // ... or another pes
128   if (context_info & PES_LOWER)
129     is_stacked = false;
130
131   // ... or the previous note is a semivocalis or inclinatum
132   if (context_info & AFTER_DEMINUTUM)
133     is_stacked = false;
134
135   // auctum head is never stacked upon preceding note
136   if (prefix_set & AUCTUM)
137     is_stacked = false;
138
139   // virga is never stacked upon preceding note
140   if (prefix_set & VIRGA)
141     is_stacked = false;
142
143   // oriscus is never stacked upon preceding note
144   if (prefix_set & ORISCUS)
145     is_stacked = false;
146
147   if ((prefix_set & DEMINUTUM)
148       && ! (prefix_set & INCLINATUM)
149       && (context_info & FLEXA_RIGHT))
150     is_stacked = true; // semivocalis head of deminutus form
151
152   return is_stacked;
153 }
154
155 /*
156  * When aligning the heads, sometimes extra space is needed, e.g. to
157  * avoid clashing with the appendix of an adjacent notehead or with an
158  * adjacent notehead itself if it has the same pitch.  Extra space is
159  * added at most once between to heads.
160  */
161 bool
162 Vaticana_ligature_engraver::need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
163                                                          int context_info, int delta_pitch)
164 {
165   if (prev_prefix_set & VIRGA)
166     /*
167      * After a virga, make an additional small space such that the
168      * appendix on the right side of the head does not touch the
169      * following head.
170      */
171     return true;
172
173   if ((prefix_set & INCLINATUM)
174       && ! (prev_prefix_set & INCLINATUM))
175     /*
176      * Always start a series of inclinatum heads with an extra space.
177      */
178     return true;
179
180   if ((context_info & FLEXA_LEFT) && ! (context_info & PES_UPPER))
181     /*
182      * Before a flexa (but not within a torculus), make an
183      * additional small space such that the appendix on the left side
184      * of the flexa does not touch the this head.
185      */
186     return true;
187
188   if (delta_pitch == 0)
189     /*
190      * If there are two adjacent noteheads with the same pitch, add
191      * additional small space between them, such that they do not
192      * touch each other.
193      */
194     return true;
195
196   return false;
197 }
198
199 Real
200 Vaticana_ligature_engraver::align_heads (vector<Grob_info> const &primitives,
201                                          Real flexa_width,
202                                          Real thickness)
203 {
204   if (!primitives.size ())
205     {
206       programming_error ("Vaticana_ligature:"
207                          " empty ligature [ignored]");
208       return 0.0;
209     }
210
211   /*
212    * The paper column where we put the whole ligature into.
213    */
214   Paper_column *column
215     = dynamic_cast<Item *> (primitives[0].grob ())->get_column ();
216
217   Real join_thickness
218     = thickness * column->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
219
220   /*
221    * Amount of extra space two put between some particular
222    * configurations of adjacent heads.
223    *
224    * TODO: make this a property of primtive grobs.
225    */
226   Real extra_space = 4.0 * join_thickness;
227
228   /*
229    * Keep track of the total width of the ligature.
230    */
231   Real ligature_width = 0.0;
232
233   Item *prev_primitive = 0;
234   int prev_prefix_set = 0;
235   for (vsize i = 0; i < primitives.size (); i++)
236     {
237       Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
238       int prefix_set
239         = scm_to_int (primitive->get_property ("prefix-set"));
240       int context_info
241         = scm_to_int (primitive->get_property ("context-info"));
242
243       /*
244        * Get glyph_name, delta_pitch and context_info for this head.
245        */
246
247       SCM glyph_name_scm = primitive->get_property ("glyph-name");
248       if (scm_is_null (glyph_name_scm))
249         {
250           primitive->programming_error ("Vaticana_ligature:"
251                                         " undefined glyph-name ->"
252                                         " ignoring grob");
253           continue;
254         }
255       string glyph_name = ly_scm2string (glyph_name_scm);
256
257       int delta_pitch = 0;
258       if (prev_primitive) /* urgh, need prev_primitive only here */
259         {
260           SCM delta_pitch_scm = prev_primitive->get_property ("delta-position");
261           if (!scm_is_null (delta_pitch_scm))
262             delta_pitch = scm_to_int (delta_pitch_scm);
263           else
264             {
265               primitive->programming_error ("Vaticana_ligature:"
266                                             " delta-position undefined ->"
267                                             " ignoring grob");
268               continue;
269             }
270         }
271
272       /*
273        * Now determine width and x-offset of head.
274        */
275
276       Real head_width;
277       Real x_offset;
278
279       if (context_info & STACKED_HEAD)
280         {
281           /*
282            * This head is stacked upon the previous one; hence, it
283            * does not contribute to the total width of the ligature,
284            * and its width is assumed to be 0.0.  Moreover, it is
285            * shifted to the left by its width such that the right side
286            * of this and the other head are horizontally aligned.
287            */
288           head_width = 0.0;
289           x_offset = join_thickness
290                      - Font_interface::get_default_font (primitive)->
291                      find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
292         }
293       else if (glyph_name == "flexa" || glyph_name == "")
294         {
295           /*
296            * This head represents either half of a flexa shape.
297            * Hence, it is assigned half the width of this shape.
298            */
299           head_width = 0.5 * flexa_width;
300           x_offset = 0.0;
301         }
302       else
303         {
304           /*
305            * This is a regular head, placed right to the previous one.
306            * Retrieve its width from corresponding font.
307            */
308           head_width
309             = Font_interface::get_default_font (primitive)->
310               find_by_name ("noteheads.s" + glyph_name).extent (X_AXIS).length ();
311           x_offset = 0.0;
312         }
313
314       /*
315        * Save the head's final x-offset.
316        */
317       primitive->set_property ("x-offset",
318                                scm_from_double (x_offset));
319
320       /*
321        * If the head is the 2nd head of a pes or flexa (but not a
322        * flexa shape), mark this head to be joined with the left-side
323        * neighbour head (i.e. the previous head) by a vertical beam.
324        */
325       if ((context_info & PES_UPPER)
326           || ((context_info & FLEXA_RIGHT)
327               && ! (context_info & PES_LOWER)))
328         {
329           if (!prev_primitive)
330             {
331               primitive->programming_error ("Vaticana ligature: add-join:"
332                                             " missing previous primitive");
333             }
334           else
335             {
336               prev_primitive->set_property ("add-join",
337                                             ly_bool2scm (true));
338
339               /*
340                * Create a small overlap of adjacent heads so that the join
341                * can be drawn perfectly between them.
342                */
343               ligature_width -= join_thickness;
344             }
345         }
346       else if (glyph_name == "")
347         {
348           /*
349            * This is the 2nd (virtual) head of flexa shape.  Join it
350            * tightly with 1st head, i.e. do *not* add additional
351            * space, such that next head will not be off from the flexa
352            * shape.
353            */
354         }
355
356       if (need_extra_horizontal_space (prev_prefix_set, prefix_set,
357                                        context_info, delta_pitch))
358         ligature_width += extra_space;
359
360       /*
361        * Horizontally line-up this head to form a ligature.
362        */
363       move_related_items_to_column (primitive, column, ligature_width);
364       ligature_width += head_width;
365
366       prev_primitive = primitive;
367       prev_prefix_set = prefix_set;
368     }
369
370   /*
371    * Add extra horizontal padding space after ligature, such that
372    * neighbouring ligatures do not touch each other.
373    */
374   ligature_width += extra_space;
375
376   return ligature_width;
377 }
378
379 /*
380  * Depending on the typographical features of a particular ligature
381  * style, some prefixes may be ignored.  In particular, if a curved
382  * flexa shape is produced, any prefixes to either of the two
383  * contributing heads that would select a head other than punctum, is
384  * by definition ignored.
385  *
386  * This function prints a warning, if the given primitive is prefixed
387  * such that a head other than punctum would be chosen, if this
388  * primitive were engraved as a stand-alone head.
389  */
390 void
391 Vaticana_ligature_engraver::check_for_prefix_loss (Item *primitive)
392 {
393   int prefix_set
394     = scm_to_int (primitive->get_property ("prefix-set"));
395   if (prefix_set & ~PES_OR_FLEXA)
396     {
397       string prefs = Gregorian_ligature::prefixes_to_str (primitive);
398       primitive->warning (_f ("ignored prefix(es) `%s' of this head"
399                               " according to restrictions of the selected"
400                               " ligature style",
401                               prefs.c_str ()));
402     }
403 }
404
405 void
406 Vaticana_ligature_engraver::add_mora_column (Paper_column *column)
407 {
408   if (augmented_primitives_.size () == 0) // no dot for column
409     return;
410   if (!column) // empty ligature???
411     {
412       augmented_primitives_[0].grob ()->
413       programming_error ("no paper column to add dot");
414       return;
415     }
416   Item *dotcol = make_item ("DotColumn", SCM_EOL);
417   dotcol->set_parent (column, X_AXIS);
418   for (vsize i = 0; i < augmented_primitives_.size (); i++)
419     {
420       Item *primitive
421         = dynamic_cast<Item *> (augmented_primitives_[i].grob ());
422       Item *dot = make_item ("Dots", primitive->self_scm ());
423       dot->set_property ("dot-count", scm_from_int (1));
424       dot->set_parent (primitive, Y_AXIS);
425       primitive->set_object ("dot", dot->self_scm ());
426       Dot_column::add_head (dotcol, primitive);
427
428       // FIXME: why isn't the dot picked up by Paper_column_engraver?
429       Separation_item::add_item (column, dot);
430     }
431 }
432
433 /*
434  * This function prints a warning, if the given primitive has the same
435  * pitch as at least one of the primitives already stored in the
436  * augmented_primitives_ array.
437  *
438  * The rationale of this check is, that, if there are two dotted
439  * primitives with the same pitch, then collecting all dots in a dot
440  * column behind the ligature leads to a notational ambiguity of to
441  * which head the corresponding dot refers.
442  *
443  * Such a case should be treated as a badly specified ligature.  The
444  * user should split the ligature to make the notation of dots
445  * unambiguous.
446  */
447 void
448 Vaticana_ligature_engraver::check_for_ambiguous_dot_pitch (Grob_info primitive)
449 {
450   // TODO: Fix performance, which is currently O (n^2) (since this
451   // method is called O (n) times and takes O (n) steps in the for
452   // loop), but could be O (n) (by replacing the for loop by e.g. a
453   // bitmask based O (1) test); where n=<number of primitives in the
454   // ligature> (which is typically small (n<10), though).
455   Stream_event *new_cause = primitive.event_cause ();
456   int new_pitch = unsmob<Pitch> (new_cause->get_property ("pitch"))->steps ();
457   for (vsize i = 0; i < augmented_primitives_.size (); i++)
458     {
459       Stream_event *cause = augmented_primitives_[i].event_cause ();
460       int pitch = unsmob<Pitch> (cause->get_property ("pitch"))->steps ();
461       if (pitch == new_pitch)
462         {
463           primitive.grob ()->
464           warning (_ ("Ambiguous use of dots in ligature: there are"
465                       " multiple dotted notes with the same pitch."
466                       "  The ligature should be split."));
467           return; // supress multiple identical warnings
468         }
469     }
470 }
471
472 void
473 Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
474                                              vector<Grob_info> const &primitives)
475 {
476   Real flexa_width = robust_scm2double (ligature->get_property ("flexa-width"), 2);
477
478   Real thickness = robust_scm2double (ligature->get_property ("thickness"), 1);
479
480   Item *prev_primitive = 0;
481   int prev_prefix_set = 0;
482   int prev_context_info = 0;
483   int prev_delta_pitch = 0;
484   string prev_glyph_name = "";
485   augmented_primitives_.clear ();
486   for (vsize i = 0; i < primitives.size (); i++)
487     {
488       Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
489
490       int delta_pitch;
491       SCM delta_pitch_scm = primitive->get_property ("delta-position");
492       if (!scm_is_null (delta_pitch_scm))
493         delta_pitch = scm_to_int (delta_pitch_scm);
494       else
495         {
496           primitive->programming_error ("Vaticana_ligature:"
497                                         " delta-position undefined ->"
498                                         " ignoring grob");
499           continue;
500         }
501
502       /* retrieve & complete prefix_set and context_info */
503       int prefix_set
504         = scm_to_int (primitive->get_property ("prefix-set"));
505       int context_info
506         = scm_to_int (primitive->get_property ("context-info"));
507
508       if (Rhythmic_head::dot_count (primitive) > 0)
509         // remove dots from primitive and add remember primitive for
510         // creating a dot column
511         {
512           Rhythmic_head::get_dots (primitive)->set_property ("dot-count",
513                                                              scm_from_int (0));
514           // TODO: Maybe completely remove grob "Dots" (dots->suicide
515           // () ?) rather than setting property "dot-count" to 0.
516
517           check_for_ambiguous_dot_pitch (primitives[i]);
518           augmented_primitives_.push_back (primitives[i]);
519         }
520       else if (augmented_primitives_.size () > 0)
521         {
522           primitive->warning (_ ("This ligature has a dotted head followed by"
523                                  " a non-dotted head.  The ligature should be"
524                                  " split after the last dotted head before"
525                                  " this head."));
526         }
527
528       if (is_stacked_head (prefix_set, context_info))
529         {
530           context_info |= STACKED_HEAD;
531           primitive->set_property ("context-info",
532                                    scm_from_int (context_info));
533         }
534
535       /*
536        * Now determine which head to typeset (this is context sensitive
537        * information, since it depends on neighbouring heads; therefore,
538        * this decision must be made here in the engraver rather than in
539        * the backend).
540        */
541       string glyph_name;
542       if (prefix_set & VIRGA)
543         {
544           glyph_name = "vaticana.punctum";
545           primitive->set_property ("add-stem", ly_bool2scm (true));
546         }
547       else if (prefix_set & QUILISMA)
548         glyph_name = "vaticana.quilisma";
549       else if (prefix_set & ORISCUS)
550         glyph_name = "solesmes.oriscus";
551       else if (prefix_set & STROPHA)
552         if (prefix_set & AUCTUM)
553           glyph_name = "solesmes.stropha.aucta";
554         else glyph_name = "solesmes.stropha";
555       else if (prefix_set & INCLINATUM)
556         if (prefix_set & AUCTUM)
557           glyph_name = "solesmes.incl.auctum";
558         else if (prefix_set & DEMINUTUM)
559           glyph_name = "solesmes.incl.parvum";
560         else
561           glyph_name = "vaticana.inclinatum";
562       else if (prefix_set & DEMINUTUM)
563         {
564           if (i == 0)
565             {
566               // initio debilis
567               glyph_name = "vaticana.reverse.plica";
568             }
569           else if (prev_delta_pitch > 0)
570             {
571               // epiphonus
572               if (! (prev_context_info & FLEXA_RIGHT))
573                 {
574                   /* correct head of previous primitive */
575                   if (prev_delta_pitch > 1)
576                     prev_glyph_name = "vaticana.epiphonus";
577                   else
578                     prev_glyph_name = "vaticana.vepiphonus";
579                 }
580               if (prev_delta_pitch > 1)
581                 glyph_name = "vaticana.plica";
582               else
583                 glyph_name = "vaticana.vplica";
584             }
585           else if (prev_delta_pitch < 0)
586             {
587               // cephalicus
588               if (! (prev_context_info & FLEXA_RIGHT))
589                 /* correct head of previous primitive */
590                 {
591                   if (i > 1)
592                     {
593                       /* cephalicus head with fixed size cauda */
594                       prev_glyph_name = "vaticana.inner.cephalicus";
595                     }
596                   else
597                     {
598                       /* cephalicus head without cauda */
599                       prev_glyph_name = "vaticana.cephalicus";
600                     }
601
602                   /*
603                    * Flexa has no variable size cauda if its left head is
604                    * stacked on the right head.  This is true for
605                    * cephalicus.  Hence, remove the cauda.
606                    *
607                    * Urgh: for the current implementation, this rule only
608                    * applies for cephalicus; but it is a fundamental rule.
609                    * Therefore, the following line of code should be
610                    * placed somewhere else.
611                    */
612                   prev_primitive->set_property ("add-cauda",
613                                                 ly_bool2scm (false));
614                 }
615               if (prev_delta_pitch < - 1)
616                 glyph_name = "vaticana.reverse.plica";
617               else
618                 glyph_name = "vaticana.reverse.vplica";
619             }
620           else // (prev_delta_pitch == 0)
621             {
622               primitive->programming_error ("Vaticana_ligature:"
623                                             " deminutum head must have different"
624                                             " pitch -> ignoring grob");
625             }
626         }
627       else if (prefix_set & (CAVUM | LINEA))
628         if ((prefix_set & CAVUM) && (prefix_set & LINEA))
629           glyph_name = "vaticana.linea.punctum.cavum";
630         else if (prefix_set & CAVUM)
631           glyph_name = "vaticana.punctum.cavum";
632         else
633           glyph_name = "vaticana.linea.punctum";
634       else if (prefix_set & AUCTUM)
635         if (prefix_set & ASCENDENS)
636           glyph_name = "solesmes.auct.asc";
637         else
638           glyph_name = "solesmes.auct.desc";
639       else if ((context_info & STACKED_HEAD)
640                && (context_info & PES_UPPER))
641         if (prev_delta_pitch > 1)
642           glyph_name = "vaticana.upes";
643         else
644           glyph_name = "vaticana.vupes";
645       else
646         glyph_name = "vaticana.punctum";
647
648       /*
649        * This head needs a cauda, if it starts a flexa, is not the upper
650        * head of a pes, and if it is a punctum.
651        */
652       if ((context_info & FLEXA_LEFT) && ! (context_info & PES_UPPER))
653         if (glyph_name == "vaticana.punctum")
654           primitive->set_property ("add-cauda", ly_bool2scm (true));
655
656       /*
657        * Execptional rule for porrectus:
658        *
659        * If the current head is preceded by a \flexa and succeded by a
660        * \pes (e.g. "a \flexa g \pes a"), then join the current head and
661        * the previous head into a single curved flexa shape.
662        */
663       if ((context_info & FLEXA_RIGHT) && (context_info & PES_LOWER))
664         {
665           check_for_prefix_loss (prev_primitive);
666           prev_glyph_name = "flexa";
667           prev_primitive->set_property ("flexa-height",
668                                         scm_from_int (prev_delta_pitch));
669           prev_primitive->set_property ("flexa-width",
670                                         scm_from_double (flexa_width));
671           bool add_cauda = !(prev_prefix_set && PES_OR_FLEXA);
672           prev_primitive->set_property ("add-cauda",
673                                         ly_bool2scm (add_cauda));
674           check_for_prefix_loss (primitive);
675           glyph_name = "";
676           primitive->set_property ("flexa-width",
677                                    scm_from_double (flexa_width));
678         }
679
680       /*
681        * Exceptional rule for pes:
682        *
683        * If this head is stacked on the previous one due to a \pes, then
684        * set the glyph of the previous head to that for this special
685        * case, thereby avoiding potential vertical collision with the
686        * current head.
687        */
688       if (prefix_set & PES_OR_FLEXA)
689         {
690           if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
691             {
692               if (prev_glyph_name == "vaticana.punctum")
693                 {
694                   if (prev_delta_pitch > 1)
695                     prev_glyph_name = "vaticana.lpes";
696                   else
697                     prev_glyph_name = "vaticana.vlpes";
698                 }
699             }
700         }
701
702       if (prev_primitive)
703         prev_primitive->set_property ("glyph-name",
704                                       ly_string2scm (prev_glyph_name));
705
706       /*
707        * In the backend, flexa shapes and joins need to know about line
708        * thickness.  Hence, for simplicity, let's distribute the
709        * ligature grob's value for thickness to each ligature head (even
710        * if not all of them need to know).
711        */
712       primitive->set_property ("thickness", scm_from_double (thickness));
713
714       prev_primitive = primitive;
715       prev_prefix_set = prefix_set;
716       prev_context_info = context_info;
717       prev_delta_pitch = delta_pitch;
718       prev_glyph_name = glyph_name;
719     }
720
721   prev_primitive->set_property ("glyph-name",
722                                 ly_string2scm (prev_glyph_name));
723
724   align_heads (primitives, flexa_width, thickness);
725
726   // append all dots to paper column of ligature's last head
727   add_mora_column (prev_primitive->get_column ());
728
729 #if 0 // experimental code to collapse spacing after ligature
730   /* TODO: set to max (old/new spacing-increment), since other
731      voices/staves also may want to set this property. */
732   Item *first_primitive = dynamic_cast<Item *> (primitives[0].grob ());
733   Paper_column *paper_column = first_primitive->get_column ();
734   paper_column->warning (_f ("Vaticana_ligature_engraver:"
735                              " setting `spacing-increment = %f': ptr =%ul",
736                              ligature_width, paper_column));
737   paper_column->
738   set_property ("forced-spacing", scm_from_double (ligature_width));
739 #endif
740 }
741
742 void
743 Vaticana_ligature_engraver::boot ()
744 {
745   ADD_LISTENER (Vaticana_ligature_engraver, pes_or_flexa);
746   ADD_LISTENER (Vaticana_ligature_engraver, ligature);
747   ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, rest);
748   ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, ligature_head);
749 }
750
751 ADD_TRANSLATOR (Vaticana_ligature_engraver,
752                 /* doc */
753                 "Handle ligatures by glueing special ligature heads"
754                 " together.",
755
756                 /* create */
757                 "VaticanaLigature "
758                 "DotColumn ",
759
760                 /* read */
761                 "",
762
763                 /* write */
764                 ""
765                );