Пример #1
0
 def _get_lilypond_format_bundle(self, component=None):
     bundle = abjad.LilyPondFormatBundle()
     if self.tweaks:
         tweaks = self.tweaks._list_format_contributions()
         bundle.after.articulations.extend(tweaks)
     bundle.after.articulations.append(self._get_lilypond_format())
     return bundle
Пример #2
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     bundle.grob_overrides.append(
         '\\once \\override Accidental.stencil = ##f\n'
         '\\once \\override AccidentalCautionary.stencil = ##f\n'
         '\\once \\override Arpeggio.X-offset = #-2\n'
         '\\once \\override NoteHead.stencil = #ly:text-interface::print\n'
         '\\once \\override NoteHead.text = \markup {\n'
         "\t\\filled-box #'(-0.6 . 0.6) #'(-0.7 . 0.7) #0.25\n"
         '}')
     if not self.hide:
         if self.include_black_keys and self.include_white_keys:
             string = r'\center-align \concat { \natural \flat }'
         elif self.include_black_keys:
             string = r'\center-align \flat'
         else:
             string = r'\center-align \natural'
         markup = abjad.Markup(
             string,
             direction=self.markup_direction,
         )
         markup_format_pieces = markup._get_format_pieces()
         bundle.right.markup.extend(markup_format_pieces)
     return bundle
Пример #3
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     format_slot = bundle.get(self.format_slot)
     pieces = self._get_format_pieces()
     format_slot.commands.extend(pieces)
     return bundle
Пример #4
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     markup = self._get_markup()
     markup = abjad.new(markup, direction=abjad.Up)
     markup_format_pieces = markup._get_format_pieces()
     bundle.right.markup.extend(markup_format_pieces)
     return bundle
Пример #5
0
 def _get_lilypond_format_bundle(self, component=None):
     bundle = abjad.LilyPondFormatBundle()
     if self.hide:
         return bundle
     staff = abjad.get.parentage(component).get(abjad.Staff)
     strings = self._get_lilypond_format(context=staff)
     bundle.before.commands.extend(strings)
     return bundle
Пример #6
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     if not self.once:
         revert_format = '\n'.join(self.revert_format_pieces)
         bundle.grob_reverts.append(revert_format)
     if not self.is_revert:
         override_format = '\n'.join(self.override_format_pieces)
         bundle.grob_overrides.append(override_format)
     return bundle
Пример #7
0
 def _get_lilypond_format_bundle(self, leaf):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     if len(self) == 1 and self._left_broken:
         strings = [r'\stopTrillSpan']
         strings = self._tag_show(strings)
         bundle.right.spanner_stops.extend(strings)
         return bundle
     if leaf is self[0]:
         strings = abjad.override(self)._list_format_contributions(
             'override',
             once=False,
         )
         if self._left_broken:
             strings = self._tag_hide(strings)
         bundle.grob_overrides.extend(strings)
         if self.pitch is not None:
             pitch_string = str(self.pitch)
         elif self.interval is not None:
             pitch = leaf.written_pitch + self.interval
             pitch_string = str(pitch)
         else:
             pitch_string = None
         string = r'\startTrillSpan'
         if pitch_string:
             string += ' ' + pitch_string
         strings = [string]
         if self._left_broken:
             strings = self._tag_hide(strings)
         # important: pitch trill must start AFTER markup
         bundle.after.spanner_starts.extend(strings)
         if self.pitch is not None or self.interval is not None:
             strings = [r'\pitchedTrill']
             if self._left_broken:
                 strings = self._tag_hide(strings)
             bundle.opening.spanners.extend(strings)
             if self.is_harmonic:
                 string = '(lambda (grob) (grob-interpret-markup grob'
                 string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))'
                 scheme = abjad.Scheme(string, verbatim=True)
                 # TODO: use strings instead of override interface:
                 abjad.override(leaf).trill_pitch_head.stencil = scheme
     if leaf is self[-1]:
         manager = abjad.override(self)
         strings = manager._list_format_contributions('revert')
         if self._right_broken:
             strings = self._tag_hide(strings)
         bundle.grob_reverts.extend(strings)
         if 1 < len(self):
             strings = [r'\stopTrillSpan']
             if self._right_broken:
                 strings = self._tag_hide(strings)
             bundle.right.spanner_stops.extend(strings)
     return bundle
Пример #8
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     bundle.right.articulations.append(r'\arpeggio')
     if self.direction in (abjad.Up, abjad.Down):
         if self.direction == abjad.Up:
             command = r'\arpeggioArrowUp'
         else:
             command = r'\arpeggioArrowDown'
         bundle.before.commands.append(command)
     return bundle
Пример #9
0
 def _get_lilypond_format_bundle(self, component=None):
     bundle = abjad.LilyPondFormatBundle()
     if not self.hide:
         if self.tweaks:
             tweaks = self.tweaks._list_format_contributions()
             bundle.after.markup.extend(tweaks)
         markup = self._get_markup()
         markup = abjad.new(markup, direction=abjad.Up)
         markup_format_pieces = markup._get_format_pieces()
         bundle.after.markup.extend(markup_format_pieces)
     return bundle
Пример #10
0
 def _get_lilypond_format_bundle(self) -> abjad.LilyPondFormatBundle:
     bundle = abjad.LilyPondFormatBundle()
     n = self.n or 0
     string = rf'\ottava {n}'
     if n != 0:
         ottavation_number = abs(n) * 7 + 1
         string += rf' \set Staff.ottavation = "{ottavation_number}"'
     if self.format_slot in ('before', None):
         bundle.before.commands.append(string)
     else:
         assert self.format_slot == 'after'
         bundle.after.commands.append(string)
     return bundle
Пример #11
0
 def _get_lilypond_format_bundle(self, component=None):
     bundle = abjad.LilyPondFormatBundle()
     if self.hide:
         return bundle
     bar_extent = self._get_bar_extent(component)
     if bar_extent is None:
         return bundle
     bottom, top = bar_extent
     string = r"\override Staff.BarLine.bar-extent = "
     string += f"#'({bottom} . {top})"
     previous = abjad.get.effective(component, BarExtent, n=-1)
     if previous is None or previous.line_count <= self.line_count:
         bundle.before.commands.append(string)
     else:
         bundle.after.commands.append(string)
     return bundle
Пример #12
0
    def bundle_format_contributions(component):
        r'''Gets all format contributions for `component`.

        Returns LilyPond format bundle.
        '''
        import abjad
        manager = LilyPondFormatManager
        bundle = abjad.LilyPondFormatBundle()
        manager._populate_indicator_format_contributions(component, bundle)
        manager._populate_spanner_format_contributions(component, bundle)
        manager._populate_context_setting_format_contributions(
            component, bundle)
        manager._populate_grob_override_format_contributions(component, bundle)
        manager._populate_grob_revert_format_contributions(component, bundle)
        bundle.make_immutable()
        return bundle
Пример #13
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     if not self.hide:
         bundle.opening.commands.append(self._get_lilypond_format())
     return bundle
Пример #14
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     bundle.before.commands.append(self._get_lilypond_format())
     return bundle
Пример #15
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     string = '\n'.join(self.format_pieces)
     bundle.context_settings.append(string)
     return bundle
Пример #16
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     bundle.right.articulations.append(self._get_lilypond_format())
     return bundle
Пример #17
0
 def _get_lilypond_format_bundle(self, leaf=None):
     bundle = abjad.LilyPondFormatBundle()
     numerator, denominator = self.duration.pair
     string = rf"\baca-new-spacing-section #{numerator} #{denominator}"
     bundle.before.commands.append(string)
     return bundle
Пример #18
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     format_slot = bundle.get(self.format_slot)
     format_slot.commands.append(self._get_lilypond_format())
     return bundle
Пример #19
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     bundle.right.stem_tremolos.append(self._get_lilypond_format())
     return bundle