xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Spangsege ...@instadia.net>
Subject SVGTextElement.getComputedTextLength()
Date Wed, 26 Jan 2005 10:48:50 GMT
Hi

According to the SVG conformance page, the following method is supported 
by Batik:

SVGTextElement.getComputedTextLength()

Yet I have problems with it.
I would appreciate if someone could point out for me what I'm doing wrong.

I'm using Batik 1.5.1.

The Code:
----------------------------------------------------------------------

import org.w3c.dom.svg.*;
import org.apache.batik.dom.*;
import org.apache.batik.dom.svg.*;

public class Test
{
   public static void main(String[] args)
   {
     SVGOMDocument doc = 
(SVGOMDocument)SVGDOMImplementation.getDOMImplementation().createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI,

"svg", null);

     SVGTextElement text = 
(SVGTextElement)doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, 
"text");
     text.appendChild(doc.createTextNode("foo"));

     System.err.println(text.getComputedTextLength());
   }
}

----------------------------------------------------------------------

I get this error:

----------------------------------------------------------------------

Exception in thread "main" java.lang.NullPointerException
         at 
org.apache.batik.dom.svg.SVGTextContentSupport.getComputedTextLength(Unknown 
Source)
         at 
org.apache.batik.dom.svg.SVGOMTextContentElement.getComputedTextLength(Unknown 
Source)
         at Test.main(Test.java:14)

----------------------------------------------------------------------

Regards and thanks in advance,
Kristian Spangsege


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message