From 0861abf556df4ec63254623ffb048ec1de41fb00 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Sun, 13 Jul 2025 17:51:26 +0900 Subject: [PATCH 1/4] =?UTF-8?q?`/docs/reference/layout/measure`=E3=81=AE?= =?UTF-8?q?=E7=BF=BB=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/typst-library/src/layout/measure.rs | 38 +++++++++------------- website/translation-status.json | 2 +- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/crates/typst-library/src/layout/measure.rs b/crates/typst-library/src/layout/measure.rs index 93c48ad404..9a6ab49697 100644 --- a/crates/typst-library/src/layout/measure.rs +++ b/crates/typst-library/src/layout/measure.rs @@ -7,18 +7,15 @@ use crate::foundations::{dict, func, Content, Context, Dict, Resolve, Smart}; use crate::introspection::{Locator, LocatorLink}; use crate::layout::{Abs, Axes, Length, Region, Size}; -/// Measures the layouted size of content. +/// レイアウトされたコンテンツの測定。 /// -/// The `measure` function lets you determine the layouted size of content. -/// By default an infinite space is assumed, so the measured dimensions may -/// not necessarily match the final dimensions of the content. -/// If you want to measure in the current layout dimensions, you can combine -/// `measure` and [`layout`]. +/// `measure`関数を用いるとレイアウトされたコンテンツの大きさを測定できます。 +/// デフォルトでは無限のスペースが想定されているため、測定された寸法は必ずしもコンテンツの最終的な寸法に一致するとは限りません。 +/// 現在のレイアウトの寸法が測定したい場合は、`measure`と[`layout`]を組み合わせることができます。 /// -/// # Example -/// The same content can have a different size depending on the [context] that -/// it is placed into. In the example below, the `[#content]` is of course -/// bigger when we increase the font size. +/// # 例 +/// 同じコンテンツでも置く場所の[context]によって異なる大きさになることがあります。 +/// 以下の例では、フォントサイズを大きくすると`[#content]`は必然的に大きくなります。 /// /// ```example /// #let content = [Hello!] @@ -27,7 +24,7 @@ use crate::layout::{Abs, Axes, Length, Region, Size}; /// #content /// ``` /// -/// For this reason, you can only measure when context is available. +/// この理由から、測定が可能なのはコンテキストが利用可能な場合に限ります。 /// /// ```example /// #let thing(body) = context { @@ -39,21 +36,18 @@ use crate::layout::{Abs, Axes, Length, Region, Size}; /// #thing[Welcome] /// ``` /// -/// The measure function returns a dictionary with the entries `width` and -/// `height`, both of type [`length`]. +/// measure関数はキーが`width`と`height`で、その値がいずれも[`length`]型の辞書を返します。 #[func(contextual)] pub fn measure( engine: &mut Engine, context: Tracked, span: Span, - /// The width available to layout the content. + /// コンテンツをレイアウトするのに利用可能な幅。 /// - /// Setting this to `{auto}` indicates infinite available width. + /// これを`{auto}`に設定すると無限大の幅が利用可能であると見なされます。 /// - /// Note that using the `width` and `height` parameters of this function is - /// different from measuring a sized [`block`] containing the content. In - /// the following example, the former will get the dimensions of the inner - /// content instead of the dimensions of the block. + /// この関数の`width`および`height`パラメーターを用いることは、コンテンツを有する大きさを持つ[`block`]を測定することと異なることを注意します。 + /// 以下の例では、後者はブロックの寸法ではなく、内側のコンテンツの寸法を取得します。 /// /// ```example /// #context measure(lorem(100), width: 400pt) @@ -63,13 +57,13 @@ pub fn measure( #[named] #[default(Smart::Auto)] width: Smart, - /// The height available to layout the content. + /// コンテンツをレイアウトするのに利用可能な高さ。 /// - /// Setting this to `{auto}` indicates infinite available height. + /// これを`{auto}`に設定すると無限大の高さが利用可能であると見なされます。 #[named] #[default(Smart::Auto)] height: Smart, - /// The content whose size to measure. + /// 大きさを測定するコンテンツ。 content: Content, ) -> SourceResult { // Create a pod region with the available space. diff --git a/website/translation-status.json b/website/translation-status.json index 69bc5be8ad..dad12fe62e 100644 --- a/website/translation-status.json +++ b/website/translation-status.json @@ -114,7 +114,7 @@ "/docs/reference/layout/hide/": "translated", "/docs/reference/layout/layout/": "untranslated", "/docs/reference/layout/length/": "untranslated", - "/docs/reference/layout/measure/": "untranslated", + "/docs/reference/layout/measure/": "translated", "/docs/reference/layout/move/": "untranslated", "/docs/reference/layout/pad/": "translated", "/docs/reference/layout/page/": "untranslated", From bd2c0428e0476ac093dc97c8a35ddfd833eb65e4 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Sat, 19 Jul 2025 22:53:12 +0900 Subject: [PATCH 2/4] Update crates/typst-library/src/layout/measure.rs Co-authored-by: Shunsuke KIMURA --- crates/typst-library/src/layout/measure.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/layout/measure.rs b/crates/typst-library/src/layout/measure.rs index 9a6ab49697..90e8fd8829 100644 --- a/crates/typst-library/src/layout/measure.rs +++ b/crates/typst-library/src/layout/measure.rs @@ -47,7 +47,7 @@ pub fn measure( /// これを`{auto}`に設定すると無限大の幅が利用可能であると見なされます。 /// /// この関数の`width`および`height`パラメーターを用いることは、コンテンツを有する大きさを持つ[`block`]を測定することと異なることを注意します。 - /// 以下の例では、後者はブロックの寸法ではなく、内側のコンテンツの寸法を取得します。 + /// 以下の例では、前者はブロックの寸法ではなく、内側のコンテンツの寸法を取得します。 /// /// ```example /// #context measure(lorem(100), width: 400pt) From caf7c69e8f13c2113b18245ccf1fc348e7026b08 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Wed, 23 Jul 2025 06:08:05 +0900 Subject: [PATCH 3/4] Update crates/typst-library/src/layout/measure.rs Co-authored-by: 3w36zj6 <52315048+3w36zj6@users.noreply.github.com> --- crates/typst-library/src/layout/measure.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/layout/measure.rs b/crates/typst-library/src/layout/measure.rs index 90e8fd8829..5059aafb22 100644 --- a/crates/typst-library/src/layout/measure.rs +++ b/crates/typst-library/src/layout/measure.rs @@ -46,7 +46,7 @@ pub fn measure( /// /// これを`{auto}`に設定すると無限大の幅が利用可能であると見なされます。 /// - /// この関数の`width`および`height`パラメーターを用いることは、コンテンツを有する大きさを持つ[`block`]を測定することと異なることを注意します。 + /// この関数の`width`および`height`パラメーターを用いることは、コンテンツを有する大きさを持つ[`block`]を測定することとは異なることに注意してください。 /// 以下の例では、前者はブロックの寸法ではなく、内側のコンテンツの寸法を取得します。 /// /// ```example From 1e712907105f6f920e54a1e8302802ccfa676b59 Mon Sep 17 00:00:00 2001 From: ultimatile Date: Sun, 27 Jul 2025 13:48:09 +0900 Subject: [PATCH 4/4] Update crates/typst-library/src/layout/measure.rs Co-authored-by: Shunsuke KIMURA --- crates/typst-library/src/layout/measure.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/layout/measure.rs b/crates/typst-library/src/layout/measure.rs index 5059aafb22..7c156a92cd 100644 --- a/crates/typst-library/src/layout/measure.rs +++ b/crates/typst-library/src/layout/measure.rs @@ -46,7 +46,7 @@ pub fn measure( /// /// これを`{auto}`に設定すると無限大の幅が利用可能であると見なされます。 /// - /// この関数の`width`および`height`パラメーターを用いることは、コンテンツを有する大きさを持つ[`block`]を測定することとは異なることに注意してください。 + /// この関数の`width`および`height`パラメーターを用いることは、大きさを持ち、コンテンツを有する[`block`]を測定することとは異なることに注意してください。 /// 以下の例では、前者はブロックの寸法ではなく、内側のコンテンツの寸法を取得します。 /// /// ```example