W3C home > Mailing lists > Public > www-svg@w3.org > November 2002

RE: General Text Metrics Requirement

From: Allen Razdow <arazdow@mathsoft.com>
Date: Tue, 19 Nov 2002 14:53:01 -0500
Message-ID: <8D1EA20CE6AB1043956A27D60E468F1C0115B5A9@distrib.mathsoft.com>
To: "'Kanaskie, Kurt A (Kurt)'" <kkanaskie@lucent.com>, "'www-svg@w3.org'" <www-svg@w3.org>

Kurt,

This helps me a lot because

1) it verifies my perception that this is a missing feature

2) it restores my faith that someone is listening!

There are many contexts in which an object's attributes are
determined at "runtime" either because they depent on
local font and screen metrics, or because they come in as parameters
from somewhere, etc.  The ability to format graphics adaptively to
such attributes seems pretty fundamental.

I wonder if there's a fundamental reason that this can't be
done in SVG, or if some aspect of SVG requirments make it outside
the intended scope of SVG?

Anyway, thanks for joining in on this, and offering a workaround.

-Allen

-----Original Message-----
From: Kanaskie, Kurt A (Kurt) [mailto:kkanaskie@lucent.com]
Sent: Tuesday, November 19, 2002 2:44 PM
To: 'www-svg@w3.org'; 'arazdow@mathsoft.com'
Subject: Re: General Text Metrics Requirement


Allen,

I too have been struggling with the inability to calculate string length.
I'm transforming Schema with XSLT to generate SVG and I want to draw a
simple text box. I can draw a bounding box using filters, but that still
doesn't give me the extents of the text box, it just renders it. I need to
know where the end of the text box is so I draw a connector from it to the
next box. 

My strategy is to estimate the length of the string based on the font size,
draw the bounding rectangle and then set the textLength attribute to expand
or shrink the text to fit. Sounds good, but I discovered that textLength is
not supported by Adobe 3.0 Build 76, my defacto plugin. Oh well.

Another option is to use a fixed width font. Can someone identify a fixed
with font-family value? Or where I can find a list of them?

I've attached the boundingBox.svg I found somewhere (apologies to the
original author, I forgot where I got this). I think it might work for your
application, if all you want to do is show the bounding box.

I wonder if the approach filters uses to return a "result" would be a valid
architectural approach to determining the text length?

Hope this helps,
 <<boundingBox.svg>> 
________________________________________________________________
Kurt Kanaskie
Lucent Technologies
kkanaskie@lucent.com
work:	(610) 778-1069
home:	(610) 756-4435
Received on Tuesday, 19 November 2002 14:53:03 GMT

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