@@ -9,14 +9,11 @@ use crate::foundations::{
99use crate :: introspection:: Locatable ;
1010use crate :: layout:: { BlockElem , Size } ;
1111
12- /// Provides access to the current outer container's (or page's, if none)
13- /// dimensions (width and height).
12+ /// 外側のコンテナ(存在しなければページ)の次元(幅と高さ)へのアクセスを提供します。
1413///
15- /// Accepts a function that receives a single parameter, which is a dictionary
16- /// with keys `width` and `height`, both of type [`length`]. The function is
17- /// provided [context], meaning you don't need to use it in combination with the
18- /// `context` keyword. This is why [`measure`] can be called in the example
19- /// below.
14+ /// `width`と`height`という[`length`]型のキーを持つ辞書を単一の引数として受け取る関数を受け付けます。
15+ /// 関数には[context]が渡されるため、`context`キーワードと組み合わせて使用する必要はありません。
16+ /// これが以下の例で[`measure`]が呼び出せる理由です。
2017///
2118/// ```example
2219/// #let text = lorem(30)
@@ -30,18 +27,14 @@ use crate::layout::{BlockElem, Size};
3027/// ])
3128/// ```
3229///
33- /// Note that the `layout` function forces its contents into a [block]-level
34- /// container, so placement relative to the page or pagebreaks are not possible
35- /// within it.
30+ /// `layout`関数はコンテンツに[ブロック]($block)レベルのコンテナであることを強制するため、その内部でページを基準とした配置やページ区切りはできないことを注意します。
3631///
37- /// If the `layout` call is placed inside a box with a width of `{800pt}` and a
38- /// height of `{400pt}`, then the specified function will be given the argument
39- /// `{(width: 800pt, height: 400pt)}`. If it is placed directly into the page, it
40- /// receives the page's dimensions minus its margins. This is mostly useful in
41- /// combination with [measurement]($measure).
32+ /// 例えば、幅が`{800pt}`で高さが`{400pt}`のボックスの中から`layout`が呼び出されたとすると、指定された関数には`{(width: 800pt, height: 400pt)}`という引数が与えられます。
33+ /// ページに直接置かれた場合は、ページの次元からそのマージンを引いたものを受け取ります。
34+ /// これは主に[測定]($measure)と組み合わせるときに便利です。
4235///
43- /// You can also use this function to resolve [` ratio`] to fixed lengths. This
44- /// might come in handy if you're building your own layout abstractions.
36+ /// この関数は、[ ratio]を固定長に変換するためにも利用できます。
37+ /// これは独自のレイアウト抽象化を構築する際に重宝するかもしれません。
4538///
4639/// ```example
4740/// #layout(size => {
@@ -50,20 +43,17 @@ use crate::layout::{BlockElem, Size};
5043/// })
5144/// ```
5245///
53- /// Note that the width or height provided by `layout` will be infinite if the
54- /// corresponding page dimension is set to `{auto}`.
46+ /// `layout`が提供する幅と高さは、対象ページの次元が`{auto}`に設定されていると無限大になりうることを注意します。
5547#[ func]
5648pub fn layout (
5749 span : Span ,
58- /// A function to call with the outer container's size. Its return value is
59- /// displayed in the document.
50+ /// 外側のコンテナの大きさと一緒に呼び出す関数。
51+ /// 戻り値は文書に表示されます。
6052 ///
61- /// The container's size is given as a [dictionary] with the keys `width`
62- /// and `height`.
53+ /// コンテナの大きさは`width`と`height`のキーを持つ[dictionary]として与えられます。
6354 ///
64- /// This function is called once for each time the content returned by
65- /// `layout` appears in the document. This makes it possible to generate
66- /// content that depends on the dimensions of its container.
55+ /// この関数は、`layout` によって返されるコンテンツが文書中に現れるたびに呼び出されます。
56+ /// これによりそのコンテナの次元に依存するコンテンツを生成することが可能になります。
6757 func : Func ,
6858) -> Content {
6959 LayoutElem :: new ( func) . pack ( ) . spanned ( span)
0 commit comments