lilypond-user
[Top][All Lists]
Advanced

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

lilypond and SVG output problem caused by an &


From: wjm
Subject: lilypond and SVG output problem caused by an &
Date: Wed, 14 Jul 2010 22:05:18 +1200
User-agent: Thunderbird 2.0.0.24 (X11/20100317)

Greetings,
I have been having a problem with certain SVG files failing to open in Inkscape. The attached file compiles correctly and produces the expected PDF result but when generating an SVG file the result seems to be corrupt and won't open in Inkscape. However, after some considerable time and a lot of muttering, I found that the problem was caused by having an ampersand ( & ) in the text of the header. (Don't enquire about the pathways I had to follow, or about the type of muttering indulged in!) Opening the SVG file in a text editor (Gedit) showed the & highlighted in red. Deleting it and saving the file produced an SVG which opened ok in Inkscape. An & was added by editting the relevant piece of text in Inkscape. The resultant SVG file then was seen to have & where the & used to be I did a search to see if this had been noticed by others but could find no reference... I hope this is of use to all you out there.
Regards
Bill
% Created on Tue Jan 12 13:57:52 NZDT 2010
\version "2.13.10"
%{ The Left margin is adjusted directly by altering the value of n in
left-margin = n\cm which is found in the 'paper' block
The right margin is determined by subtacting the value of 'n', and the
value of 'line-width' from the actual width of the paper.
i.e. to get a Right margin of 2cm the line width must be set to
( 21 - (4 + 2) ) ie 15
Right margin can also be set directly - but its value, and the
values of left-margin and line-width, if set, must add to the
default-paper-size.
Setting L and R margins, and not specifying line-width, is one
possible way of setting horizontal line width.
%}

#(set-default-paper-size "a4" )%'landscape)


date = #(strftime "%Y/%m/%d-%H:%M" (localtime (current-time)))

\header {
        title = "Page & layout test" 
        %{ Putting the ampersand (&) here seems to "corrupt" the
        SVG output file generated by :-
        ( lilypond -dbackend=svg lilypondfile.ly )
        Opening the svg in Inkscape fails...
        Opening the svg file in gedit (a text editor) shows the
        ampersand highlighted in red.
        Deleting it, and saving the file gives an svg file which
        opens correctly in Inkscape.
        
        Is this a bug?
        %}
        
 subtitle = "A4 page" 
 subsubtitle = "with margins" 
 
 poet = "Poet"
 
 composer = "composer" 
 arranger = "arranged by" 
 meter = "meter" 
 opus = "opus number" 
 piece = "piece" 
        instrument = "instrument name" 
        copyright = "copyright notice" 
 tagline = " "

}


verse= \lyricmode { far goes any brown cow down every flat grown all brown car 
done all blue crown down eel flown grab as but caught 

}
 

staffSoprano = \new Staff {
        \time 4/4
        \set Staff.instrumentName = "Soprano"
        \set Staff.midiInstrument = "acoustic grand"
        \key c \major
        \clef treble
        \relative c' {  
                \context Voice = "melodySop" {
                        \dynamicUp              
 % Type notes here 
        c d e f g a b c d e f g a f, g a b c d e f g a  }

        \bar "|."
        }

}
staffAlto = \new Staff {
        \set Staff.instrumentName = "Alto"
        \set Staff.midiInstrument = "acoustic grand"
        \key c \major
        \clef treble
        \relative c' {  
                \context Voice = "melodyAlt" {
                        \dynamicUp              
 % Type notes here 
        d e f g a b c d e f g a b f, g a b c d e f g a  }

        \bar "|."
        }

}
staffTenor = \new Staff {
        \set Staff.instrumentName = "Tenor"
        \set Staff.midiInstrument = "acoustic grand"
        \key c \major
        \clef "G_8"
        \relative c {   
                \context Voice = "melodyTen" {
                        \dynamicUp              
 % Type notes here 
        e f g a b c d e f g a b c g, a b c d e f g a b  }

        \bar "|."
        }

}
staffBass = \new Staff {
        \set Staff.instrumentName = "Bass"
        \set Staff.midiInstrument = "acoustic grand"
        \key c \major
        \clef bass
        \relative c, {  
                \context Voice = "melodyBas" {
                        \dynamicUp              
 % Type notes here 
        f g a b c d e f g a b c d a, b c d e f g a f g  }

        \bar "|."
        }

}


\score {
        

        <<
                \staffSoprano
                \context Lyrics = "lmelodySop" \lyricmode { \lyricsto 
"melodySop" \verse }
                
                \staffAlto
                \context Lyrics = "lmelodyAlt" \lyricmode { \lyricsto 
"melodyAlt" \verse }
                
                \staffTenor
                \context Lyrics = "lmelodyTen" \lyricmode { \lyricsto 
"melodyTen" \verse }
                
                \staffBass
                \context Lyrics = "lmelodyBas" \lyricmode { \lyricsto 
"melodyBas" \verse }
                
        >>
        
        \midi {
        }

  \layout {
  }
}

\paper {
%       #(set-paper-size "a4" 'landscape)
        left-margin = 20\mm
        %line-width = 150\mm
        %{
        Right margin = 210 (width of A4 page) minus ( 40 + 140 )
        ... unless the following value is set, and line-width is not
        %}
        right-margin = 10\mm    
  
 oddHeaderMarkup = \markup { "odd header" }  
 oddFooterMarkup = \markup \fontsize #-1   { Last edit   \date }
 evenHeaderMarkup = \markup { "even header" }  
 evenFooterMarkup = \markup \fontsize #-1   { Last edit   \date }
}



reply via email to

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