W3C home > Mailing lists > Public > www-svg@w3.org > February 2004

text lenght

From: Carlo Andreoli <barbetto80@hotmail.com>
Date: Sun, 01 Feb 2004 10:48:38 +0000
To: www-svg@w3.org
Message-ID: <BAY9-F42uPDVniSnRMW000280e5@hotmail.com>

from Andreoli Carlo,
here there is a little tip to calculate the exact length of a text with 
Java/ECMAscript:

.......
newText=svgDocument.createElement("text");
newText.setAttribute("x",100);
newText.setAttribute("y",50);
valore=svgDocument.createTextNode("ciao");
newText.appendChild(valore);
long=newText.getEndPositionOfChar(newText.getNumberOfChars()-1);
longX=long.x;
........

in longX we will have the exact length of the text put in newText object.
Hope this will help someone :)

_________________________________________________________________
Filtri antispamming e antivirus per la tua casella di posta 
http://www.msn.it/msn/hotmail
Received on Monday, 2 February 2004 03:31:58 GMT

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