lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

String Concatenation, and Use of Unicode characters


From: Michael Hendry
Subject: String Concatenation, and Use of Unicode characters
Date: Mon, 2 Mar 2015 16:40:27 +0000

I’m an amateur jazz guitarist, and although I usually play from Realbook 
leadsheets I occasionally need to produce my own.

Typically, I want PDF output in three files, (Concert pitch, Bb and Eb), and I 
would like to modularise this as much as possible.

The .ly code which follows shows what I’m trying to do, but there are a couple 
of problems I would like help with.

1. I’d like to define a variable (\BaseFileName) which is the name of the song, 
and have this variable picked up for the title in the header, and when I’m 
creating the three PDF files with the relevant instrument names appended.

e.g. "Generic (guitar).pdf”, “Generic (trumpet).pdf” and “Generic (alto).pdf”.


2. The LilyJazzText font uses small capitals instead of lower case letters, so 
using “Eb” produces a capital E followed by a small capital B. On my Mac I know 
how to produce a flat sign, and LilyPond will use the flat sign from another 
font, but I’d like to be able to define a flat sign as a variable, and append 
it to the piece markup when creating the books for trumpet and alto.

Thanks in advance,

Michael Hendry


%%%%%%%%%%%%

\version "2.18.0"

\include "LilyJAZZ.ily"
\include "AccordsJazzDefs.ly"

BaseFileName = "Generic"
FlatSign = ""

\header {
  title =               \markup {\fontsize #3   \override #'(font-name . 
"LilyJAZZText") "Generic" }
}

TheHead =  \relative c' {
  \set Score.markFormatter = #format-mark-box-letters
  \clef "treble" \key c \major \numericTimeSignature \time 4/4
 {c d e f}

}

TheChords =  \chords {
c1
}

% I’d like the code from here on to be generic, and produce concert, Bb and Eb 
versions from the variables defined above.

\book {

  \bookOutputName  "Generic (guitar)” % I WANT TO CONSTRUCT THIS STRING BY 
APPENDING “ (guitar)” to BaseFileName
  \new Score
  <<
    \transpose c c {\TheChords}
    \new Staff
    \jazzOn \transpose c c {\TheHead}
  >>
  \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
"LilyJazzText") "Guitar"}}
}

\book {
  \bookOutputName "Generic (tpt)” % I WANT TO CONSTRUCT THIS STRING BY 
APPENDING “ (tpt)” to BaseFileName
  \new Score
  <<
    \transpose c d' {\TheChords}
    \new Staff
    \jazzOn \transpose c d' {\TheHead}
  >>
  \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
"LilyJazzText") "Trumpet in Bb”}} % I WANT TO USE VARIABLE FOR FLAT SIGN HERE...
}


\book {
  \bookOutputName "Generic (alto)” % I WANT TO CONSTRUCT THIS STRING BY 
APPENDING “ (alto)” to BaseFileName
  \new Score
  <<
    \transpose c a {\TheChords}
    \new Staff \jazzOn \transpose c a {\TheHead}
  >>
  \header {piece = \markup {\fontsize #-1 \override #'(font-name . 
"LilyJazzText") "Alto Sax in Eb”}} % …AND AGAIN HERE


reply via email to

[Prev in Thread] Current Thread [Next in Thread]