hbracket question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hbracket question

SoundsFromSound

Hi all,

Is it possible to adjust the length of the shorter vertical line of \hbracket when you use it as markup?

I've attached a screenshot to show the point of the bracket I'm asking about. Thanks!

\version "2.19.82"
\relative c' {
  R1*3
  c1^\markup {
    \hbracket {
      \line \pad-around #0.2 {
        My markup
      }
    }
  }
}





_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

hbracket_help.png (22K) Download Attachment
composer | sound designer | asmr artist
Reply | Threaded
Open this post in threaded view
|

Re: hbracket question

Aaron Hill
On 2019-02-14 3:07 pm, Ben wrote:

> Hi all,
>
> Is it possible to adjust the length of the shorter vertical line of
> \hbracket when you use it as markup?
>
> I've attached a screenshot to show the point of the bracket I'm asking
> about. Thanks!
>
> \version "2.19.82"
> \relative c' {
>   R1*3
>   c1^\markup {
>     \hbracket {
>       \line \pad-around #0.2 {
>         My markup
>       }
>     }
>   }
> }

No, the amount of protrusion is hard-coded for \hbracket.

However, you can create your own markup command and call
bracketify-stencil yourself:

%%%%
\version "2.19.82"
#(define-markup-command (custom-bracket layout props arg) (markup?)
   #:properties ((thickness 0.1) (protrusion 0.25) (padding 0.1))
   (bracketify-stencil (interpret-markup layout props arg)
     Y thickness protrusion padding))
#(define-markup-command (custom-hbracket layout props arg) (markup?)
   #:properties ((thickness 0.1) (protrusion 0.25) (padding 0.1))
   (bracketify-stencil (interpret-markup layout props arg)
     X thickness protrusion padding))

\markup {
   \hbracket Hello
   \custom-hbracket Hello
   \override #'(thickness . 0.2)
   \override #'(protrusion . 0.5)
   \override #'(padding . 0.3)
   \custom-hbracket Hello

   \bracket Hello
   \custom-bracket Hello
   \override #'(thickness . 0.2)
   \override #'(protrusion . 0.5)
   \override #'(padding . 0.3)
   \custom-bracket Hello
}
%%%%

-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: hbracket question

Thomas Morley-2
In reply to this post by SoundsFromSound
Am Fr., 15. Feb. 2019 um 00:11 Uhr schrieb Ben <[hidden email]>:
>
> Hi all,
>
> Is it possible to adjust the length of the shorter vertical line of \hbracket when you use it as markup?

No, it's all hardcoded.

But you can redefine it:

#(define-markup-command (hbracket-harm layout props arg)
  (markup?)
  #:category graphic

  #:properties ((thickness 1)
                (height 0.25))
  "
@cindex placing horizontal brackets around text

Draw horizontal brackets around @var{arg}.

@lilypond[verbatim,quote]
\\markup {
  \\hbracket {
    \\line {
      one two three
    }
  }
}
@end lilypond"

  (let ((th (* (ly:output-def-lookup layout 'line-thickness)
               thickness))
        (m (interpret-markup layout props arg)))
    (bracketify-stencil m X th height th)))

\relative c' {
  R1*3
  c1^\markup {
      \override #'(thickness . 2)
      \override #'(height . 1)
    \hbracket-harm {
      \line \pad-around #0.2 {
        My markup
      }
    }
  }
}


Probably rename it ;)


Best,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: hbracket question

SoundsFromSound
On 2/14/2019 6:35 PM, Aaron Hill wrote:
On 2019-02-14 3:07 pm, Ben wrote:
Hi all,

Is it possible to adjust the length of the shorter vertical line of
\hbracket when you use it as markup?

I've attached a screenshot to show the point of the bracket I'm asking
about. Thanks!

\version "2.19.82"
\relative c' {
  R1*3
  c1^\markup {
    \hbracket {
      \line \pad-around #0.2 {
        My markup
      }
    }
  }
}

No, the amount of protrusion is hard-coded for \hbracket.

However, you can create your own markup command and call bracketify-stencil yourself:

%%%%
\version "2.19.82"
#(define-markup-command (custom-bracket layout props arg) (markup?)
  #:properties ((thickness 0.1) (protrusion 0.25) (padding 0.1))
  (bracketify-stencil (interpret-markup layout props arg)
    Y thickness protrusion padding))
#(define-markup-command (custom-hbracket layout props arg) (markup?)
  #:properties ((thickness 0.1) (protrusion 0.25) (padding 0.1))
  (bracketify-stencil (interpret-markup layout props arg)
    X thickness protrusion padding))

\markup {
  \hbracket Hello
  \custom-hbracket Hello
  \override #'(thickness . 0.2)
  \override #'(protrusion . 0.5)
  \override #'(padding . 0.3)
  \custom-hbracket Hello

  \bracket Hello
  \custom-bracket Hello
  \override #'(thickness . 0.2)
  \override #'(protrusion . 0.5)
  \override #'(padding . 0.3)
  \custom-bracket Hello
}
%%%%

-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user


Thanks Aaron! This works great.



On 2/14/2019 6:35 PM, Thomas Morley wrote:
Am Fr., 15. Feb. 2019 um 00:11 Uhr schrieb Ben [hidden email]:
Hi all,

Is it possible to adjust the length of the shorter vertical line of \hbracket when you use it as markup?
No, it's all hardcoded.

But you can redefine it:

#(define-markup-command (hbracket-harm layout props arg)
  (markup?)
  #:category graphic

  #:properties ((thickness 1)
                (height 0.25))
  "
@cindex placing horizontal brackets around text

Draw horizontal brackets around @var{arg}.

@lilypond[verbatim,quote]
\\markup {
  \\hbracket {
    \\line {
      one two three
    }
  }
}
@end lilypond"

  (let ((th (* (ly:output-def-lookup layout 'line-thickness)
               thickness))
        (m (interpret-markup layout props arg)))
    (bracketify-stencil m X th height th)))

\relative c' {
  R1*3
  c1^\markup {
      \override #'(thickness . 2)
      \override #'(height . 1)
    \hbracket-harm {
      \line \pad-around #0.2 {
        My markup
      }
    }
  }
}


Probably rename it ;)


Best,
  Harm

Harm,

Thank you for making this for me, I'll probably rename it yes ;) Works beautifully!




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
composer | sound designer | asmr artist