From aedfee0c57adcdd5411c6ffb9c02c71c2cb60ec6 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sat, 13 Oct 2012 14:17:43 +0200
Subject: [PATCH] Add functions for left/right parenthesize

---
 orchestrallily.ily | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/orchestrallily.ily b/orchestrallily.ily
index 4312349..67f9bdc 100644
--- a/orchestrallily.ily
+++ b/orchestrallily.ily
@@ -1817,12 +1817,31 @@ divisi = #(define-music-function (parser location vc1 vc2) (ly:music? ly:music?)
 bracketify = #(define-music-function (parser loc arg) (ly:music?)
    (_i "Tag @var{arg} to be parenthesized.")
 #{
-  \once \override ParenthesesItem #'stencils = #bracket-stencils
-  \parenthesize $arg
+  \tweak ParenthesesItem #'stencils #bracket-stencils \parenthesize $arg
 #})
 
 
 
+#(define-public (parentheses-item::calc-parenthesis-left-stencils grob)
+  (let* ((font (ly:grob-default-font grob)))
+    (list (ly:font-get-glyph font "accidentals.leftparen") empty-stencil)))
+
+#(define-public (parentheses-item::calc-parenthesis-right-stencils grob)
+  (let* ((font (ly:grob-default-font grob)))
+    (list empty-stencil (ly:font-get-glyph font "accidentals.rightparen"))))
+
+parenthesizeLeft = #(define-music-function (parser loc arg) (ly:music?)
+#{
+  -\tweak ParenthesesItem #'stencils #parentheses-item::calc-parenthesis-left-stencils
+  -\parenthesize $arg 
+#})
+parenthesizeRight = #(define-music-function (parser loc arg) (ly:music?)
+#{
+  -\tweak ParenthesesItem #'stencils #parentheses-item::calc-parenthesis-right-stencils
+  -\parenthesize $arg 
+#})
+
+
 #(define-markup-command (hat layout props arg) (markup?)
   "Draw a hat above the given string @var{arg}."
   (interpret-markup layout props (markup #:combine #:raise 1.5 "^" arg)))
-- 
GitLab