Monday, June 29, 2009

Red, boxed markup




\version "2.13.2"

\new Staff {
\set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
c'4
\override TextScript #'staff-padding = #4
\override TextScript #'self-alignment-X = #left
c'4 ^ \markup \with-color #red \override #'(box-padding . 1.0)
\box \hcenter-in #3 \line { 2 / 3 }
c'4
c'4
\bar "||"
}

Sunday, June 28, 2009

The right version of LilyPond for OS X

There's been some craziness regarding the correct version of LilyPond for OS X users for sometime. The LilyPond download page ...

http://lilypond.org/web/install/

... lists three different situations:

  • MacOS X 10.5 (Leopard)
  • MacOS X (Intel) 10.4
  • MacOS X (G3, G4, G5) 10.3 and newer

I find all three of these a touch confusing. So here's what works for me.

I have a MacOS X (Intel) 10.4 iMac at home. And, happily, clicking on the corresponding link on the LilyPond download page always works. The only confusing bit, however, is that you if you inspect downloaded executable in the Finder (using cmd-I for 'info'), the info box that the Finder shows you will say that the application is 'Application (PowerPC)'.



I *think* this is just a mistake. But I've never been certain. Anyway, the point is that the MacOS X (Intel) 10.4 link on the LilyPond download site does indeed work, even if the binary is mislabelled.

The situation with my MacBook running Leopard is more complicated. I have never once followed the MacOS X (Leopard) 10.5 link on the LilyPond download page. The link takes you away from the LilyPond site and has a bunch of instructions that have never made much sense to me. Happily, though, what does work for me is to download from the MacOS (G3, G4, G5 Macs) 10.3 and newer link on the LilyPond download page.

Now this is highly counterintuitive. It seems like downloading a binary for the old, old type of Mac hardware would be exactly the wrong thing to do for a MacBook made of the (almost) newest type of Mac hardware. But this does in fact work.

I think the one caveat here is that I never use the LilyPond GUI and always call LilyPond from the commandline. I think that running the LilyPond GUI on my MacBook with the old G3 version of the binary would probably fail.

convert-ly and multiple versions of Python

The LilyPond convert-ly script lives here under a standard OS X install of LilyPond:

/Applications/LilyPond.app/Contents/Resources/bin/convert-ly

The script is written in Python but starts with the following directive to the shell:

#!/usr/bin/python

If you have multiple versions of Python installed on your system, convert-ly may find an old version of Python and be unable to start. Fix this by changing the first line of convert-ly to this:

#!/usr/bin/env python

Wednesday, June 24, 2009

TextSpanner alignment, TextScript alignment



The 2, 3 and 4 in the image all center directly above the first chord in the measures they govern.

The 2 and 3 are LilyPond TextScript grobs. The 4 is the left text of a LilyPond TextSpanner grob.

Center alignment for TextScript and TextSpanne grobs differ.

To (horizontally) center a TextScript relative to the note to which it refers, use \once \override TextScript #'self-alignment-X = #center together with \once \override TextScript #'X-offset = #center. This pair of settings is easy enough to stumble across in the LilyPond docs.

To horizontally center the left text of a TextSpanner, use \once \override TextSpanner #'bound-details #'left #'text = \markup { \halign #0 "FOO" } together with \once \override TextSpanner #'bound-details #'left #'attach-dir = #center. The 'attach-dir is easy enough to find, but knowing to use \halign *internal to the markup* takes some real doing.