[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function error--confusing!
From: |
Werner LEMBERG |
Subject: |
Re: function error--confusing! |
Date: |
Sun, 27 Apr 2008 08:52:20 +0200 (CEST) |
> I modified my def for Chinese font file selection, to define a
> function for bilingual display:
>
> cheng = #(define-music-function [...]
You are defining a music function, but you need a markup function.
What I tried was this -- and which should work in theory:
#(define-markup-command (cheng layout props
chisize chinese engsize english)
(number? string? number? string?)
(interpret-markup layout props
(markup #:override '(baseline-skip . 2)
#:center-align
(#:bold
#:fontsize chisize
#:override '(font-name . "仿宋_GB2312")
chinese
#:bold
#:fontsize engsize
english))))
\header {
dedication = \markup \cheng #2 #"至武海雁"
#2 #"Dedicated to Wu Haiyan"
...
However, lilypond complains that it doesn't know the `signature' of
this function; this means you can't have a markup command with four
scheme parameters. This is an unfortunate limitation of lilypond's
parser -- ideally, `define-markup-command' should extend the parser
dynamically so that it can handle such constructs, but this doesn't
happen (yet?).
Well, to circumvent this, I've simply defined an ordinary scheme macro
like this:
#(define (cheng chisize chinese engsize english)
(markup #:override '(baseline-skip . 2)
#:center-align
(#:bold
#:fontsize chisize
#:override '(font-name . "仿宋_GB2312")
chinese
#:bold
#:fontsize engsize
english)))
\header {
dedication = #(cheng 2 "至武海雁" 2 "Dedicated to Wu Haiyan")
...
And this now works.
Werner