@@ -957,7 +957,7 @@ Logical Heights and Inter-line Spacing</h2>
957957 The [=block-axis=] sizing of a [=line box=]
958958 depends on the sizes and [[#alignment|alignment]] of its [=inline-level=] contents.
959959 This sizing is controlled by
960- the 'line-height' , 'text-box-edge' , 'text-box-trim' , and 'inline-sizing ' properties.
960+ the 'line-height' and 'line-fit-edge ' properties.
961961
962962<h3 id="line-height-property">
963963Line Spacing: the 'line-height' property</h3>
@@ -1035,7 +1035,7 @@ Line Spacing: the 'line-height' property</h3>
10351035 See also <a href="https://github.com/w3c/csswg-drafts/issues/3118">Issue 3118</a>
10361036 and <a href="https://github.com/w3c/csswg-drafts/issues/2165">Issue 2165</a> .
10371037
1038- Note: When 'text-box -edge' is ''text-box -edge/leading'' ,
1038+ Note: When 'line-fit -edge' is ''line-fit -edge/leading'' ,
10391039 the margins, borders, and padding of [=inline boxes=]
10401040 do not affect the line box’s height calculation.
10411041 However, they are still rendered around these boxes.
@@ -1045,11 +1045,11 @@ Line Spacing: the 'line-height' property</h3>
10451045 potentially obscuring earlier content.
10461046
10471047<h3 id="text-edges">
1048- Inline Box Edge Metrics: the 'text-box -edge' property</h3>
1048+ Text Edge Metrics: the 'line-fit -edge' property</h3>
10491049
10501050 <pre class="propdef">
1051- Name : text-box -edge
1052- Value : leading | [ text | cap | ex | ideographic | ideographic-ink ] [ text | alphabetic | ideographic | ideographic-ink ]?
1051+ Name : line-fit -edge
1052+ Value : leading | << text-edge>>
10531053 Initial : leading
10541054 Applies to : [=inline boxes=]
10551055 Inherited : yes
@@ -1062,37 +1062,35 @@ Inline Box Edge Metrics: the 'text-box-edge' property</h3>
10621062 and might change significantly
10631063 as design critiques and use cases are registered
10641064 and various details and interactions with other properties are worked out.
1065- <strong> Do not implement (yet).</strong>
1065+ <strong> Do not ship (yet).</strong>
10661066
10671067 [=Inline boxes=] , whose primary purpose is to contain text,
10681068 are sized in the [=block axis=] based on their font metrics.
1069- The 'text-box-edge' property controls which metrics are used.
1070-
1071- The chosen metrics are used as the basis
1069+ The 'line-fit-edge' property controls which metrics are used.
1070+ These chosen metrics are used as the basis
10721071 for the [=layout bounds=] of the [=inline box=]
1073- (if it is not the [=root inline box=] ).
1074- The 'text-box-trim' property can be used in conjunction
1075- to match the [=content edges=] to these same metrics.
1072+ (if it is not the [=root inline box=] );
1073+ and also, by default, are the metrics used for 'text-box-trim' .
1074+
1075+ The <dfn><<text-edge>></dfn> value,
1076+ which identifies specific font metrics,
1077+ expands to
1078+
1079+ <pre class=prod>
1080+ <<text-edge>> = [ text | cap | ex | ideographic | ideographic-ink ] [ text | alphabetic | ideographic | ideographic-ink ]?
1081+ </pre>
10761082
10771083 The first value specifies the text [=over=] edge;
10781084 the second value specifies the text [=under=] edge.
10791085 If only one value is specified,
10801086 both edges are assigned that same keyword if possible;
1081- else ''text-box- edge/text'' is assumed as the missing value.
1087+ else ''<< text-edge>> /text'' is assumed as the missing value.
10821088
10831089 ISSUE(5236): Do we need [=longhands=] or is this shorthand enough?
10841090
1085- Note: The ''text-box-edge/leading'' and ''text-box-edge/text'' values
1086- rely on the font [=ascent=] and [=descent=] to make sure the text fits.
1087- Other values are more likely to result in overlap or overflow
1088- caused by ascents above the specified metrics
1089- (such as for diacritics),
1090- so authors using these values need to be careful
1091- to provide sufficient spacing for the text.
1092-
10931091 Values have the following meanings:
10941092
1095- <dl dfn-for="text-box -edge" dfn-type=value>
1093+ <dl dfn-for="line-fit -edge,<<text-edge> > " dfn-type=value>
10961094 <dt> <dfn>leading</dfn>
10971095 <dd>
10981096 Use the [=ascent=] /[=descent=] plus any positive [=half-leading=] .
@@ -1124,32 +1122,36 @@ Inline Box Edge Metrics: the 'text-box-edge' property</h3>
11241122 Use the [=alphabetic baseline=] .
11251123 </dl>
11261124
1127- Unless 'text-box-edge' is ''text-box-edge/leading'' --
1125+ ISSUE(8067): Is ''line-fit-edge/text'' a reasonable name for the ascent/descent metrics,
1126+ or can we think of something better?
1127+ Ditto ''line-fit-edge/leading'' and the name of the property itself.
1128+
1129+ Unless 'line-fit-edge' is ''line-fit-edge/leading'' --
11281130 in which case the box’s own 'line-height' is used to add spacing--
11291131 the box’s margin, padding, and border also contribute
11301132 to the [=layout bounds=] .
11311133
1132- Note: Although only ''text-box -edge/leading'' applies positive [=half-leading=] ,
1133- in order to allow text to be set tightly,
1134- all values apply negative [=half-leading=] ,
1135- see [[#inline-height]] .
1136- Half-leading is applied equally to both sides of the text;
1137- for more precise overlap control authors can use
1138- ''text-box-edge: text'' together with negative [=margins=]
1139- on the affected text .
1134+ Note: The ''line-fit -edge/leading'' and ''line-fit-edge/text'' values
1135+ rely on the font [=ascent=] and [=descent=] to make sure the text fits.
1136+ Other values are more likely to result in overlap or overflow
1137+ caused by ascents above the specified metrics
1138+ (such as for diacritics),
1139+ so authors using these values need to be careful
1140+ to provide sufficient spacing for the text,
1141+ particularly in multi-lingual contexts .
11401142
11411143 <figure>
11421144 <img src="images/text-edge.png" width="480"
11431145 alt="Three different values of the text-box-edge property." >
11441146 <figcaption>
1145- The 'text-box -edge' property, showing values for ''text-box -edge/leading'' ,
1146- ''text-box -edge/cap'' , and ''text-box -edge/ex'' .
1147+ The 'line-fit -edge' property, showing values for ''line-fit -edge/leading'' ,
1148+ ''line-fit -edge/cap'' , and ''line-fit -edge/ex'' .
11471149 The red lines indicate the layout bounds of the inline box.
11481150 </figcaption>
11491151 </figure>
11501152
11511153 <div class="note">
1152- <p> When 'text-box -edge' is ''text-box -edge/leading'' ,
1154+ <p> When 'line-fit -edge' is ''line-fit -edge/leading'' ,
11531155 vertical rhythm can be broken any time there is a change
11541156 in font metrics or vertical alignment within a paragraph.
11551157
@@ -1162,21 +1164,30 @@ Inline Box Edge Metrics: the 'text-box-edge' property</h3>
11621164 to avoid overlap between lines.
11631165 </div>
11641166
1167+ Note: Although only ''line-fit-edge/leading'' applies positive [=half-leading=] ,
1168+ in order to allow text to be set tightly,
1169+ all values apply negative [=half-leading=] ,
1170+ see [[#inline-height]] .
1171+ Half-leading is applied equally to both sides of the text;
1172+ for more precise overlap control authors can use
1173+ ''line-fit-edge: text'' together with negative [=margins=]
1174+ on the affected text.
1175+
11651176<h3 id="inline-height">
11661177Calculating the Logical Height Contributions (“Layout Bounds”) of Inline Boxes</h3>
11671178
11681179 The contribution of an [=inline box=] to the [=logical height=] of its [=line box=] ,
11691180 here referred to as its <dfn>layout bounds</dfn> ,
11701181 is always calculated with respect to its own text metrics,
11711182 as described below,
1172- and is controlled by 'text-box -edge' and 'line-height' .
1183+ and is controlled by 'line-fit -edge' and 'line-height' .
11731184 The sizes and positions of child boxes do not influence
11741185 its [=layout bounds=]
11751186 (nor its own [=logical height=] , for that matter,
11761187 see 'inline-sizing' ).
11771188
11781189 Note: The [=layout bounds=] need not correspond
1179- to the box’s edges.
1190+ to the box’s [=box/ edges=] .
11801191
11811192 To find the [=layout bounds=] of an [=inline box=] ,
11821193 the UA must first align
@@ -1191,13 +1202,13 @@ Calculating the Logical Height Contributions (“Layout Bounds”) of Inline Box
11911202 For each glyph (including the “strut”),
11921203 <var> A</var> represents its ascent above the [=baseline=] ;
11931204 <var> D</var> represents its descent below.
1194- Unless 'text-box -edge' specifies a different metric to use,
1205+ Unless 'line-fit -edge' specifies a different metric to use,
11951206 <var> A</var> refers to the [=ascent metric=]
11961207 (for the given font at its given size)
11971208 and <var> D</var> to the [=descent metric=] ,
11981209 each adjusted to account for the [=dominant baseline=] ’s offset from zero.
11991210 If 'line-height' computes to ''line-height/normal''
1200- and either 'text-box -edge' is ''text-box -edge/leading''
1211+ and either 'line-fit -edge' is ''line-fit -edge/leading''
12011212 or this is the [=root inline box=] ,
12021213 the font’s [=line gap metric=]
12031214 may also be incorporated into <var> A</var> and <var> D</var>
@@ -1225,7 +1236,7 @@ Calculating the Logical Height Contributions (“Layout Bounds”) of Inline Box
12251236 giving an effective ascent above the baseline of
12261237 <var> A′</var> = <var> A</var> + <var> L</var> /2,
12271238 and an effective descent of <var> D′</var> = <var> D</var> + <var> L</var> /2.
1228- However, if 'text-box -edge' is not ''text-box-edge/leading''
1239+ However, if 'line-fit -edge' is not ''text-box-edge/leading''
12291240 and this is not the [=root inline box=] ,
12301241 if the [=half-leading=] is positive, treat it as zero.
12311242 The [=layout bounds=] exactly encloses
@@ -1234,23 +1245,32 @@ Calculating the Logical Height Contributions (“Layout Bounds”) of Inline Box
12341245 Note: <var> L</var> may be negative.
12351246
12361247 Additionally,
1237- when 'text-box -edge' is not ''text-box -edge/leading'' ,
1248+ when 'line-fit -edge' is not ''line-fit -edge/leading'' ,
12381249 the [=layout bounds=] are inflated
12391250 by the sum of the [=margin=] , [=border=] , and [=padding=]
12401251 on each side.
12411252 In order to allow negative [=margin=] values to have an actual effect,
12421253 negative [=margins=] are also accumulated onto
1243- the layout bounds of any descendant [=inline boxes=]
1254+ the [= layout bounds=] of any descendant [=inline boxes=]
12441255 participating in the same [=inline formatting context=] .
12451256
12461257 In Quirks Mode [[!QUIRKS]] ,
12471258 any [=inline box=] [=box fragment|fragment=]
12481259 that has zero borders and padding and
12491260 that does not directly contain text or <a>preserved white space</a> [[!CSS-TEXT-3]]
1250- is ignored when sizing the line box.
1261+ is ignored when sizing the [= line box=] .
12511262
1252- <h3 id="leading-trim">
1253- Half-Leading Control: the 'text-box-trim' property</h3>
1263+ <h2 id="leading-trim">
1264+ Trimming Leading Over/Under Text</h2>
1265+
1266+ ISSUE: This is a draft of a proposal,
1267+ and may change significantly
1268+ as design critiques and use cases are registered.
1269+ Values and property names may be added, dropped, and/or renamed,
1270+ and the overall syntax or behavior may change,
1271+ particularly in response to authoring and robustness considerations
1272+ for handling descendant boxes.
1273+ <strong> Do not ship (yet).</strong>
12541274
12551275 To ensure consistent spacing in the basic case of running text,
12561276 CSS line layout introduces leading both above and below
@@ -1264,13 +1284,13 @@ Half-Leading Control: the 'text-box-trim' property</h3>
12641284 However, all this extra spacing interferes with visual alignment
12651285 and with control over effective (visually-apparent) spacing.
12661286
1267- The 'text-box-trim ' property allows trimming
1287+ The 'text-box' property allows trimming
12681288 this additional space above and below
12691289 the first and last lines of a block,
12701290 allowing more precise control over spacing around the glyphs.
1271- Moreover, by relying on font metrics rather than hard-coded lengths,
1272- it allows content to be resized, rewrapped, and rendered in a variety of fonts
1273- while maintaining that spacing.
1291+ By relying on font metrics rather than hard-coded lengths,
1292+ this feature allows content to be resized, rewrapped, and rendered in a variety of fonts
1293+ while maintaining that precise spacing.
12741294
12751295 <div class="example">
12761296 <!-- Example from Weston Thayer in https://github.com/w3c/csswg-drafts/issues/3240#issuecomment-432375650 -->
@@ -1332,6 +1352,42 @@ Half-Leading Control: the 'text-box-trim' property</h3>
13321352 </figure>
13331353 </div>
13341354
1355+ <h3 id="text-box-shorthand">
1356+ Shorthand for Text Box Trimming: the 'text-box' property</h3>
1357+
1358+ ISSUE: This propdef table is fully expanded to evaluate and adjust the shorthand's value space.
1359+ It simplifies down to <<text-box-trim>> || <<text-box-edge>>
1360+ minus the ''text-box-trim/none'' and ''text-box-edge/auto'' keywords.
1361+
1362+ <pre class="propdef">
1363+ Name : text-box
1364+ Value : normal | [ start | end | both ] || [ text | cap | ex | ideographic | ideographic-ink ] [ text | alphabetic | ideographic | ideographic-ink ]?
1365+ Initial : normal
1366+ Applies to : [=block containers=] and [=inline boxes=]
1367+ Inherited : no
1368+ Percentages : N/A
1369+ Computed value : the specified keyword
1370+ Animation type : discrete
1371+ </pre>
1372+
1373+ This property is a [=shorthand=] for setting the 'text-box-trim' and 'text-box-edge' properties
1374+ in a single declaration.
1375+
1376+ If the single keyword ''text-box-edge/normal'' is specified,
1377+ it sets 'text-box-trim' to ''text-box-trim/none''
1378+ and 'text-box-edge' to ''text-box-edge/auto'' .
1379+ Otherwise, omitting the 'text-box-trim' value sets it to ''text-box-trim/both'' (not the initial value),
1380+ while omitting the 'text-box-edge' value sets it to ''text-box-edge/auto'' (the initial value).
1381+
1382+ ISSUE(8067): We should rename the 'text-box-trim' values to add ''trim-*'' prefixes.
1383+ This would make the shorthand clearer,
1384+ and also make its value space consistent with 'text-spacing' .
1385+
1386+ ISSUE: Add examples.
1387+
1388+ <h3 id="text-box-trim">
1389+ Trimming Over/Under Text: the 'text-box-trim' property</h3>
1390+
13351391 <pre class="propdef">
13361392 Name : text-box-trim
13371393 Value : none | start | end | both
@@ -1343,15 +1399,6 @@ Half-Leading Control: the 'text-box-trim' property</h3>
13431399 Animation type : discrete
13441400 </pre>
13451401
1346- ISSUE: This is an early draft of a proposal,
1347- and is likely to change significantly
1348- as design critiques and use cases are registered.
1349- Values and property names may be added, dropped, and/or renamed,
1350- and the overall syntax or behavior may change,
1351- particularly in response to authoring and robustness considerations
1352- for handling descendant boxes.
1353- <strong> Do not implement (yet).</strong>
1354-
13551402 On [=inline boxes=] ,
13561403 specifies whether to trim the [=content box=]
13571404 to match its corresponding 'text-box-edge' metric.
@@ -1365,12 +1412,6 @@ Half-Leading Control: the 'text-box-trim' property</h3>
13651412 to the corresponding 'text-box-edge' metric
13661413 to better match the box’s [=content edge=] to its text content.
13671414
1368- Note: Content and ink overflowing a box
1369- due to non-initial values of 'text-box-trim'
1370- is handled the same as content that would overflow the box or line box otherwise.
1371-
1372- This property has no effect when 'text-box-edge' is ''text-box-edge/leading'' .
1373-
13741415 Values have the following meanings:
13751416
13761417 <dl dfn-for=text-box-trim dfn-type=value>
@@ -1422,6 +1463,36 @@ Half-Leading Control: the 'text-box-trim' property</h3>
14221463 Note: The [=block-end=] side does not coincide with the [=line-under=] side
14231464 when 'writing-mode' is ''vertical-lr'' .
14241465
1466+ Note: Content and ink overflowing a box
1467+ due to non-initial values of 'text-box-trim'
1468+ is handled the same as content that would overflow the box or line box otherwise.
1469+
1470+ <h3 id="text-box-trim">
1471+ Text Trimming Metrics: the 'text-box-edge' property</h3>
1472+
1473+ <pre class="propdef">
1474+ Name : text-box-edge
1475+ Value : auto | <<text-edge>>
1476+ Initial : auto
1477+ Applies to : [=block containers=] and [=inline boxes=]
1478+ Inherited : no
1479+ Percentages : N/A
1480+ Computed value : the specified keyword
1481+ Animation type : discrete
1482+ </pre>
1483+
1484+ This property specifies the metrics to use for 'text-box-trim' effects.
1485+ Values have the same meanings as for 'line-fit-edge' ;
1486+ the <dfn for=text-box-edge type=value>auto</dfn> keyword
1487+ computes to the value of 'line-fit-edge' ,
1488+ interpreting ''line-fit-edge/leading'' (the [=initial value=] ) as ''line-fit-edge/text'' .
1489+
1490+ Note: This property can be set together with 'text-box-trim'
1491+ in the 'text-box' [=shorthand=] .
1492+ Unlike 'line-fit-edge' , it does not inherit;
1493+ however its [=initial value=] copies from 'line-fit-edge' ,
1494+ which does inherit.
1495+
14251496<h3 id="line-fill">
14261497Inline Box Drawing Height: the 'inline-sizing' property</h3>
14271498
@@ -1437,6 +1508,7 @@ Inline Box Drawing Height: the 'inline-sizing' property</h3>
14371508 </pre>
14381509
14391510 ISSUE(5189): This has a confusing name. We need a new name.
1511+ Alternatively, incorporate this into 'text-box-trim' ?
14401512
14411513 This property specifies how the <a>logical height</a>
14421514 of the <a>content area</a> of an <a>inline box</a>
@@ -2982,6 +3054,11 @@ Changes</h2>
29823054 Changes since the
29833055 <a href="https://www.w3.org/TR/2023/WD-css-inline-3-20230401/">1 April 2023 Working Draft</a> :
29843056 <ul>
3057+ <li> Split 'text-box-edge' into two properties:
3058+ 'text-box-edge' for controlling the 'text-box-trim' edge
3059+ and 'line-fit-edge' for controlling line box sizing.
3060+ (Issues <a href="https://github.com/w3c/csswg-drafts/issues/8829">8829</a>
3061+ and <a href="https://github.com/w3c/csswg-drafts/issues/8696">8696</a> )
29853062 <li> Apply negative [=block-axis=] margins to descendants of [=inline boxes=]
29863063 when calculating their [=layout bounds=]
29873064 so that they can actually have the specified effect.
0 commit comments