Instance Method インスタンスメソッド

tracking(_:)

Sets the tracking for the text. トラッキングをテキストに設定します。

Declaration 宣言

func tracking(_ tracking: CGFloat) -> Text

Return Value 戻り値

Text with the specified amount of tracking. 指定された量のトラッキングをもつテキスト。

Parameters パラメータ

tracking

The amount of additional space, in points, that the view should add to each character cluster after layout. 追加的空間の量、ポイントで、それはビューが各文字クラスタにレイアウトの後に加えるべきものです。

Discussion 議論

Tracking adds space, measured in points, between the characters in the text view. A positive value increases the spacing between characters, while a negative value brings the characters closer together. トラッキングは空間を、ポイントで計って、テキストビューの中の文字の間に加えます。正の値は文字の間の空間を増やします、一方で負の値は文字を密接するようにします。


VStack(alignment: .leading) {
    Text("ABCDEF").tracking(-3)
    Text("ABCDEF")
    Text("ABCDEF").tracking(3)
}

The code above uses an unusually large amount of tracking to make it easy to see the effect. 上のコードは、普通でない大きな量のトラッキングを使って、簡単に効果がわかるようにしています。

Three text views showing character groups with progressively

The effect of tracking resembles that of the kerning(_:) modifier, but adds or removes trailing whitespace, rather than changing character offsets. Also, using any nonzero amount of tracking disables nonessential ligatures, whereas kerning attempts to maintain ligatures. また、なんらかの非ゼロ量のトラッキングを使うことは、非本質のリガチャを無効にします、だけれどもカーニングはリガチャを保守しようとします。

See Also 参照

Styling the View’s Text ビューのもつテキストにスタイルをつける