Skip to content

Commit 48f638f

Browse files
committed
[css-text-decor-4] [css-text-decor] Initial draft of fill/stroke complete.
1 parent 1fa31ff commit 48f638f

File tree

1 file changed

+200
-23
lines changed

1 file changed

+200
-23
lines changed

css-text-decor-4/Overview.bs

Lines changed: 200 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ TR: http://www.w3.org/TR/css-text-decor-4/
1212
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
1313
Editor: Koji Ishii, Invited Expert, kojiishi@gluesoft.co.jp
1414
Abstract: This module contains the features of CSS relating to text decoration, such as underlines, text shadows, and emphasis marks.
15-
Link Defaults: css-color-3 (property) color
15+
Link Defaults: css-color-3 (property) color, css-break-3 (dfn) fragment
16+
Ignored Terms: svg shape, svg shapes, invalid, repeatable list, simple list, valid image
1617
</pre>
1718

1819
Issue: This is just a place to keep ideas at the moment.
@@ -24,18 +25,10 @@ It has no status at W3C and has not yet been discussed by the CSSWG.
2425

2526
<ul>
2627
<li>text-shadow with spread
27-
<li>fill/stroke on text
2828
<li>a text-decoration-offset property
2929
<li>a text-line-width property
3030
</ul>
3131

32-
fill/stroke {#fill-stroke}
33-
-----------
34-
35-
* turn fill/stroke into shorthands, add fill-color/stroke-color. SVGWG says this is probably okay; only problem is if people style with real properties and put, for example, stroke-width before stroke. Who does that? Nobody, that's who.
36-
* Need to know what element originates the coordinate space. Idea: add a fill-originator:yes/no property, which defines the element that give the coordinate space for the fill/stroke. SVG paint servers carry around their own originator information in *Units attributes, but maybe SVGWG can add a new value that makes them pay attention to the CSS originator. Most of the time you won't set this property; the shorthand will do it automatically for you.
37-
* Need to expand on the box-decoration-break model. "box decorations" is a term covering all of them: need longhands for background-break, fill-break, border-break, stroke-break. (The current "slice" value isn't what SVG does.)
38-
3932

4033
<!--
4134
████████ ████ ██ ██
@@ -47,15 +40,17 @@ fill/stroke {#fill-stroke}
4740
██ ████ ████████ ████████
4841
-->
4942

50-
Text Fills {#text-fill}
51-
=======================
43+
Text Fills {#text-fills}
44+
========================
5245

5346
A <dfn>text fill</dfn> paints within the glyph outlines of the box’s text.
5447
Similar to backgrounds [[CSS3BG]], <a>text fills</a> can be a solid color ('fill-color') and/or an image pattern ('fill-image' etc.).
5548

5649
Advisement: It is strongly recommended to use the 'fill' shorthand when setting <a>text fills</a>.
5750
The individual longhands should only be used when it's needed to alter one individual aspect.
5851

52+
Issue: Add a <css>box-break</css> property that is a shorthand for 'box-decoration-break', 'fill-break', and 'stroke-break'?
53+
5954
## Fill Color: the 'fill-color' property ## {#fill-color}
6055

6156
<pre class="propdef">
@@ -70,6 +65,23 @@ Text Fills {#text-fill}
7065
Animatable: as color
7166
</pre>
7267

68+
This property sets the fill color of an element.
69+
This color is drawn behind any fill images.
70+
71+
Advisement: It's recommended that authors use the 'color' property to set the color of text,
72+
rather than 'fill-color'.
73+
74+
Unlike 'background-color',
75+
the fill color must only be drawn if the final layer of 'fill-image'
76+
is <css>none</css> or an <a>invalid image</a>.
77+
If it's a <a>valid image</a>,
78+
the fill color must not be drawn.
79+
80+
Note: This is required to match the legacy behavior of SVG's 'fill' property,
81+
which built in a "fallback color" to the single-layer image syntax.
82+
In CSS this is better achieved with the ''image()'' function,
83+
which makes fallback explicit.
84+
7385
## Fill Image Sources: the 'fill-image' property ## {#fill-image}
7486

7587
<pre class="propdef">
@@ -84,6 +96,10 @@ Text Fills {#text-fill}
8496
Animatable: as repeatable list of images
8597
</pre>
8698

99+
This property sets the fill images of an element.
100+
Values are interpreted identically to 'background-image',
101+
mutatis mutandi.
102+
87103
## Fill Positioning Area: the 'fill-origin' property ## {#fill-origin}
88104

89105
<pre class="propdef">
@@ -98,7 +114,8 @@ Text Fills {#text-fill}
98114
Animatable: No
99115
</pre>
100116

101-
This property specifies the coordinate system of the <a>text fill</a>.
117+
This property specifies the coordinate system of the <a>text fill</a>,
118+
setting the <dfn export>text fill positioning area</dfn>.
102119
Values have the following meanings:
103120

104121
<dl dfn-for="fill-origin" dfn-type="value">
@@ -113,8 +130,8 @@ Text Fills {#text-fill}
113130
<dd>
114131
Use the box’s own content-box/padding-box/border-box as the <a>text fill positioning area</a>.
115132
For <a>SVG shapes</a>,
116-
''content-box'' and ''padding-box'' are treated as ''fill-box'',
117-
while ''border-box'' is treated as ''stroke-box''.
133+
''fill-origin/content-box'' and ''fill-origin/padding-box'' are treated as ''fill-origin/fill-box'',
134+
while ''fill-origin/border-box'' is treated as ''fill-origin/stroke-box''.
118135

119136
<dt><dfn>fill-box</dfn>
120137
<dd>
@@ -137,6 +154,14 @@ Text Fills {#text-fill}
137154
}
138155
</pre>
139156

157+
The <dfn export>text fill painting area</dfn> is identical to the <a>text fill positioning area</a>.
158+
When painting,
159+
the fill color/images are intersected with the glyph areas of the affected text,
160+
or the fill geometry of the affected <a>SVG shape</a>.
161+
162+
Issue: SVG paint servers carry around their own originator information in *Units attributes,
163+
but maybe SVGWG can add a new value that makes them pay attention to the CSS originator.
164+
140165
## Fragmented Fills: the 'fill-break' property ## {#fill-break}
141166

142167
<pre class="propdef">
@@ -169,6 +194,63 @@ Text Fills {#text-fill}
169194
Animatable: as color
170195
</pre>
171196

197+
## Tiling Fill Images: the 'fill-repeat' property ## {#fill-repeat}
198+
199+
<pre class='propdef'>
200+
Name: fill-repeat
201+
Value: <<repeat-style>>#
202+
Initial: repeat
203+
Applies to: inline boxes and <a>SVG shapes</a>
204+
Inherited: yes
205+
Percentages: n/a
206+
Media: visual
207+
Computed value: A list, each item consisting of: two keywords, one per dimension
208+
Animatable: no
209+
</pre>
210+
211+
Specifies how text fill images are tiled and they have been sized and positioned.
212+
Values are interpreted identically to 'background-repeat',
213+
mutatis mutandi.
214+
215+
## Positioning Fill Images: the 'fill-position' property ## {#fill-position}
216+
217+
<pre class='propdef'>
218+
Name: fill-position
219+
Value: <<position>>#
220+
Initial: 0% 0%
221+
Applies to: inline boxes and <a>SVG shapes</a>
222+
Inherited: yes
223+
Percentages: n/a
224+
Media: visual
225+
Computed value: A list, each item consisting of: a pair of offsets (horizontal and vertical) from the top left origin each given as a combination of an absolute length and a percentage
226+
Animatable: as <a>repeatable list</a> of <a>simple list</a> of length, percentage, or calc
227+
</pre>
228+
229+
If fill images have been specified,
230+
this property specifies their initial position
231+
(after any resizing)
232+
within their corresponding <a>text fill positioning area</a>.
233+
Values are interpreted identically to 'background-position',
234+
mutatis mutandi.
235+
236+
## Sizing Fill Images: the 'fill-size' property ## {#fill-size}
237+
238+
<pre class='propdef'>
239+
Name: fill-size
240+
Value: <<bg-size>>#
241+
Initial: auto
242+
Applies to: inline boxes and <a>SVG shapes</a>
243+
Inherited: yes
244+
Percentages: n/a
245+
Media: visual
246+
Computed value: as specified, but with lengths made absolute and omitted ''background-size/auto'' keywords filled in
247+
Animatable: as <a>repeatable list</a> of <a>simple list</a> of length, percentage, or calc
248+
</pre>
249+
250+
Specifies the size of the fill images.
251+
Values are interpreted identically to 'background-size',
252+
mutatis mutandi.
253+
172254
## Fill Shorthand: the 'fill' property ## {#fill-shorthand}
173255

174256
<pre class="propdef">
@@ -187,15 +269,26 @@ Text Fills {#text-fill}
187269
'fill-color',
188270
'fill-image',
189271
'fill-repeat',
190-
'fill-attachment',
191272
ETC
192273
in one declaration.
193274
Omitted values are set to their initial value,
194275
except that an omitted 'fill-color' is set to ''transparent'',
195-
and an omitted 'fill-attachment' is set to ''self''.
276+
and an omitted 'fill-origin' is set to ''fill-origin/content-box''.
277+
278+
Issue: What should be the default value for fill-origin when set via this shorthand?
279+
content-box or fill-box?
196280

197281
Issue: See 'stroke' for discussion of SVG's image/color fallback syntax.
198282

283+
## Layering Multiple Fill Images ## {#fill-layering}
284+
285+
The fill of a box can have multiple layers.
286+
The number of layers is determined by the number of comma-separated values for the 'fill-image' property.
287+
A value of ''fill-image/none'' still creates a layer.
288+
289+
List-valued properties interact exactly as for background images,
290+
defined in [[css-backgrounds-3#layering]].
291+
199292
<!--
200293
██████ ████████ ████████ ███████ ██ ██ ████████
201294
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -206,8 +299,8 @@ Text Fills {#text-fill}
206299
██████ ██ ██ ██ ███████ ██ ██ ████████
207300
-->
208301

209-
Text Stroking {#text-stroke}
210-
============================
302+
Text Outlines {#text-outlines}
303+
==============================
211304

212305
A <dfn>text stroke</dfn> draws a border along the glyph outlines of the box’s text.
213306
The resulting area can be filled similar to the <a>text fill</a> area.
@@ -216,6 +309,12 @@ Text Stroking {#text-stroke}
216309
Advisement: It is strongly recommended to use the 'stroke' shorthand when setting <a>text strokes</a>.
217310
The individual longhands should only be used when it's needed to alter one individual aspect.
218311

312+
By default, <a>text strokes</a> are drawn on top of <a>text fills</a>.
313+
In SVG text or <a>SVG shapes</a>,
314+
the drawing order is controlled by the 'paint-order' property.
315+
316+
Issue: Should 'paint-order' apply to non-SVG text too?
317+
219318
Stroke Geometry {#stroke-geometry}
220319
----------------------------------
221320

@@ -233,10 +332,10 @@ Stroke Geometry {#stroke-geometry}
233332
Animatable: as color
234333
</pre>
235334

236-
### Stroke Positioning: the 'stroke-position' property ### {#stroke-position}
335+
### Stroke Positioning: the 'stroke-align' property ### {#stroke-align}
237336

238337
<pre class="propdef">
239-
Name: stroke-position
338+
Name: stroke-align
240339
Value: center | inset | outset
241340
Initial: center
242341
Applies to: inline boxes and <a>SVG shapes</a>
@@ -419,7 +518,8 @@ Stroke Painting {#stroke-paint}
419518
Animatable: No
420519
</pre>
421520

422-
This property specifies the coordinate system of the <a>text stroke</a>.
521+
This property specifies the coordinate system of the <a>text stroke</a>,
522+
setting the <dfn export>text stroke positioning area</dfn>.
423523
Values have the following meanings:
424524

425525
<dl dfn-for="stroke-origin" dfn-type="value">
@@ -433,6 +533,11 @@ Stroke Painting {#stroke-paint}
433533
Use the box’s own content-box as the <a>text stroke positioning area</a>.
434534
</dl>
435535

536+
The <dfn export>text stroke painting area</dfn> is identical to the <a>text stroke positioning area</a>.
537+
When painting,
538+
the stroke color/images are intersected with the stroked outlines of the affected text,
539+
or the stroke geometry of the affected <a>SVG shape</a>.
540+
436541
### Fragmented Strokes: the 'stroke-break' property ### {#stroke-break}
437542

438543
<pre class="propdef">
@@ -465,6 +570,63 @@ Stroke Painting {#stroke-paint}
465570
Animatable: as color
466571
</pre>
467572

573+
### Tiling Stroke Images: the 'stroke-repeat' property ### {#stroke-repeat}
574+
575+
<pre class='propdef'>
576+
Name: stroke-repeat
577+
Value: <<repeat-style>>#
578+
Initial: repeat
579+
Applies to: inline boxes and <a>SVG shapes</a>
580+
Inherited: yes
581+
Percentages: n/a
582+
Media: visual
583+
Computed value: A list, each item consisting of: two keywords, one per dimension
584+
Animatable: no
585+
</pre>
586+
587+
Specifies how stroke fill images are tiled and they have been sized and positioned.
588+
Values are interpreted identically to 'background-repeat',
589+
mutatis mutandi.
590+
591+
### Positioning Stroke Images: the 'stroke-position' property ### {#stroke-position}
592+
593+
<pre class='propdef'>
594+
Name: stroke-position
595+
Value: <<position>>#
596+
Initial: 0% 0%
597+
Applies to: inline boxes and <a>SVG shapes</a>
598+
Inherited: yes
599+
Percentages: n/a
600+
Media: visual
601+
Computed value: A list, each item consisting of: a pair of offsets (horizontal and vertical) from the top left origin each given as a combination of an absolute length and a percentage
602+
Animatable: as <a>repeatable list</a> of <a>simple list</a> of length, percentage, or calc
603+
</pre>
604+
605+
If stroke images have been specified,
606+
this property specifies their initial position
607+
(after any resizing)
608+
within their corresponding <a>text stroke positioning area</a>.
609+
Values are interpreted identically to 'background-position',
610+
mutatis mutandi.
611+
612+
### Sizing Stroke Images: the 'stroke-size' property ### {#stroke-size}
613+
614+
<pre class='propdef'>
615+
Name: stroke-size
616+
Value: <<bg-size>>#
617+
Initial: auto
618+
Applies to: inline boxes and <a>SVG shapes</a>
619+
Inherited: yes
620+
Percentages: n/a
621+
Media: visual
622+
Computed value: as specified, but with lengths made absolute and omitted ''background-size/auto'' keywords filled in
623+
Animatable: as <a>repeatable list</a> of <a>simple list</a> of length, percentage, or calc
624+
</pre>
625+
626+
Specifies the size of the stroke images.
627+
Values are interpreted identically to 'background-size',
628+
mutatis mutandi.
629+
468630
### Stroke Shorthand: the 'stroke' property ### {#stroke-shorthand}
469631

470632
<pre class="propdef">
@@ -493,12 +655,22 @@ Stroke Painting {#stroke-paint}
493655
'stroke-color',
494656
'stroke-image',
495657
'stroke-repeat',
496-
'stroke-attachment',
497658
ETC
498659
in one declaration.
499660
Omitted values are set to their initial value,
500661
except that an omitted 'stroke-color' is set to ''transparent'',
501-
and an omitted 'stroke-attachment' is set to ''self''.
662+
and an omitted 'stroke-origin' is set to ''stroke-origin/content-box''.
663+
664+
Issue: See issue in 'fill' about the value that 'fill-origin' gets reset to.
665+
666+
## Layering Multiple Stroke Images ## {#stroke-layering}
667+
668+
The stroke of a box can have multiple layers.
669+
The number of layers is determined by the number of comma-separated values for the 'stroke-image' property.
670+
A value of ''stroke-image/none'' still creates a layer.
671+
672+
List-valued properties interact exactly as for background images,
673+
defined in [[css-backgrounds-3#layering]].
502674

503675

504676

@@ -979,3 +1151,8 @@ Some notes from Koji :
9791151
110C1 KAITHI DOUBLE DANDA Po STerm
9801152

9811153
-->
1154+
1155+
Privacy and Security Considerations {#priv-sec}
1156+
===============================================
1157+
1158+
This specification introduces no new privacy or security considerations.

0 commit comments

Comments
 (0)