1. 序論
この~moduleは、 ~CSSによる植字~制御について述べる — それは、[ ~source~textから,行lが折返され, 整形された~textへの転換 ]を制御する,各種~CSS特能である。 ◎ This module describes the typesetting controls of CSS; that is, the features of CSS that control the translation of source text to formatted, line-wrapped text.
この仕様は、 ~level 5 において導入された特能を述べる。 この仕様は、 `css-text-4$r に対する差分~仕様である。 ◎ This specification describes features introduced in Level 5; it is a diff against [css-text-4].
1.1. ~textの収法: `text-fit^p ~prop
`text-fit$p ~propは、 `行内~level$の内容が`行l~box$に収まらない場合に,どう拡縮されるかを述べる。 ◎ The text-fit property describes how inline-level contents are scaled if they do not fit to the line box.
各種~値の意味は: ◎ Values have the following meanings:
- `none@v
- ~UAは、 `行内~level$の内容が`行l~box$に収まるよう拡縮しない。 ◎ The user agent doesn’t scale inline-level contents to fit to the line box.
- `grow@v
- ~UAは、 `行内~level$の内容が`行l~box$に収まるよう拡大する。 ◎ The user agent scales up inline-level contents to fit to the line box.
- `shrink@v
- ~UAは、 `行内~level$の内容が`行l~box$に収まるよう縮小する。 ◎ The user agent scales down inline-level contents to fit to the line box.
- `consistent@v
- 当の容器~内のすべての行lは,同じ拡縮率で拡縮されるものと指定する。 ◎ Specifies that all lines in the container are scaled with a single scaling factor.\
- `none$v が指定された場合、 この~keywordの効果は無い。 ◎ This keyword has no effect if none is specified.\
- [ `consistent$v, `per-line$v, `per-line-all$v ]いずれも指定されなかった場合、 `consistent^v が指定されたものと見做される。 ◎ If none of consistent, per-line, or per-line-all are specified, consistent is assumed.
- `line@v
- 各~行lは、 自前の拡縮率で拡縮されるものと指定する。 ただし、[ 当の塊を成す最後の行l, 強制d分断で終端する行l ]は拡縮されない。 ◎ Specifies that each line is scaled with its own scaling factor. However, the last line of the block and lines that end in a forced break are not scaled.\
- `none$v が指定された場合、 この~keywordの効果は無い。 ◎ This keyword has no effect if none is specified.
- `line-all@v
- 各~行lは、 自前の拡縮率で拡縮されるものと指定する — [ 当の塊を成す最後の行l, 強制d分断で終端する行l ]も含めて。 ◎ Specifies that each line is scaled with its own scaling factor, including the last line of the block and lines that end in a forced break.\
- `none$v が指定された場合、 この~keywordの効果は無い。 ◎ This keyword has no effect if none is specified.
- `percentage$t
-
拡縮率の上下限を指定する:
- `grow$v が指定された場合、 所与の値が 100% 以上ならば,それが最大な拡縮率になる。
- `shrink$v が指定された場合、 所与の値が 0% 以上 100% 以下ならば,それが最小な拡縮率になる。
- 他の場合/この成分は省略された場合、 拡縮率に対する上下限は無い。
この~propは、 `行内~level$の内容が`行l~box$の行内~sizeを正確に埋めるようにする機能性を供する。 `text-align$p ~propの `justify@~CSSTEXT#valdef-text-align-justify$v は, 文字↔間の間隔法を調整することにより これを達成するが、 それとは違って,この~propは~font~sizeを拡縮する。 ◎ This property provides a functionality to make inline-level contents exactly fill the inline size of the line box. Unlike justify of the text-align property, which achieves this by adjusting spacing between characters, this property scales the font size.
[ `grow$v / `shrink$v ]が指定されたときは、 まず,`行l~box$ごとに`行l拡縮率$が算出される。 `consistent$v が適用される場合、 すべての`行l~box$は,それらに算出された`行l拡縮率$のうち【 1 からの差が?】最~小なそれにより拡縮される。 他の場合、 各`行l~box$は,自前の`行l拡縮率$により拡縮される。 ◎ When grow or shrink is specified, a line scaling factor is computed for each line box. If consistent applies, all line boxes are scaled by the smallest computed line scaling factor. Otherwise, each line box is scaled by its own line scaling factor.
この~propは、 `font-size$p の`算出d値$には影響しない — したがって、 他の~propにおける `font-size^p に相対的な `length$t 値にも影響しない。 例えば, `line-height$p や `letter-spacing$p 用の単位 `em^u を伴う値は、 この拡縮により影響されない。 ◎ This property does not affect the font-size computed value, and thus does not affect font-size-relative <length> values of other properties. For example, "line-height: 1.5em" and "letter-spacing: 0.1em" are not affected by this scaling.
当の~textの `font-size$p の`使用~値$は、 その`算出d値$に`行l拡縮率$を乗算した結果になる。 ◎ The used value of the text font-size is its computed value multiplied by the line scaling factor.
`行l~box$ %~box の`塊~size$は、 この拡縮により変化し得る — その結果, %~box の`塊-軸$における位置も変化し得る。 %~box の`行内~size$を %~box の`塊-軸$における位置に応じて変化させる特能 ( `float$p や `initial-letter$p など) が作動中である場合、 当の塊~用の拡縮は不能化される。 ◎ Scaling can change the block size of a line box, which can in turn change its position along the block-axis. If any feature is active that would cause the inline size of the line box to change based on its block-axis position (such as float or initial-letter), scaling is disabled for the block.
塊~容器の`行内~size$が表示域の~sizeに依存する場合、 その見かけ上の`行内~size$は, 利用者が~pageの~zoom~levelを変更しても変化しないことがある。 その事例では、 この特能で収められた~textの【見かけ上の】~sizeは, ~zoom~levelが変化しても まったく変化しなくなることがある 【拡縮率が`~zoom~levelに応じて変化するので@~CSSissue/12886#issuecomment-3573573251$】。 この課題をどう処するかに関する合意は,まだ無い。 `12886$issue を見よ。 ◎ If the inline size of a block container depends on the size of the viewport, its apparent inline size may not change even if the user changes the page zoom level. In that case, if text is fitted with this feature, the text size may not change at all even though the zoom level has changed. There is no agreement yet on how to deal with this issue. See csswg#12886.
1.1.1. 行l拡縮率の算出-法
`行l~box$の内容を成す各部のうち,この~propにより拡縮され得るものは、 `拡縮-可能な各部@ と呼ばれ,次に挙げるものを含む: ◎ The parts of the line box’s contents that can be scaled by this property are called scalable parts. These include:
- ~text — `行内~box$内の~textを含むが,末尾の空白は除外される。 ◎ Text, including text in inline boxes, but excluding trailing white space.
-
間隔法のうち,その`行内~size$が `font-size$p の使用~値に比例するもの — 例 ⇒# 百分率に基づく `letter-spacing$p や `word-spacing$p / `text-autospace$p ◎ Spacing whose inline size is proportional to the font-size used value. E.g. percentage-based letter-spacing or word-spacing, and text-autospace.
注記: 次に挙げるものは、 `拡縮-可能な各部$にならない:
- `text-indent$p や `line-padding$p による間隔法
- 百分率に基づかない `letter-spacing$p や `word-spacing$p による間隔法
- `不可分な行内$
- 行内~boxの`行内-軸$における[ `padding$p, `border$p, `margin$p ]
`行l拡縮率@ は、[ `行内~level$の内容が`行l~box$の`行内~size$に正確に収まるようにする ]ために[ 行lを成す`拡縮-可能な各部$を拡縮する必要がある比率 ]である。 ◎ A line scaling factor is the ratio by which the scalable parts of a line must be scaled in order to make its inline-level content exactly fit the line box’s inline size.
`行l拡縮率$は、[ %A ~EQ 当の`行l~box$内の`拡縮-可能な各部$の`行内~size$の合計 ]と[ %B ~EQ 当の`行l~box$を占める残りの空間(末尾の空白も含む) ]から算出される (内容が`行l~box$を~overflowする場合、 %B は負になる)。 ◎ A line scaling factor is computed from: • The total inline size of the scalable parts in the line. • The remaining space in the line box, including any trailing whitespace (which may be negative if the content overflows the line box).
`percentage$t が指定された場合、 それは,`行l拡縮率$を切詰める。 ◎ If a <percentage> is specified, it clamps the line scaling factor.
注記: `行l拡縮率$用の単純な計算は、 ( %A ~PLUS %B ) ~DIV %A になろう。 しかしながら、 `外見的~sizing@~CSSFONT#font-optical-sizing-def$に因り, ~textの`行内~size$と `font-size$p は完璧には比例しないかもしれない。 適度な`行l拡縮率$を決定するための正確な~methodは、 実装に委ねられる。 ◎ A simple calculation for the line scaling factor would be (A + B) / A, where A is the total inline size of scalable parts and B is the remaining space. However, due to optical sizing, the inline size of text might not be perfectly proportional to its font-size. The exact method for determining a reasonable line scaling factor is up to the implementation.
`拡縮-可能な各部$を伴わない`行l~box$用の`行l拡縮率$は 1 になるとする。 ◎ The line scaling factor for a line box with no scalable parts is 1.
付録 A. 各種~text演算の処理~順序
-
`~textの収法@#text-fit-property$は、 ~textの折返ngより後, ~text両端揃えより前 に適用される。 ◎ text fitting is applied after text wrapping and before text justification.
- `~fontや~glyphの選定と位置決め@~CSSFONT$ `CSS-FONTS-3$r は、 再び行われ得る。 ◎ font/glyph selection and positioning [CSS-FONTS-3] may be done again
- 次に挙げるものによる効果は更新され得る ⇒# `letter-spacing$p, `word-spacing$p, `text-spacing$p ◎ letter-spacing, word-spacing, and text-spacing may be updated.
謝辞
`text-fit$p ~propは、 次に挙げる方々による労なくしては, ここになかった ⇒ `Kent Tamura^en, `Roman Komarov^en ◎ The text-fit property would not be here without the efforts of Kent Tamura and Roman Komarov.
変更点
- ~level 4 からの追加 ◎ Additions Since Level 4
- ~level 5 における新たな特能 ◎ New features in Level 5:
- `text-fit$p ~propを追加した。 ◎ Added the text-fit property.