I've started some work on doing SVG graphics from Pico Lisp, and I've written a few functions that produce SVG elements. I try to do this more or less in the same way the HTML elements are done in lib/xhtml.l. Some SVG elements have just a small number of attributes, but others, like 'text', may have quite a few optional attributes. In my current <text> function I have not yet taken care of the "presentation attributes". It looks like this:

(de <text> (Id X Y Dx Dy Rotate TextLength LengthAdjust . Prg)
        (prin "<text")
        (and Id (prin " id=\"" Id "\""))
        (and X (prin " x=\"" X "\""))
        (and Y (prin " y=\"" Y "\""))
        (and Dx (prin " dx=\"" Dx "\""))
        (and Dy (prin " dy=\"" Dy "\""))
        (and Rotate (prin " rotate=\"" Rotate "\""))
        (and TextLength (prin " textLength=\"" TextLength "\""))
        (and LengthAdjust (prin " lengthAdjust=\"" LengthAdjust "\""))
        (prin ">")
        (run Prg)       # the text, or other elements
        (prinl "</text>") )

A simple call to this function may look like this:

(<text> NIL "10%" "50%" NIL NIL NIL NIL NIL
        (prin "No font and color arguments yet") )

If I should go on adding more presentation arguments for this function, then the calls would very often have a lot of NIL arguments, which looks rather ugly. Should I switch to property lists? Any suggestions?

Here are some useful SVG pages:


Reply via email to