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

Re: Text measurement

From: Jean-Philippe Braun <eon@patapon.info>
Date: Tue, 23 Mar 2004 16:09:06 +0100 (CET)
Message-ID: <59289.193.251.54.170.1080054546.squirrel@www.jokx.net>
To: www-svg@w3.org


>
> Hi,
>
> i'm actually having a hard time finding information about how to measure a
> string (or a sentence) once a font has been applied.
>
> that is, what is the length of a sentence (in px or so) once it is written
> in a certain font of a certain weigth ?
>
> thanks for your help
> regards,
>
> Nathalie Dumas,
> Departement ASI,
> INSA ROUEN
>
>
>

Hi,

You can use the getComputedTextLength() method on a text or tspan element
to get the size in px.

-- 
Jean-Philippe Braun
http://svgfr.org
Received on Tuesday, 23 March 2004 10:09:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:55 GMT