W3C home > Mailing lists > Public > public-svg-wg@w3.org > January to March 2009

Re: Bounding box when textArea width or height is set to 'auto'

From: Doug Schepers <schepers@w3.org>
Date: Wed, 28 Jan 2009 22:00:33 -0500
Message-ID: <49811BD1.5050707@w3.org>
To: Niklas Hagelroth <niklas.hagelroth@ikivo.com>
CC: SVG Working Group WG <public-svg-wg@w3.org>

Hi, Niklas-

Niklas Hagelroth wrote (on 1/26/09 8:03 AM):
> Can you please confirm our interpretation around getBBox on a textArea
> element which has width or height set to “auto”, since that is not
> specifically mentioned anywhere in the specification.

Right.  We do describe the general case for the bbox for <textArea>, but
not that specific case.

For text content elements, for the purposes of the bounding box
calculation, each glyph must be treated as a separate graphics element.
The calculations must assume that all glyphs occupy the full glyph cell.
For example, for horizontal text, the calculations must assume that each
glyph extends vertically to the full ascent and descent values for the
font. An exception to this is the 'textArea', which uses that element's
geometry for the bounding box calculation.

We should errata wording along the lines of:

An exception to this is the 'textArea', which uses that element's
geometry for the bounding box calculation.  In the case of a 'textArea'
element with a 'width' or 'height' attribute value of "auto", that
dimension of the bounding box is determined as with other textual elements.

Would this solve your issue?

> Our interpretation is that the actual bounding box of the “layed-out”
> text should be returned, NOT (x, y, infinite, infinite). Do you agree?

Yes, more or less.  There is an open question what role the
'line-increment' attribute plays in this in conjunction with the
<tbreak> element.

For example:

<svg ...>
  <textArea font-size="25" font-family="Georgia" x="0" y="0"
            width="200" height="300" line-increment="1.5">
    This is the first line<tbreak/>and this is the second line.

It seems pretty clear that the bbox height should be around 75px (if I
did my calculations right... you get the picture), but we wanted to make
sure that this is what implementations do.  Is this the case for both
Ikivo and BitFlash?

> Also, all other values than “TOP|LEFT” for text anchor & display align
> will disable rendering when width and height are set to “auto”?

Yes, this seems reasonable, and worthy of another errata.

Thanks for pointing out all these ambiguities.  We should issue errata
on all these points.

[1] http://www.w3.org/TR/SVGTiny12/coords.html#BoundingBox

-Doug Schepers
W3C Team Contact, SVG and WebApps WGs
Received on Thursday, 29 January 2009 03:00:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:29:41 UTC