I am wondering if a complete rewrite of the theme syntax in XML form is the way to go, let's say from version 4 onwards. XML is far better structured and a custom streamlined XML parser (I don't know if there is a tinyXML equivalent in straight C) that would only parse tags required for the theme syntax (and not support things we don't really need like XSD etc.) would not hurt the code size that much.
In the case of conditional tags depending on screen and playback status we could have something like this:
<viewport="a" x=14 y=45 w=36 h=16 font=1 >
<element="b" type="viewport" screen="menu" screen="wps" screen="playlist" status="play" />
<element="c" type="viewport" screen="menu" screen="wps" screen="playlist" status="paused" />
<element="d" type="text" screen="fm" status="fmplay" />
</viewport>
where in cases we don't need conditionals in the above we can simply omit screen and/or status tags. The tag "type" denotes text, viewport or bitmap to be displayed in this viewport.
A bitmap tag can be like this:
<bitmap="A" filename="mediastatus.bmp" x=0 y=0 w=36 h=16 parts=6 />
where parts can be omitted when the bitmap only contains one subimage.
A text tag can either follow the current tagging system e.g.:
<text="b" element="%s%al%?it<%it|%fn>" />
or a complete rewrite of all the tags in XML form e.g. like so:
<text="b" scroll=1 alignment=left >
<tag condition=0 element="%it">
<tag condition=1 element="%fn">
</text>
What do you think?