Re: Text Background

On Friday, 15 March, 2002, 23:58:07, Joe wrote:



JM>         Hi,

JM>         Does anyone know to accurately have a <text> object
JM>         Have a colored background fill?

Not in SVG 1.0, without a certain amount of messing around with
script, or use of text length.


JM>         I do not see any attributes that allow you to specify
JM>         that you want a fill behind the text (a solid colored
JM>         rectangle that completely surrounds the text).

How much control do you want on how closely the solid area abuts the
text (ie, padding around the edges). Would it be a rectangular area?

What would the desitred behavior be for skewed text? for text on a path?


JM>         Right now, I have to calculate what I think the rect should
JM>         Be in an active-x control based on the font metrics of
JM>         The font selected. I then draw a <rect> with the coordinates
JM>         Of the rect I calculated, and then I draw the <text> object
JM> after that      and Specify the "textLength" to the rectangle's width,
JM> and the
JM>         And the lengthAdjust to "spacingAndGlyphs".

JM>         It seems kind of "hacky" to me, but it works.

Yeah, that's what I meant by 'messing around'.

Not currently, in SVG 1.0, but there is a clear need to do something
like this in a later version provided it is well specified.


-- 
 Chris                            mailto:chris@w3.org

Received on Saturday, 16 March 2002 11:59:23 UTC