Beispiel #1
0
 def _make_bow_contact_point_overrides(
     self,
     bow_contact_point=None,
     lilypond_format_bundle=None,
 ):
     if bow_contact_point is None:
         return
     override_ = LilyPondGrobOverride(
         grob_name='NoteHead',
         once=True,
         property_path='stencil',
         value=Scheme('ly:text-interface::print'),
     )
     string = override_.override_string
     lilypond_format_bundle.grob_overrides.append(string)
     override_ = LilyPondGrobOverride(
         grob_name='NoteHead',
         once=True,
         property_path='text',
         value=bow_contact_point.markup,
     )
     string = override_.override_string
     lilypond_format_bundle.grob_overrides.append(string)
     y_offset = float((4 * bow_contact_point.contact_point) - 2)
     override_ = LilyPondGrobOverride(
         grob_name='NoteHead',
         once=True,
         property_path='Y-offset',
         value=y_offset,
     )
     string = override_.override_string
     lilypond_format_bundle.grob_overrides.append(string)
Beispiel #2
0
 def _get_right_padding_tweak(self):
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "right", "padding"),
         value=self.right_padding,
     )
     string = override.tweak_string()
     return string
Beispiel #3
0
 def _get_left_broken_text_tweak(self):
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "left-broken", "text"),
         value=self.left_broken_text,
     )
     string = override.tweak_string(self)
     return string
Beispiel #4
0
 def _get_left_broken_text_tweak(self):
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "left-broken", "text"),
         value=self.left_broken_text,
     )
     string = override.tweak_string(self)
     return string
Beispiel #5
0
 def _get_right_padding_tweak(self):
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "right", "padding"),
         value=self.right_padding,
     )
     string = override.tweak_string()
     return string
Beispiel #6
0
 def _get_right_padding_tweak(self):
     override = LilyPondGrobOverride(
         grob_name='TextSpanner',
         property_path=(
             'bound-details',
             'right',
             'padding',
         ),
         value=self.right_padding,
     )
     string = override.tweak_string()
     return string
Beispiel #7
0
 def _get_left_broken_text_tweak(self):
     override = LilyPondGrobOverride(
         grob_name='TextSpanner',
         property_path=(
             'bound-details',
             'left-broken',
             'text',
         ),
         value=self.left_broken_text,
     )
     string = override.tweak_string(self)
     return string
Beispiel #8
0
 def _get_left_text_directive(self):
     if isinstance(self.left_text, str):
         return self.left_text
     concat_hspace_left_markup = markups.Markup.hspace(self.concat_hspace_left)
     markup_list = [self.left_text, concat_hspace_left_markup]
     markup = markups.Markup.concat(markup_list)
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "left", "text"),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #9
0
 def _get_left_text_directive(self):
     if isinstance(self.left_text, str):
         return self.left_text
     concat_hspace_left_markup = markups.Markup.hspace(
         self.concat_hspace_left
     )
     markup_list = [self.left_text, concat_hspace_left_markup]
     markup = markups.Markup.concat(markup_list)
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "left", "text"),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #10
0
 def _circled_tip():
     return LilyPondGrobOverride(
         grob_name="Hairpin",
         once=True,
         property_path="circled-tip",
         value=True,
     )
Beispiel #11
0
 def _flared_hairpin():
     return LilyPondGrobOverride(
         grob_name='Hairpin',
         once=True,
         property_path='stencil',
         value='#abjad-flared-hairpin',
     )
Beispiel #12
0
 def _circled_tip():
     return LilyPondGrobOverride(
         grob_name='Hairpin',
         once=True,
         property_path='circled-tip',
         value=True,
     )
Beispiel #13
0
 def _constante_hairpin():
     return LilyPondGrobOverride(
         grob_name='Hairpin',
         once=True,
         property_path='stencil',
         value='#constante-hairpin',
     )
Beispiel #14
0
 def _flared_hairpin():
     return LilyPondGrobOverride(
         grob_name="Hairpin",
         once=True,
         property_path="stencil",
         value="#abjad-flared-hairpin",
     )
Beispiel #15
0
 def _constante_hairpin():
     return LilyPondGrobOverride(
         grob_name="Hairpin",
         once=True,
         property_path="stencil",
         value="#constante-hairpin",
     )
Beispiel #16
0
 def _get_right_text_tweak(self):
     if isinstance(self.right_text, str):
         return self.right_text
     if self.concat_hspace_right is not None:
         number = self.concat_hspace_right
         concat_hspace_right_markup = markups.Markup.hspace(number)
         markup_list = [concat_hspace_right_markup, self.right_text]
         markup = markups.Markup.concat(markup_list)
     else:
         markup = self.right_text
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "right", "text"),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #17
0
 def _get_right_text_tweak(self):
     if isinstance(self.right_text, str):
         return self.right_text
     if self.concat_hspace_right is not None:
         number = self.concat_hspace_right
         concat_hspace_right_markup = markups.Markup.hspace(number)
         markup_list = [concat_hspace_right_markup, self.right_text]
         markup = markups.Markup.concat(markup_list)
     else:
         markup = self.right_text
     override = LilyPondGrobOverride(
         grob_name="TextSpanner",
         property_path=("bound-details", "right", "text"),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #18
0
 def _get_right_text_tweak(self):
     if self.concat_hspace_right is not None:
         number = self.concat_hspace_right
         concat_hspace_right_markup = markups.Markup.hspace(number)
         markup_list = [concat_hspace_right_markup, self.right_text]
         markup = markups.Markup.concat(markup_list)
     else:
         markup = self.right_text
     override = LilyPondGrobOverride(
         grob_name='TextSpanner',
         property_path=(
             'bound-details',
             'right',
             'text',
         ),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #19
0
 def _get_left_text_tweak(self):
     import abjad
     if isinstance(self.left_text, LilyPondLiteral):
         markup = self.left_text
     else:
         concat_hspace_left_markup = markups.Markup.hspace(
             self.concat_hspace_left)
         markup_list = [self.left_text, concat_hspace_left_markup]
         markup = markups.Markup.concat(markup_list)
     override = LilyPondGrobOverride(
         grob_name='TextSpanner',
         property_path=(
             'bound-details',
             'left',
             'text',
         ),
         value=markup,
     )
     string = override.tweak_string()
     return string
Beispiel #20
0
 def _make_pizzicato_overrides(
     self,
     lilypond_format_bundle=None,
 ):
     style = SchemeSymbol('cross')
     override_ = LilyPondGrobOverride(
         grob_name='NoteHead',
         once=True,
         property_path='style',
         value=style,
     )
     string = override_.override_string
     lilypond_format_bundle.grob_overrides.append(string)
Beispiel #21
0
 def _make_glissando_overrides(
     self,
     bow_motion_technique=None,
     lilypond_format_bundle=None,
 ):
     if bow_motion_technique is not None:
         style = SchemeSymbol(bow_motion_technique.glissando_style)
         override_ = LilyPondGrobOverride(
             grob_name='Glissando',
             once=True,
             property_path='style',
             value=style,
         )
         string = override_.override_string
         lilypond_format_bundle.grob_overrides.append(string)
Beispiel #22
0
 def _get_lilypond_format_bundle(self, leaf):
     bundle = LilyPondFormatBundle()
     if len(self) == 1 and self._left_broken:
         strings = [self._stop_command_string()]
         strings = self._tag_show(strings)
         bundle.after.spanner_stops.extend(strings)
         return bundle
     # important: pitch trill must start AFTER markup
     if leaf is self[0]:
         if self.pitch is not None or self.interval is not None:
             if self.is_harmonic:
                 string = '(lambda (grob) (grob-interpret-markup grob'
                 string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))'
                 scheme = Scheme(string, verbatim=True)
                 override = LilyPondGrobOverride(
                     grob_name='TrillPitchHead',
                     property_path=('stencil', ),
                     value=scheme,
                 )
                 string = override.tweak_string(grob=True)
                 bundle.after.trill_spanner_starts.append(string)
             strings = [r'\pitchedTrill']
             if self._left_broken:
                 strings = self._tag_hide(strings)
             bundle.opening.spanners.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
         strings = self._tweaked_start_command_strings()
         if pitch_string:
             strings[-1] += ' ' + pitch_string
         if self._left_broken:
             strings = self._tag_hide(strings)
         bundle.after.trill_spanner_starts.extend(strings)
     if leaf is self[-1]:
         if 1 < len(self):
             strings = [self._stop_command_string()]
             if self._right_broken:
                 strings = self._tag_hide(strings)
             bundle.after.spanner_stops.extend(strings)
     return bundle
Beispiel #23
0
 def _get_lilypond_format_bundle(self, leaf):
     bundle = self._get_basic_lilypond_format_bundle(leaf)
     prototype = (Chord, Note)
     should_attach_glissando = False
     if leaf is not self[0]:
         if self.parenthesize_repeats:
             if not self._previous_leaf_changes_current_pitch(leaf):
                 self._parenthesize_leaf(leaf)
     tag = False
     if inspect(leaf).has_indicator(BendAfter):
         pass
     elif leaf is self[-1]:
         if self._right_broken:
             should_attach_glissando = True
             tag = True
     elif not isinstance(leaf, prototype):
         pass
     elif self.allow_repeats and self.allow_ties:
         should_attach_glissando = True
     elif self.allow_repeats and not self.allow_ties:
         should_attach_glissando = self._is_last_in_tie_chain(leaf)
     elif not self.allow_repeats and self.allow_ties:
         if self._next_leaf_changes_current_pitch(leaf):
             should_attach_glissando = True
     elif (not self.allow_repeats and not self.allow_ties):
         if self._next_leaf_changes_current_pitch(leaf):
             if self._is_last_in_tie_chain(leaf):
                 should_attach_glissando = True
     if self.stems:
         if leaf is self[1]:
             strings = [
                 r'\override Accidental.stencil = ##f',
                 r'\override NoteColumn.glissando-skip = ##t',
                 r'\hide NoteHead',
                 r'\override NoteHead.no-ledgers = ##t',
             ]
             bundle.grob_overrides.extend(strings)
         if leaf is self[-1]:
             strings = [
                 r'\revert Accidental.stencil',
                 r'\revert NoteColumn.glissando-skip',
                 r'\undo \hide NoteHead',
                 r'\revert NoteHead.no-ledgers',
             ]
             if self._right_broken:
                 strings_ = self._tag_hide(strings)
                 bundle.grob_reverts.extend(strings_)
                 strings_ = self._tag_show(strings)
                 bundle.after.commands.extend(strings_)
             else:
                 bundle.grob_reverts.extend(strings)
     if self.style:
         if leaf is self[0]:
             override = LilyPondGrobOverride(
                 grob_name='Glissando',
                 property_path='style',
                 value=SchemeSymbol(self.style),
             )
             string = override.tweak_string()
             bundle.after.spanner_starts.append(string)
     if should_attach_glissando:
         strings = self._tweaked_start_command_strings()
         if tag:
             strings = self._tag_show(strings)
         bundle.after.spanner_starts.extend(strings)
     return bundle