Skip to content

Commit 2b07d55

Browse files
authored
Merge branch 'main' into translate-math/lr
2 parents e679f8f + 6138a8d commit 2b07d55

File tree

13 files changed

+214
-209
lines changed

13 files changed

+214
-209
lines changed

crates/typst-library/src/layout/transform.rs

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ use crate::layout::{
77
Abs, Alignment, Angle, BlockElem, HAlignment, Length, Ratio, Rel, VAlignment,
88
};
99

10-
/// Moves content without affecting layout.
10+
/// レイアウトに影響を与えないコンテンツの移動。
1111
///
12-
/// The `move` function allows you to move content while the layout still 'sees'
13-
/// it at the original positions. Containers will still be sized as if the
14-
/// content was not moved.
12+
/// `move`関数を用いると、コンテンツの元々の位置をレイアウトに「認識」させながら、そのコンテンツを移動させることができます。
13+
/// コンテナの大きさは、コンテンツが移動されていないかのように決定されます。
1514
///
16-
/// # Example
15+
/// #
1716
/// ```example
1817
/// #rect(inset: 0pt, move(
1918
/// dx: 6pt, dy: 6pt,
@@ -27,13 +26,13 @@ use crate::layout::{
2726
/// ```
2827
#[elem(Show)]
2928
pub struct MoveElem {
30-
/// The horizontal displacement of the content.
29+
/// コンテンツの水平方向の変位。
3130
pub dx: Rel<Length>,
3231

33-
/// The vertical displacement of the content.
32+
/// コンテンツの垂直方向の変位。
3433
pub dy: Rel<Length>,
3534

36-
/// The content to move.
35+
/// 移動させたいコンテンツ。
3736
#[required]
3837
pub body: Content,
3938
}
@@ -46,12 +45,12 @@ impl Show for Packed<MoveElem> {
4645
}
4746
}
4847

49-
/// Rotates content without affecting layout.
48+
/// レイアウトに影響を与えないコンテンツの回転。
5049
///
51-
/// Rotates an element by a given angle. The layout will act as if the element
52-
/// was not rotated unless you specify `{reflow: true}`.
50+
/// 要素を指定された角度だけ回転させます。
51+
/// `{reflow: true}`を指定しない限り、レイアウトは、その要素が回転していないかのように振る舞います。
5352
///
54-
/// # Example
53+
/// #
5554
/// ```example
5655
/// #stack(
5756
/// dir: ltr,
@@ -62,7 +61,7 @@ impl Show for Packed<MoveElem> {
6261
/// ```
6362
#[elem(Show)]
6463
pub struct RotateElem {
65-
/// The amount of rotation.
64+
/// 回転させる量。
6665
///
6766
/// ```example
6867
/// #rotate(-1.571rad)[Space!]
@@ -71,11 +70,9 @@ pub struct RotateElem {
7170
#[positional]
7271
pub angle: Angle,
7372

74-
/// The origin of the rotation.
73+
/// 回転の中心点。
7574
///
76-
/// If, for instance, you wanted the bottom left corner of the rotated
77-
/// element to stay aligned with the baseline, you would set it to `bottom +
78-
/// left` instead.
75+
/// 例えば、回転した要素の左下隅をベースラインに揃えたままにしたい場合、代わりに`bottom + left`を指定します。
7976
///
8077
/// ```example
8178
/// #set text(spacing: 8pt)
@@ -90,19 +87,18 @@ pub struct RotateElem {
9087
#[default(HAlignment::Center + VAlignment::Horizon)]
9188
pub origin: Alignment,
9289

93-
/// Whether the rotation impacts the layout.
90+
/// 回転がレイアウトに影響を与えるかどうか。
9491
///
95-
/// If set to `{false}`, the rotated content will retain the bounding box of
96-
/// the original content. If set to `{true}`, the bounding box will take the
97-
/// rotation of the content into account and adjust the layout accordingly.
92+
/// `{false}`に設定された場合、回転したコンテンツは元々のコンテンツのバウンディングボックスに留まります。
93+
/// `{true}`に設定された場合、バウンディングボックスはコンテンツの回転を考慮してレイアウトを調整します。
9894
///
9995
/// ```example
10096
/// Hello #rotate(90deg, reflow: true)[World]!
10197
/// ```
10298
#[default(false)]
10399
pub reflow: bool,
104100

105-
/// The content to rotate.
101+
/// 回転させるコンテンツ。
106102
#[required]
107103
pub body: Content,
108104
}
@@ -115,44 +111,43 @@ impl Show for Packed<RotateElem> {
115111
}
116112
}
117113

118-
/// Scales content without affecting layout.
114+
/// レイアウトに影響を与えないコンテンツの拡大縮小。
119115
///
120-
/// Lets you mirror content by specifying a negative scale on a single axis.
116+
/// 単一の軸で負のスケールを指定することで、コンテンツを反転表示できます。
121117
///
122-
/// # Example
118+
/// #
123119
/// ```example
124120
/// #set align(center)
125121
/// #scale(x: -100%)[This is mirrored.]
126122
/// #scale(x: -100%, reflow: true)[This is mirrored.]
127123
/// ```
128124
#[elem(Show)]
129125
pub struct ScaleElem {
130-
/// The scaling factor for both axes, as a positional argument. This is just
131-
/// an optional shorthand notation for setting `x` and `y` to the same
132-
/// value.
126+
/// 位置引数として両方の軸の拡大縮小率を設定します。
127+
/// これは`x`と`y`を同じ値で設定する省略記法です。
133128
#[external]
134129
#[positional]
135130
#[default(Smart::Custom(ScaleAmount::Ratio(Ratio::one())))]
136131
pub factor: Smart<ScaleAmount>,
137132

138-
/// The horizontal scaling factor.
133+
/// 水平方向の拡大縮小率。
139134
///
140-
/// The body will be mirrored horizontally if the parameter is negative.
135+
/// 負の値が指定された場合は本文が水平方向に反転します。
141136
#[parse(
142137
let all = args.find()?;
143138
args.named("x")?.or(all)
144139
)]
145140
#[default(Smart::Custom(ScaleAmount::Ratio(Ratio::one())))]
146141
pub x: Smart<ScaleAmount>,
147142

148-
/// The vertical scaling factor.
143+
/// 垂直方向の拡大縮小率。
149144
///
150-
/// The body will be mirrored vertically if the parameter is negative.
145+
/// 負の値が指定された場合は本文が垂直方向に反転します。
151146
#[parse(args.named("y")?.or(all))]
152147
#[default(Smart::Custom(ScaleAmount::Ratio(Ratio::one())))]
153148
pub y: Smart<ScaleAmount>,
154149

155-
/// The origin of the transformation.
150+
/// 変換の原点。
156151
///
157152
/// ```example
158153
/// A#box(scale(75%)[A])A \
@@ -162,19 +157,18 @@ pub struct ScaleElem {
162157
#[default(HAlignment::Center + VAlignment::Horizon)]
163158
pub origin: Alignment,
164159

165-
/// Whether the scaling impacts the layout.
160+
/// 拡大縮小がレイアウトに影響を与えるかどうか。
166161
///
167-
/// If set to `{false}`, the scaled content will be allowed to overlap
168-
/// other content. If set to `{true}`, it will compute the new size of
169-
/// the scaled content and adjust the layout accordingly.
162+
/// `{false}`の場合、拡大縮小したコンテンツが他のコンテンツと重なることを許可します。
163+
/// `{true}`の場合、拡大縮小したコンテンツの新しい大きさを計算し、それに応じてレイアウトを調整します。
170164
///
171165
/// ```example
172166
/// Hello #scale(x: 20%, y: 40%, reflow: true)[World]!
173167
/// ```
174168
#[default(false)]
175169
pub reflow: bool,
176170

177-
/// The content to scale.
171+
/// 拡大縮小するコンテンツ。
178172
#[required]
179173
pub body: Content,
180174
}
@@ -204,20 +198,20 @@ cast! {
204198
length: Length => ScaleAmount::Length(length),
205199
}
206200

207-
/// Skews content.
201+
/// コンテンツのスキュー変形。
208202
///
209-
/// Skews an element in horizontal and/or vertical direction. The layout will
210-
/// act as if the element was not skewed unless you specify `{reflow: true}`.
203+
/// 水平方向または垂直方向、あるいは両方向に要素をスキュー(シアー)変形します。
204+
/// `{reflow: true}`を指定しない限り、レイアウトは要素がスキュー変形を受けていないかのように振る舞います。
211205
///
212-
/// # Example
206+
/// #
213207
/// ```example
214208
/// #skew(ax: -12deg)[
215209
/// This is some fake italic text.
216210
/// ]
217211
/// ```
218212
#[elem(Show)]
219213
pub struct SkewElem {
220-
/// The horizontal skewing angle.
214+
/// 水平方向のスキュー角。
221215
///
222216
/// ```example
223217
/// #skew(ax: 30deg)[Skewed]
@@ -226,7 +220,7 @@ pub struct SkewElem {
226220
#[default(Angle::zero())]
227221
pub ax: Angle,
228222

229-
/// The vertical skewing angle.
223+
/// 垂直方向のスキュー角。
230224
///
231225
/// ```example
232226
/// #skew(ay: 30deg)[Skewed]
@@ -235,9 +229,9 @@ pub struct SkewElem {
235229
#[default(Angle::zero())]
236230
pub ay: Angle,
237231

238-
/// The origin of the skew transformation.
232+
/// スキュー変形の原点。
239233
///
240-
/// The origin will stay fixed during the operation.
234+
/// 操作中は原点が固定されます。
241235
///
242236
/// ```example
243237
/// X #box(skew(ax: -30deg, origin: center + horizon)[X]) X \
@@ -248,19 +242,18 @@ pub struct SkewElem {
248242
#[default(HAlignment::Center + VAlignment::Horizon)]
249243
pub origin: Alignment,
250244

251-
/// Whether the skew transformation impacts the layout.
245+
/// スキュー変形がレイアウトに影響を与えるかどうか。
252246
///
253-
/// If set to `{false}`, the skewed content will retain the bounding box of
254-
/// the original content. If set to `{true}`, the bounding box will take the
255-
/// transformation of the content into account and adjust the layout accordingly.
247+
/// `{false}`の場合、スキュー変形されたコンテンツは元々のコンテンツのバウンディングボックスに留まります。
248+
/// `{true}`の場合、バウンディングボックスはコンテンツの変形を考慮してレイアウトを調整します。
256249
///
257250
/// ```example
258251
/// Hello #skew(ay: 30deg, reflow: true, "World")!
259252
/// ```
260253
#[default(false)]
261254
pub reflow: bool,
262255

263-
/// The content to skew.
256+
/// スキュー変形するコンテンツ。
264257
#[required]
265258
pub body: Content,
266259
}

crates/typst-library/src/math/attach.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,18 @@ impl Packed<AttachElem> {
8181
}
8282
}
8383

84-
/// Grouped primes.
84+
/// グループ化されたプライム記号。
8585
///
8686
/// ```example
8787
/// $ a'''_b = a^'''_b $
8888
/// ```
8989
///
90-
/// # Syntax
91-
/// This function has dedicated syntax: use apostrophes instead of primes. They
92-
/// will automatically attach to the previous element, moving superscripts to
93-
/// the next level.
90+
/// # 構文
91+
/// この関数には専用の構文があり、primes関数の代わりにアポストロフィー記号を使います。
92+
/// これらは自動的に前の要素に付加され、次の上付き文字のレベルに移動します。
9493
#[elem(Mathy)]
9594
pub struct PrimesElem {
96-
/// The number of grouped primes.
95+
/// グループ化するプライム記号の数。
9796
#[required]
9897
pub count: usize,
9998
}

crates/typst-library/src/math/cancel.rs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use crate::layout::{Abs, Angle, Length, Ratio, Rel};
33
use crate::math::Mathy;
44
use crate::visualize::Stroke;
55

6-
/// Displays a diagonal line over a part of an equation.
6+
/// 数式の一部分上に対角線を表示。
77
///
8-
/// This is commonly used to show the elimination of a term.
8+
/// 項の除去を示すのによく使われます。
99
///
10-
/// # Example
10+
/// #
1111
/// ```example
1212
/// >>> #set page(width: 140pt)
1313
/// Here, we can simplify:
@@ -16,13 +16,12 @@ use crate::visualize::Stroke;
1616
/// ```
1717
#[elem(Mathy)]
1818
pub struct CancelElem {
19-
/// The content over which the line should be placed.
19+
/// 線が配置されるべきコンテンツ。
2020
#[required]
2121
pub body: Content,
2222

23-
/// The length of the line, relative to the length of the diagonal spanning
24-
/// the whole element being "cancelled". A value of `{100%}` would then have
25-
/// the line span precisely the element's diagonal.
23+
/// 「キャンセル」したい要素全体をまたぐ対角線を基準とした相対的な線の長さ。
24+
/// `{100%}`という値は、要素の対角線と正確に一致する長さになります。
2625
///
2726
/// ```example
2827
/// >>> #set page(width: 140pt)
@@ -33,9 +32,8 @@ pub struct CancelElem {
3332
#[default(Rel::new(Ratio::one(), Abs::pt(3.0).into()))]
3433
pub length: Rel<Length>,
3534

36-
/// Whether the cancel line should be inverted (flipped along the y-axis).
37-
/// For the default angle setting, inverted means the cancel line
38-
/// points to the top left instead of top right.
35+
/// 打ち消し線を(y軸に関して)反転させるべきかどうか。
36+
/// デフォルト角度設定では、反転により打ち消し線が右上ではなく左上を指すようになります。
3937
///
4038
/// ```example
4139
/// >>> #set page(width: 140pt)
@@ -45,8 +43,8 @@ pub struct CancelElem {
4543
#[default(false)]
4644
pub inverted: bool,
4745

48-
/// Whether two opposing cancel lines should be drawn, forming a cross over
49-
/// the element. Overrides `inverted`.
46+
/// 要素上で交差する、相対する2つの打ち消し線を描画するかどうか。
47+
/// これは`inverted`を上書きします。
5048
///
5149
/// ```example
5250
/// >>> #set page(width: 140pt)
@@ -55,15 +53,12 @@ pub struct CancelElem {
5553
#[default(false)]
5654
pub cross: bool,
5755

58-
/// How much to rotate the cancel line.
56+
/// 打ち消し線をどれくらい回転させるか。
5957
///
60-
/// - If given an angle, the line is rotated by that angle clockwise with
61-
/// respect to the y-axis.
62-
/// - If `{auto}`, the line assumes the default angle; that is, along the
63-
/// rising diagonal of the content box.
64-
/// - If given a function `angle => angle`, the line is rotated, with
65-
/// respect to the y-axis, by the angle returned by that function. The
66-
/// function receives the default angle as its input.
58+
/// - 角度が与えられた場合、y軸方向を0度として時計回りに与えられた角度だけ線が回転します。
59+
/// - `{auto}`の場合、デフォルトの角度を用いた線となります。すなわち、コンテンツのボックスの右上がりの対角線に沿うものになります。
60+
/// - `angle => angle`の形の関数が与えられた場合、y軸方向を0度として、その関数が返す角度で線が回転します。
61+
/// 関数は入力としてデフォルトの角度を受け取ります。
6762
///
6863
/// ```example
6964
/// >>> #set page(width: 140pt)
@@ -76,7 +71,7 @@ pub struct CancelElem {
7671
/// ```
7772
pub angle: Smart<CancelAngle>,
7873

79-
/// How to [stroke]($stroke) the cancel line.
74+
/// 打ち消し線の[ストローク]($stroke)をどうするか。
8075
///
8176
/// ```example
8277
/// >>> #set page(width: 140pt)

0 commit comments

Comments
 (0)