W3C home > Mailing lists > Public > www-svg@w3.org > April 2007

Re: problem in firefox and moziila

From: Doug Schepers <doug.schepers@vectoreal.com>
Date: Tue, 03 Apr 2007 14:49:43 -0400
Message-ID: <4612A1C7.7060609@vectoreal.com>
To: www-svg@w3.org

Hi, Jhon-

I put together a (very) simple example of how you can do text-wrapping 
with script.  I tested in in Windows with FF2, Opera9, and IE7+ASV3.

http://svg-whiz.com/svg/text/TextWrap-simple.svg

It's by no means perfect... it does take into account text-anchor, but 
not letter-spacing, word-spacing, etc.  The heuristic for determining 
the width of each line is a weak ad-hoc measure based on the number of 
characters and the font-size, not the getComputedTextLength or getBBox, 
because those didn't work (for this purpose) in FF2.

Still, I hope it's of some use to you.  To use it, simply create a 
'textArea' element in my pseudo-SVG1.2 namespace, with the desired 
dimensions and text, and this script will do pretty much the rest.  You 
can use whatever attributes you want (it will transfer them over), but 
keep in mind that this script is not rigorously tested.

You could adapt it to be more robust, but I'm hoping the real 
'svg:textArea' element is implemented in browsers before long, making 
this script unnecessary.

Regards-
-Doug

Research and Standards Engineer
6th Sense Analytics
www.6thsenseanalytics.com
mobile: 919.824.5482

Doug Schepers wrote:
> 
> Hi, jhon-
> 
> Well, the proximal cause of that error is that setProperty takes 3 
> arguments, not 2.  So, for example, instead of:
>    this._svg.style.setProperty('text-anchor', anchor);
> it should say,
>    this._svg.style.setProperty('text-anchor', anchor, '');
> 
> But repairing that still doesn't fix the file.
> 
> In Firefox1.5, relative values for 'dy' are not implemented, so the code 
> still won't work.
> 
> I can whip up a simple proof-of-concept that works across browsers for 
> you, if you're interested.
> 
> Regards-
> -Doug
> 
> jhon wrote:
>  > Greetings.
>  >
>  > http://www.xml.com/2002/09/11/examples/TextWrap.svg
>  >
>  > This SVG file is not work in mozilla, firefox and opera.
>  > I put this in the svg file
>  >
>  > xmlns:xlink="http://www.w3.org/1999/xlink"
>  >
>  > but, NO work, only the half :-( .
>  >
>  >
>  > In Mozilla, firefox i have the following log at the error console:
>  >
>  > 1.)
>  > Warning:  Unknown property 'line-interval'.  Rejected declaration.
>  > Source file : file:///home/foo/SVG/TextWrap.svg
>  > line: 0
>  >
>  > (here: in the *line-interval* is the Text String")
>  >
>  > 2.)
>  > Error: uncaught exception: [Exception... "Not enough arguments" 
> nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)"  location: "JS
>  > frame :: file:///home/foo/SVG/TextWrap.es :: anonymous :: line 266" 
> data: no]
>  >
>  > Internet Explorer work fine.
>  >
>  > Some Help?.
>  >
>  >
>  >
>  >
>  >
> 
> 


-- 
Received on Tuesday, 3 April 2007 18:49:58 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:36 GMT