W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: [css3-text] Should text-shadow have 'spread'?

From: Brad Kemper <brad.kemper@gmail.com>
Date: Mon, 30 Jan 2012 12:44:21 -0800
Message-Id: <780A19A4-D495-46DB-8E5D-772BA0FA77F8@gmail.com>
Cc: Brian Manthos <brianman@microsoft.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, "www-style@w3.org list" <www-style@w3.org>
To: Simon Fraser <smfr@me.com>
On Jan 30, 2012, at 12:09 PM, Simon Fraser <smfr@me.com> wrote:

> On Jan 30, 2012, at 4:34 PM, Brian Manthos wrote:
> 
>> Brad:
>>> Simon:
>>>> If we're going to define spread behavior for text-shadow based on
>>> stroking, I think we should do the same for box-shadow, and specify the
>>> miter behavior.
>>> 
>>> I thought we more or less did so, describing how the 90deg corners
>>> remain sharp before blurring takes place.
>> 
>> I was under the same impression.
>> 
>> Simon, can you elaborate?
> 
> The spec doesn't define spread in terms of stroking:
> <http://dev.w3.org/csswg/css3-background/#the-box-shadow>
> 
> It talks about a thresholding approach, which would be much more computationally intensive, and does
> not exactly how spread reacts to different corner radii. I think, if we want to define spread for text-shadow
> in terms of stroking, that Backgrounds and Borders should do the same thing.

It does say this: 

>> The UA may approximate this operation by taking an outward outset of the specified amount normal to the original shadow perimeter.

Is not the stroke defined by outward offsetting by half the stroke weight to get the stroke's outer shape, and by inward offsetting by half the stroke weight to get the stroke's inner shape? Or, put another way, if you stroke a path by W, you end up with the outer perimeter of the stroke being a path .5W offset from the original path, and the inner perimeter of the stroke being a path that is -.5 offset from the original path. 

It also says this:

>>For corners with a zero border-radius, however, the corner must remain sharp—the operation is equivalent to scaling the shadow shape.

So, in terms of how the shape reacts to different border radii, it is a simple offset (or the allowed approximation of an offset), except for 'border-radius:0' for that corner, where you are to keep the corner sharp. 

I think it is fine for the specs to refer to offsetting the path to get the spread shape, and then you can just use your existing text stroking code to get that shape. The text-shadow spec could even add that it is OK to do so, with a note that it might not turn out perfect when the font is weird and has paths that cross over themselves, causing the inner part of the stroke to appear on the outside (but allowed anyway, since that font will be ugly regardless).
Received on Monday, 30 January 2012 20:45:05 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:49 GMT