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