@@ -32,13 +32,12 @@ use crate::utils::LazyHash;
3232use crate :: visualize:: Path ;
3333use crate :: World ;
3434
35- /// A raster or vector graphic.
35+ /// ラスターまたはベクター画像。
3636///
37- /// You can wrap the image in a [`figure`] to give it a number and caption.
37+ /// 画像を [`figure`]で囲むことで、番号とキャプションを与えることができます。
3838///
39- /// Like most elements, images are _block-level_ by default and thus do not
40- /// integrate themselves into adjacent paragraphs. To force an image to become
41- /// inline, put it into a [`box`].
39+ /// ほとんどの要素と同様に、画像はデフォルトでは _ブロックレベル_ であるため、隣接する段落に統合されることはありません。
40+ /// 画像を強制的にインラインにするには、[`box`]の中に入れてください。
4241///
4342/// # Example
4443/// ```example
@@ -52,9 +51,9 @@ use crate::World;
5251/// ```
5352#[ elem( scope, Show , LocalName , Figurable ) ]
5453pub struct ImageElem {
55- /// Path to an image file
54+ /// 画像ファイルのパス。
5655 ///
57- /// For more details, see the [Paths section ]($syntax/#paths).
56+ /// より詳細な情報は[パスの章 ]($syntax/#paths)を参照してください。
5857 #[ required]
5958 #[ parse(
6059 let Spanned { v: path, span } =
@@ -72,25 +71,24 @@ pub struct ImageElem {
7271 #[ parse( Readable :: Bytes ( data) ) ]
7372 pub data : Readable ,
7473
75- /// The image's format. Detected automatically by default.
74+ /// 画像のフォーマット。デフォルトでは自動的に検出されます。
7675 ///
77- /// Supported formats are PNG, JPEG, GIF, and SVG. Using a PDF as an image
78- /// is [not currently supported ](https://github.com/typst/typst/issues/145).
76+ /// サポートされている拡張子は PNG, JPEG, GIF, SVGです。
77+ /// [PDFの画像はまだサポートされていません。 ](https://github.com/typst/typst/issues/145)
7978 pub format : Smart < ImageFormat > ,
8079
81- /// The width of the image.
80+ /// 画像の幅。
8281 pub width : Smart < Rel < Length > > ,
8382
84- /// The height of the image.
83+ /// 画像の高さ。
8584 pub height : Sizing ,
8685
87- /// A text describing the image.
86+ /// 画像の説明文。
8887 pub alt : Option < EcoString > ,
8988
90- /// How the image should adjust itself to a given area (the area is defined
91- /// by the `width` and `height` fields). Note that `fit` doesn't visually
92- /// change anything if the area's aspect ratio is the same as the image's
93- /// one.
89+ /// 与えられた領域に対して、画像をどのように調整するか。
90+ /// 領域は `width` や `height` フィールドで定義します。
91+ /// 領域の縦横比が画像の縦横比と同じであれば、`fit` で見た目が変わらないことに注意してください。
9492 ///
9593 /// ```example
9694 /// #set page(width: 300pt, height: 50pt, margin: 10pt)
@@ -104,7 +102,7 @@ pub struct ImageElem {
104102
105103#[ scope]
106104impl ImageElem {
107- /// Decode a raster or vector graphic from bytes or a string.
105+ /// バイトまたは文字列からラスターまたはベクトル図形をデコードします。
108106 ///
109107 /// ```example
110108 /// #let original = read("diagram.svg")
@@ -120,21 +118,21 @@ impl ImageElem {
120118 pub fn decode (
121119 /// The call span of this function.
122120 span : Span ,
123- /// The data to decode as an image. Can be a string for SVGs.
121+ /// 画像としてデコードするデータ。SVG の場合は文字列です。
124122 data : Readable ,
125- /// The image's format. Detected automatically by default.
123+ /// 画像のフォーマット。デフォルトでは自動的に検出されます。
126124 #[ named]
127125 format : Option < Smart < ImageFormat > > ,
128- /// The width of the image.
126+ /// 画像の幅。
129127 #[ named]
130128 width : Option < Smart < Rel < Length > > > ,
131- /// The height of the image.
129+ /// 画像の高さ。
132130 #[ named]
133131 height : Option < Sizing > ,
134- /// A text describing the image.
132+ /// 画像の説明文。
135133 #[ named]
136134 alt : Option < Option < EcoString > > ,
137- /// How the image should adjust itself to a given area.
135+ /// 与えられた領域に対して、画像をどのように調整するか。
138136 #[ named]
139137 fit : Option < ImageFit > ,
140138 ) -> StrResult < Content > {
@@ -305,17 +303,15 @@ fn determine_format(path: &str, data: &Readable) -> StrResult<ImageFormat> {
305303/// How an image should adjust itself to a given area,
306304#[ derive( Debug , Copy , Clone , Eq , PartialEq , Hash , Cast ) ]
307305pub enum ImageFit {
308- /// The image should completely cover the area (preserves aspect ratio by
309- /// cropping the image only horizontally or vertically). This is the
310- /// default.
306+ /// 領域を完全にカバーします。
307+ /// 水平または垂直方向にのみ画像をトリミングすることで、アスペクト比を保持します。
308+ /// これがデフォルトです。
311309 Cover ,
312- /// The image should be fully contained in the area (preserves aspect
313- /// ratio; doesn't crop the image; one dimension can be narrower than
314- /// specified).
310+ /// 画像は領域内に完全に収まるようにします。
311+ /// アスペクト比を維持して、画像を切り取らず、1つの寸法は指定より狭くします。
315312 Contain ,
316- /// The image should be stretched so that it exactly fills the area, even if
317- /// this means that the image will be distorted (doesn't preserve aspect
318- /// ratio and doesn't crop the image).
313+ /// たとえ画像が歪むことになっても、その領域を正確に埋めるように引き伸ばします。
314+ /// アスペクト比は保たれず、画像は切り取られません。
319315 Stretch ,
320316}
321317
@@ -467,7 +463,7 @@ pub enum ImageFormat {
467463/// A vector graphics format.
468464#[ derive( Debug , Copy , Clone , Eq , PartialEq , Hash , Cast ) ]
469465pub enum VectorFormat {
470- /// The vector graphics format of the web.
466+ /// Webサイトに用いられるベクターフォーマット。
471467 Svg ,
472468}
473469
0 commit comments