Hello Tamura-san,
Having run into this problem myself before and discovered that there had been a
solution previously proposed in this mailing list about ten years ago
(https://lists.gnu.org/archive/html/lilypond-user/2015-04/msg00105.html), my
solution is modeled after that:
%%% BEGIN %%%
\version "2.24.4"
\language "english"
#(append! default-script-alist
(list
`(pStaccBeginUp
. (
(stencil . ,ly:text-interface::print)
(text . ,#{ \markup
\center-align
\concat { \hspace #-1.3
\lower #0.5 \text "[ "
\musicglyph "scripts.staccato"
} #})
; any other properties
(toward-stem-shift-in-column . 1.0)
(outside-staff-priority . #f)
(padding . 0.5)
(avoid-slur . around)
(direction . ,UP))))
(list
`(pStaccBeginDown
. (
(stencil . ,ly:text-interface::print)
(text . ,#{ \markup
\center-align
\concat { \hspace #-1.3
\lower #0.5 \text "[ "
\musicglyph "scripts.staccato"
} #})
; any other properties
(toward-stem-shift-in-column . 1.0)
(outside-staff-priority . #f)
(padding . 0.5)
(avoid-slur . around)
(direction . ,DOWN))))
(list
`(pStaccEndUp
. (
(stencil . ,ly:text-interface::print)
(text . ,#{ \markup
\center-align
\concat { \hspace #1.3
\musicglyph "scripts.staccato"
\lower #0.5 \text " ]"
} #})
; any other properties
(toward-stem-shift-in-column . 1.0)
(outside-staff-priority . #f)
(padding . 0.5)
(avoid-slur . around)
(direction . ,UP))))
(list
`(pStaccEndDown
. (
(stencil . ,ly:text-interface::print)
(text . ,#{ \markup
\center-align
\concat { \hspace #1.4
\musicglyph "scripts.staccato"
\lower #0.5 \text " ]"
} #})
; any other properties
(toward-stem-shift-in-column . 1.0)
(outside-staff-priority . #f)
(padding . 0.5)
(avoid-slur . around)
(direction . ,DOWN))))
)
parenStaccBeginUp = #(make-articulation 'pStaccBeginUp)
parenStaccBeginDown = #(make-articulation 'pStaccBeginDown)
parenStaccEndUp = #(make-articulation 'pStaccEndUp)
parenStaccEndDown = #(make-articulation 'pStaccEndDown)
{
c''4\tweak extra-offset #'(0 . -1.75) \parenStaccBeginUp d''-. e''-. f''\tweak
extra-offset #'(0 . -0.5) \parenStaccEndUp
c'4\parenStaccBeginDown d'-. e'-. f'\tweak extra-offset #'(0 . 1)
\parenStaccEndDown
}
%%% END %%%
It’s not necessarily perfect, and I have used the last-resort method of \tweak
extra-offset, but it should get you started.
All the best,
Yoshi