dao: > I'd like to highlight a text element of my svg file: > > <text transform="matrix(1 0 0 1 433.8965 494.4141)" style="fill:#00FFFF; > font-family:'CourierNewPSMT'; font-size:24;">00.00</text> > > I cannot see any way to set the background of a text, or to get the box size > to draw a rectangle around it. > > Do you know how I can do this?
A hacky way of declaratively drawing background for your text is to use a filter: <svg xmlns='http://www.w3.org/2000/svg' font-size='24'> <filter id='f' x='0' y='0' width='100%' height='100%'> <feFlood flood-color='yellow' result='bg'/> <feMerge> <feMergeNode in='bg'/> <feMergeNode in='SourceGraphic'/> </feMerge> </filter> <text x='20' y='100' filter='url(#f)'>Hello there</text> </svg> The overhead of doing this is probably much greater than computing the bounding box of the text and inserting a <rect> to draw the background, though. -- Cameron McCormack ≝ http://mcc.id.au/ --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org