W3C home > Mailing lists > Public > www-svg@w3.org > December 2011

Re: Text metrics with display:none

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 12 Dec 2011 08:04:25 -0800
Message-Id: <04FB0530-298C-49FB-B589-CC0FA082E0C7@jumis.com>
Cc: David Dailey <ddailey@zoominternet.net>, Cameron McCormack <cam@mcc.id.au>, Brian Birtles <bbirtles@mozilla.com>, www-svg <www-svg@w3.org>
To: Chris Lilley <chris@w3.org>
On Dec 12, 2011, at 6:27 AM, Chris Lilley <chris@w3.org> wrote:

> On Sunday, December 11, 2011, 3:31:41 PM, David wrote:
> 
> DD> Oftentimes I have found myself drawing stuff invisibly first, so
> DD> that I can measure it. Then after knowing how big it will be I position it.
> 
> DD> Centering things relative to one another is difficult in SVG
> DD> (unlike in HTML/CSS), and CSS doesn't seem to help with this issue
> DD> (unless I'm missing something -- and I well may be), so when I
> DD> start finding parts of the spec that tell me I cannot measure
> DD> things unless they are visible, it makes me nervous. I recall a
> DD> similar issue recently with getBBox and leprechaun-nodes. 
> 
> If you want things to be rendered (but invisible) - as opposed to not being in the rendering tree at all, which is what display: none does - then visibility: hidden is what you want.

In HTML it's also position: absolute and top/left offset off screen. It's not an elegant solution but it's been the method for a long time.

It'd be nice to have an elegant solution in the future. These feel like work-arounds for an API that wasn't designed for these use cases.

-Charles
Received on Monday, 12 December 2011 16:05:04 GMT

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