On Sun, 24 Jul 2011 17:50:07 +0100, Richard Shann wrote > On Sun, 2011-07-24 at 15:08 +0000, Ralf Mattes wrote: > > > > Hello, > > > > sorry if I seem to just complain, > Not at all, I very much appreciate finding out how scheme/C should work > together > > > but that's an extremely ugly interface. > > You're introducing an ad-hoc markup language > however, this is going a bit far, asking the scripters to put the > parameters to the cairo_show_text() onto successive lines is no sort > of language at all; you cannot change font or size or anything > within the string you are printing. Curiously, cairo_show_text() is > described by the cairo folk as a "toy" interface, but it may be the > right thing to use here, as we are not seriously interested in text > (kerning, justification, spell-checking ...) > > > without need - have a look at > > Gtk's (Pango's, to be more specific) markup language [1]. > > May I suggest a more "scheme-ish" way: > > > > d-DirectivePut-standalone-graphic tag <spec> > > > > Where spec is either a string (backward-comaptible) or a list of the > > form (<type> &rest ...) where type is a keyword and the rest args > > specify type specific information. A few examples: > > > > (d-DirectivePut-standalone-graphic tag (:graphic :file > > "/home/wallace/cheese.svg")) > > Did you mean 'graphic 'file etc here?
No, I meant ":graphic" and ":file" One of the first things I do in my guile projects is: (read-set! keywords 'prefix) so ":file" is the same as "#:file". Keywords are pretty nice for named parameters and "tags" since comarison is so cheap. As a matter of fact, they can easily be used in C switch statements. Being able to use keywords is one of the main reasons I wanted to have some sort of central guile initialization place. Denemo can lookup the SCM value for keywords during startup (with scm_from_locale_keyword) and store/remember the value for application lifetime (keywords are guaranteed to stay constant). > > > > bbb > > DOUBLE FLAT" :font "Lucida Bright")) > > Did you have some sort of lookup for "MUSICAL SYMBOL DOUBLE FLAT" to > find what utf8 value this was? I am not sure if there is stuff for that > available. No, I desing APIs by wishful thinking. If there's no way to map the unicode character name -- too bad. Maybe we then need to code one. I'm just trying to point out a different approach. I'm not even shure about the list parameter. I only picked it since it would make dispatch easier: if the first parameter is a string do the old style, else do it the new way. An alternative would be to leave out the list like this: (d-DirectivePut-standalone-graphic tag :glyph "CAPITAL A" ....) > As always, the bottom line is having the manpower - I am confident > now about iterating through a scheme list in C (thanks to earlier comments > by you), but testing symbols like 'glyph would take me some research > (in fact I haven't really got a solid model in my head for symbols > and the strings that are used to name them ...). Well, the very > bottom line is that scheme objects carry their type with them, so we > can always add extra parameter types to d-DirectivePut-standalone- > graphic, for instance if we found we needed to use several fonts in > one display string. Too bad I short on time right now. BTW, would it be possible to merge my load-path branch into main? I'd love to use it for the midi input stuff (and that would then contain code that does keyword lookup ... ;-) Cheers, RalfD > Thanks for your comments > > Richard -- R. Mattes - Hochschule fuer Musik Freiburg [email protected] _______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
