From ab6e4c46a7ecce3c4a15f5e94c6f34b5b0877e9a Mon Sep 17 00:00:00 2001 From: gomazarashi Date: Sun, 18 May 2025 22:44:46 +0900 Subject: [PATCH 1/5] =?UTF-8?q?image=E3=81=AE=E8=BF=BD=E5=8A=A0=E7=BF=BB?= =?UTF-8?q?=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../typst-library/src/visualize/image/mod.rs | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 04b1aabd31..2e6e352fa3 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -45,11 +45,11 @@ use crate::text::LocalName; /// ``` #[elem(scope, Show, LocalName, Figurable)] pub struct ImageElem { - /// A [path]($syntax/#paths) to an image file or raw bytes making up an - /// image in one of the supported [formats]($image.format). + /// 画像ファイルへの[path]($syntax/#paths)、 + /// あるいはサポートされている[format]($image.format)のいずれかで構成された画像を表す生のバイト列。 /// - /// Bytes can be used to specify raw pixel data in a row-major, - /// left-to-right, top-to-bottom format. + /// バイト列は、行優先(row-major)かつ左から右、 + /// 上から下に並んだ生のピクセルデータを指定するために使用できます。 /// /// ```example /// #let original = read("diagram.svg") @@ -71,26 +71,26 @@ pub struct ImageElem { /// 画像のフォーマット。 /// - /// By default, the format is detected automatically. Typically, you thus - /// only need to specify this when providing raw bytes as the - /// [`source`]($image.source) (even then, Typst will try to figure out the - /// format automatically, but that's not always possible). + /// デフォルトでは、フォーマットは自動的に検出されます。 + /// そのため、通常は生のバイト列を[`source`]($image.source) として提供する場合にのみこの指定が必要です + /// (それでもTypstは自動でフォーマットを判別しようとしますが、 + /// 必ずしも成功するとは限りません)。 /// /// 生のピクセルデータと同様にサポートされている拡張子は`{"png"}`、`{"jpg"}`、`{"gif"}`、`{"svg"}`です。 /// [PDFの画像はまだサポートされていません。](https://github.com/typst/typst/issues/145) /// - /// When providing raw pixel data as the `source`, you must specify a - /// dictionary with the following keys as the `format`: - /// - `encoding` ([str]): The encoding of the pixel data. One of: - /// - `{"rgb8"}` (three 8-bit channels: red, green, blue) - /// - `{"rgba8"}` (four 8-bit channels: red, green, blue, alpha) - /// - `{"luma8"}` (one 8-bit channel) - /// - `{"lumaa8"}` (two 8-bit channels: luma and alpha) - /// - `width` ([int]): The pixel width of the image. - /// - `height` ([int]): The pixel height of the image. + /// 生のピクセルデータを`source`として提供する場合、 + /// `format`には次のキーを持つ辞書を指定する必要があります。 + /// - `encoding` ([str]): ピクセルデータのエンコーディング。以下のいずれかを指定します。 + /// - `{"rgb8"}` (3つの8ビットチャンネル: 赤 (red)、緑 (green)、青 (blue)) + /// - `{"rgba8"}` (4つの8ビットチャンネル: 赤 (red)、緑 (green)、青 (blue)、透明度 (alpha)) + /// - `{"luma8"}` (1つの8ビットチャンネル) + /// - `{"lumaa8"}` (2つの8ビットチャンネル: 輝度(luma)と 透明度(alpha)) + /// - `width` ([int]): 画像の幅のピクセル数。 + /// - `height` ([int]): 画像の高さのピクセル数。 /// - /// The pixel width multiplied by the height multiplied by the channel count - /// for the specified encoding must then match the `source` data. + /// 幅のピクセル数、高さのピクセル数、指定したエンコーディングにおけるチャンネル数をかけ合わせたものが + /// `source`のデータと一致しなければなりません。 /// /// ```example /// #image( @@ -136,19 +136,19 @@ pub struct ImageElem { #[default(ImageFit::Cover)] pub fit: ImageFit, - /// A hint to viewers how they should scale the image. + /// ビューアーに対して、画像をどのように拡大縮小すべきかを示すヒント。 /// - /// When set to `{auto}`, the default is left up to the viewer. For PNG - /// export, Typst will default to smooth scaling, like most PDF and SVG - /// viewers. + /// `{auto}`に設定した場合、デフォルトの動作はビューアーに委ねられます。 + /// PNGエクスポートの場合、TypstはほとんどのPDFビューアーやSVGビューアーと同様に、 + /// スムーズな拡大縮小をデフォルトとして設定します。 /// - /// _Note:_ The exact look may differ across PDF viewers. + /// _注意:_ PDFビューアーによっては正確な見た目が異なる場合があります。 pub scaling: Smart, - /// An ICC profile for the image. + /// 画像用のICCプロファイル。 /// - /// ICC profiles define how to interpret the colors in an image. When set - /// to `{auto}`, Typst will try to extract an ICC profile from the image. + /// ICCプロファイルは、画像の色をどのように解釈するかを定義するものです。 + /// `{auto}`に設定した場合、Typstは画像からICCプロファイルを抽出しようとします。 #[parse(match args.named::>>("icc")? { Some(Spanned { v: Smart::Custom(source), span }) => Some(Smart::Custom({ let data = Spanned::new(&source, span).load(engine.world)?; @@ -164,9 +164,9 @@ pub struct ImageElem { #[scope] #[allow(clippy::too_many_arguments)] impl ImageElem { - /// Decode a raster or vector graphic from bytes or a string. + /// バイト列または文字列からラスター画像またはベクター画像をデコードする。 #[func(title = "Decode Image")] - #[deprecated = "`image.decode` is deprecated, directly pass bytes to `image` instead"] + #[deprecated = "`image.decode`は非推奨です。代わりにバイト列を直接`image`に渡してください。"] pub fn decode( span: Span, /// 画像としてデコードするデータ。SVGの場合は文字列です。 @@ -186,7 +186,7 @@ impl ImageElem { /// 与えられた領域に対して、画像をどのように調整するか。 #[named] fit: Option, - /// A hint to viewers how they should scale the image. + /// ビューアーがどのように拡大縮小すべきかを示すヒント。 #[named] scaling: Option>, ) -> StrResult { @@ -451,9 +451,9 @@ cast! { /// The image scaling algorithm a viewer should use. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)] pub enum ImageScaling { - /// Scale with a smoothing algorithm such as bilinear interpolation. + /// バイリニア補間などの平滑化アルゴリズムを用いて拡大縮小します。 Smooth, - /// Scale with nearest neighbor or a similar algorithm to preserve the - /// pixelated look of the image. + /// 最近傍補間などのアルゴリズムで拡大縮小し、 + /// ピクセルで構成された画像の見た目を保ちます。 Pixelated, } From ac0317ea49aba83785e51900f7d794a8bab358f3 Mon Sep 17 00:00:00 2001 From: gomazarashi <60730277+gomazarashi@users.noreply.github.com> Date: Sun, 18 May 2025 22:53:15 +0900 Subject: [PATCH 2/5] Update crates/typst-library/src/visualize/image/mod.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- crates/typst-library/src/visualize/image/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 2e6e352fa3..481fd7b646 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -72,7 +72,7 @@ pub struct ImageElem { /// 画像のフォーマット。 /// /// デフォルトでは、フォーマットは自動的に検出されます。 - /// そのため、通常は生のバイト列を[`source`]($image.source) として提供する場合にのみこの指定が必要です + /// そのため、通常は生のバイト列を[`source`]($image.source)として提供する場合にのみこの指定が必要です /// (それでもTypstは自動でフォーマットを判別しようとしますが、 /// 必ずしも成功するとは限りません)。 /// From dd2911562d8513a02b6396c88e059a5770419536 Mon Sep 17 00:00:00 2001 From: gomazarashi Date: Sun, 18 May 2025 22:55:09 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E5=8D=8A?= =?UTF-8?q?=E8=A7=92=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/typst-library/src/visualize/image/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 481fd7b646..9bf07f9b4b 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -82,10 +82,10 @@ pub struct ImageElem { /// 生のピクセルデータを`source`として提供する場合、 /// `format`には次のキーを持つ辞書を指定する必要があります。 /// - `encoding` ([str]): ピクセルデータのエンコーディング。以下のいずれかを指定します。 - /// - `{"rgb8"}` (3つの8ビットチャンネル: 赤 (red)、緑 (green)、青 (blue)) - /// - `{"rgba8"}` (4つの8ビットチャンネル: 赤 (red)、緑 (green)、青 (blue)、透明度 (alpha)) + /// - `{"rgb8"}` (3つの8ビットチャンネル: 赤(red)、緑(green)、青(blue)) + /// - `{"rgba8"}` (4つの8ビットチャンネル: 赤(red)、緑(green)、青(blue)、透明度(alpha)) /// - `{"luma8"}` (1つの8ビットチャンネル) - /// - `{"lumaa8"}` (2つの8ビットチャンネル: 輝度(luma)と 透明度(alpha)) + /// - `{"lumaa8"}` (2つの8ビットチャンネル: 輝度(luma)と透明度(alpha)) /// - `width` ([int]): 画像の幅のピクセル数。 /// - `height` ([int]): 画像の高さのピクセル数。 /// From 84dd484204f42c0159ec597ae22a33e896854b58 Mon Sep 17 00:00:00 2001 From: gomazarashi <60730277+gomazarashi@users.noreply.github.com> Date: Wed, 21 May 2025 16:22:53 +0900 Subject: [PATCH 4/5] =?UTF-8?q?source=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B?= =?UTF-8?q?=E8=A1=A8=E7=8F=BE=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Shunsuke KIMURA --- crates/typst-library/src/visualize/image/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 9bf07f9b4b..665052c6e8 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -48,8 +48,8 @@ pub struct ImageElem { /// 画像ファイルへの[path]($syntax/#paths)、 /// あるいはサポートされている[format]($image.format)のいずれかで構成された画像を表す生のバイト列。 /// - /// バイト列は、行優先(row-major)かつ左から右、 - /// 上から下に並んだ生のピクセルデータを指定するために使用できます。 + /// バイト列を使う場合は、生のピクセルデータを左から右へ、上から下へと並べた + /// 行優先(row-major)形式で指定します。 /// /// ```example /// #let original = read("diagram.svg") From a32189dcb33c7e21ff0886a8c5c66d33462cb3e3 Mon Sep 17 00:00:00 2001 From: gomazarashi <60730277+gomazarashi@users.noreply.github.com> Date: Wed, 21 May 2025 16:25:31 +0900 Subject: [PATCH 5/5] =?UTF-8?q?source=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B?= =?UTF-8?q?=E8=A1=A8=E7=8F=BE=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Shunsuke KIMURA --- crates/typst-library/src/visualize/image/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 665052c6e8..55d497e5a8 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -46,7 +46,7 @@ use crate::text::LocalName; #[elem(scope, Show, LocalName, Figurable)] pub struct ImageElem { /// 画像ファイルへの[path]($syntax/#paths)、 - /// あるいはサポートされている[format]($image.format)のいずれかで構成された画像を表す生のバイト列。 + /// またはサポートされている[format]($image.format)の画像データの生バイト。 /// /// バイト列を使う場合は、生のピクセルデータを左から右へ、上から下へと並べた /// 行優先(row-major)形式で指定します。