From 9a44242e970ad466f91c87c4bd9f812796e8517f Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Mon, 24 Mar 2008 20:16:02 +0100 Subject: [PATCH] MusicXML: Convert brackets as ligature brackets --- python/musicexp.py | 12 ++++++++++-- scripts/musicxml2ly.py | 7 +------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/python/musicexp.py b/python/musicexp.py index 862b5d8c4f..2ae8a6784f 100644 --- a/python/musicexp.py +++ b/python/musicexp.py @@ -859,9 +859,17 @@ class TextSpannerEvent (SpanEvent): 1:'\\stopTextSpan'}.get (self.span_direction, '') class BracketSpannerEvent (SpanEvent): + # Ligature brackets use prefix-notation!!! + def print_before_note (self, printer): + if self.span_direction == -1: + printer.dump ('\[') + # the the bracket after the last note + def print_after_note (self, printer): + if self.span_direction == 1: + printer.dump ('\]') + # we're printing everything in print_(before|after)_note... def ly_expression (self): - return {-1: '\\startGroup', - 1:'\\stopGroup'}.get (self.span_direction, '') + return ''; class OctaveShiftEvent (SpanEvent): diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index f808a8325b..622cba2e8b 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -727,15 +727,10 @@ def musicxml_barline_to_lily (barline): return retval.values () -# Brackets need a special engraver added the Staff context! -def musicxml_bracket_to_ly (): - layout_information.set_context_item ('Staff', '\consists "Horizontal_bracket_engraver" % for \\startGroup and \\stopGroup brackets') - return musicexp.BracketSpannerEvent () - spanner_event_dict = { 'beam' : musicexp.BeamEvent, 'dashes' : musicexp.TextSpannerEvent, - 'bracket' : musicxml_bracket_to_ly, + 'bracket' : musicexp.BracketSpannerEvent, 'glissando' : musicexp.GlissandoEvent, 'octave-shift' : musicexp.OctaveShiftEvent, 'pedal' : musicexp.PedalEvent, -- 2.39.2