[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: svg font issue(bug?): can't change TimeSignature font (but markup fo
From: |
padovani |
Subject: |
Re: svg font issue(bug?): can't change TimeSignature font (but markup fonts can be changed) |
Date: |
Wed, 29 Apr 2015 17:48:44 -0300 |
So... I discovered that the TimeSignature issue is related to the fact that
it is not being written as text to the svg file, but as a path.
If I use this code I can create a svg file with different fonts for the
time signature, overriding the stencil with a text:
%%%%%% BEGIN CODE 1
\score {
\new Staff {
\once \override Staff.TimeSignature.stencil = #ly:text-interface::print
\once \override Staff.TimeSignature.text = \markup {
\override #'(font-name . "Helvetica")
\override #'(baseline-skip . 0.2)
\fontsize #4
\column { "3"
"4"
}}
\time 2/4
c2
}
}
%%%%%% END CODE 1
It works, but I'm struggling here to change the text of the time signature
automatically with a scheme function. Tried the code below, but it does not
work (giving me exactly the same error dump of my previous message). Any
suggestions?
%%%%%% BEGIN CODE 2
#(define-public (tsigastext grob)
(let* ((frac (ly:grob-property grob 'fraction))
(num (if (pair? frac) (car frac) 4))
(den (if (pair? frac) (cdr frac) 4))
(m (markup
#:override '(font-name . "Helvetica")
#:override '(baseline-skip . 0.5)
#:fontsize 4
#:center-column (#:number (number->string num)
#:override '(style . default)
#:number (number->string den)
))))
(ly:grob-set-property! grob 'stencil ly:text-interface::print)
(grob-interpret-markup grob m)))
\score {
\new Staff {
\override Staff.TimeSignature.stencil = #tsigastext
\time 2/4
c2
%%% \override Staff.TimeSignature.stencil = #(lambda (grob)
%%% (parenthesize-stencil (ly:time-signature::print grob) 0.1 0.4 0.4
0.1 ))
\time 3/4
c2
}
}
%%%%%% END CODE 2
thanks!
2015-04-28 14:37 GMT-03:00 padovani <address@hidden>:
> Hi,
>
> This code compiles on .ps /.svg backends without problems:
>
> %code 1
> \score {
> \new Staff {
> \time 2/4
> c2_\markup {
> \override #'(font-name . "Helvetica")
> "here it works"
> }
> }
> }
> %end code 1
>
> But the code below one gives me an error if I compile with -dbackend=svg
>
> %code2
> \score {
> \new Staff {
> \override Staff.TimeSignature.font-name = #'"Helvetica"
> \time 2/4
> c2_\markup {
> \override #'(font-name . "Helvetica")
> "here it works"
> }
> }
> }
> % end code 2
>
> here is the error:
> %%error begin
> Interpreting music...
> Preprocessing graphical objects...
> Finding the ideal number of pages...
> Fitting music on 1 page...
> Drawing systems...
> Layout output to `teste.svg'...
> warning: cannot find SVG font #f
> /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/scm/output-svg.scm:558:7:
> In procedure string-null? in expression (string-null? expr):
> /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/scm/output-svg.scm:558:7:
> Wrong type argument in position 1 (expecting string): #<unspecified>
> %%error end
>
> (I'm using 2.19.19 on OSX 10.9.5.)
>
> Is this a bug? It seems that something need to be changes in
> output-svg.scm... any idea?
>
> Thank you!
>
>
>
>