Tuesday, October 14, 2008

Unmangling score-final tuplet brackets


\new Staff {
\set tupletFullLength = ##t
\time 1/8
\times 2/3 { c'16 c'16 c'16 }
\times 2/3 { c'16 c'16 c'16 }
\times 2/3 { c'16 c'16 c'16 }
\override Score.RehearsalMark #'break-visibility = ##(#t #t #t)
\override Score.RehearsalMark #'direction = #down
\override Score.RehearsalMark #'break-align-symbol = #'clef
\override Score.RehearsalMark #'self-alignment-X = #right
\mark "Composed Feb 2007 - Feb 2008"
}


Note that you can now get this to work with the following:

\override TupletBracket #'full-length-to-extent = ##f


From the LilyPond bug in the tracker here.

Tuesday, September 23, 2008

Using FontForge to convert LilyPond .pfb to .otf

A number of the fonts in the LilyPond /fonts directory are .pfb instead of .otf. FontForge can convert these .pfb LilyPond fonts to .otf.

  • Go to sourceforge.
  • download package
  • unzip
  • run package
  • make sure X11 server is installed on machine; came preinstalled on MacBook under OS 10.5.4
  • install package
  • double click X11 server to start
  • double-click FontForge application icon to start
  • use FontForge's UI to browse to /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/fonts/type1
  • go here to figure out how to use fontforge's UI to convert
  • for each .pfb: navigate to file, click OK to open, file > generate fonts > as .otf > click save
  • click 'OK' if FontForge says there are problems

Wednesday, August 27, 2008

OTF versions of the LilyPond custom fonts

LilyPond uses custom fonts, primarily of the Feta and Emmentaler families. These custom fonts draw noteheads, accidentals, tuplet numbers, time signatures and curly braces. LilyPond also uses New Century Schoolbook for default letting in titles and credits.

LilyPond stores font information here:

/Applications/LilyPond.app/Contents/Resources/share/lilypond/current/fonts

LilyPond does not appear to install these custom fonts in the usual places in the filesystem such that other applications, like Illustrator and InDesign, can find them.

The LilyPond /fonts folder contains three subfolders: /otf, /svg and /type1.

If you use Apple's FontBook application to load the custom LilyPond fonts, those fonts in /otf will load perfectly. But the fonts in /svg and /type1 will not load at all.

The fonts in /svg duplicate the fonts in /otf and so probably aren't necessary under any circumstances to load with FontBook.

The fonts in /type1 are unique and, therefore, probably are necessary. The fonts end in .pfa and FontBook will not recognize them. The solution is to download FontForge and use FontForge to convert these .pfa fonts to .otf fonts. The FontForge UI requires the X11 client, which was available in the Utilities subfolder in my Applications folder without recourse to install discs for the MacBook. Double-click to start the X11 server before double-clicking to start FontForge. Then use FontForge to Open each .pfa by hand, and then Generate each .pfa as an .oft. Generate is apparently FontForge's term for convert or save-as. The process is tedious but works.

The resulting 33 new .otf fonts load correctly under FontBook.

I would publish the zipped file of the complete set of all 46 custom LilyPond fonts as .otf here, but I can't figure out how to get Blogger to let me upload a nonimage, nonvideo file.

Tuesday, August 19, 2008

Importing LilyPond output into Adobe Illustrator

Take the simplest possible test.ly LilyPond file ...

\version "2.11.50"
\new Staff { c'4 }

... and render test.pdf as PDF output. Two different ways of 'moving' test.pdf into LilyPond.

Dragging test.pdf onto the Illustrator icon on the dock causes Illustrator to open test.pdf as a pdf for pdf editing. This isn't a successful way of working. Illustrator complains about missing fonts ...



... and then displays the pdf incorrectly ...



... which is bad.

Placing test.pdf into an existing Illustrator file using File > Place works ...



... which is good.

So it would appear that the way to get LilyPond output into Illustrator is to render a PDF from LilyPond and then place the PDF into Illustrator.

However, this is with Illustrator 11.0.0 from the very first release of Creative Suite a couple of years back. When Eryn places test.pdf in her more modern version of Illustrator, missing font problems result and, for example, dynamics appear in Arial.

So the conclusion appears to be that placing LilyPond PDFs works only under certain versions of illustrator. Which is frustrating.

There is a third way of moving LilyPond output into Illustrator. This third way involves the UNIX utility ps2ps for clean up. The ps2ps utility runs against an existing postscript or pdf file. So it's possible to run ps2ps against test.pdf and generate test-clean.pdf as output. From here again we can either drag or place test-clean.pdf onto or in Illustrator. And here the results differ from those above.

Dragging test-clean.pdf onto the Illustartor icon to edit as PDF does not cause Illustrator to complain about missing fonts but does cause Illustrator to display time signatures and dynamics with a slight degree of jagginess visible at high magnification.



Placing test-clean.pdf into an existing Illustrator file does not work. Illustrator complains the test-clean.pdf is not in a format that can place.




CONCLUSIONS:

1. Placing LilyPond PDF output works perfectly in Illustrator 11.0.0 under OS 10.5.4; placing LilyPond PDF output causing missing font problems under more modern versions of Illustrator under OS 10.4 something.

2. Running ps2ps on LilyPond PDF output enables Illustrator 11.0.0 under OS 10.5.4 and also more modern versions of Illustrator under 10.4 something to open LilyPond PDF output directly from the dock but with high magnification jaggies; on the other hand, running ps2ps on LilyPond PDF output causes both of these versions of Illustrator to be unable to place LilyPond PDF output.


ONE LAST OBSERVATION:

3. LilyPond PDF output that I place perfectly in Illustrator 11.0.0 under OS 10.5.4 does not open correctly under more modern versions of Illustrator under OS 10.4 something. In other words, my LilyPond AI files open incorrectly on Eryn's machine. Interestingly, Eryn's machine finds all fonts correctly but displaces a good many noteheads down to such a degree that they are musically incorrect.



LAST CONCLUSION:

4. Placed files are perfect on my machine but open incorrectly on Eryn's machine. So we're going with the ps2ps method of production on my machine so that the files open correctly on Eryn's machine and, hopefully, at the printers.

Monday, June 2, 2008

Minimum LilyPond glissando lengths

From Matt on the list two weeks ago:

\override Glissando #'springs-and-rods = #ly:spanner::set-spacing-rods
\override Glissando #'minimum-length = #4

The code is a mystery but potentially useful for the spacing of a variety of objects. Will require tests.

Thursday, May 22, 2008

LilyPond baseline alignment

Baseline alignment of TextSpanner text takes some work in LilyPond.



The primary tricks to get that bit there are the \transparent and \combine markup commands, together with faking the right ascender- and descender-heights with an "f". All parts of that come from Markus, and thank God because I spent a good amount of time on the problem this weekend and only got partway there.

After grace positioning in LilyPond

LilyPond renders after grace notes well in a variety of metric positions.



\layout { indent = #0
ragged-right = ##t
}

\new Staff \with {
\remove Time_signature_engraver
} {
\set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
\override Score.SpacingSpanner #'uniform-stretching = ##t
\override Score.SpacingSpanner #'strict-note-spacing = ##t
\override Score.SpacingSpanner #'strict-grace-spacing = ##t
\override Stem #'direction = #down
\afterGrace c'8 [ { c'32 [ c'32 c'32 c'32 ] } c'8 c'8 c'8 ]
c'8 [ \afterGrace c'8 { c'32 [ c'32 c'32 c'32 ] } c'8 c'8 ]
c'8 [ c'8 \afterGrace c'8 { c'32 [ c'32 c'32 c'32 ] } c'8 ]
c'8 [ c'8 c'8 \afterGrace c'8 ] { c'32 [ c'32 c'32 c'32 ] }
}