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
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
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
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
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
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
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
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
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
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