Share via


Layout.GetLineLetterSpacingUnitCount(Int32, Boolean) Method

Definition

Returns the number of letter spacing unit in the line.

[Android.Runtime.Register("getLineLetterSpacingUnitCount", "(IZ)I", "GetGetLineLetterSpacingUnitCount_IZHandler", ApiSince=35)]
public virtual int GetLineLetterSpacingUnitCount (int line, bool includeTrailingWhitespace);
[<Android.Runtime.Register("getLineLetterSpacingUnitCount", "(IZ)I", "GetGetLineLetterSpacingUnitCount_IZHandler", ApiSince=35)>]
abstract member GetLineLetterSpacingUnitCount : int * bool -> int
override this.GetLineLetterSpacingUnitCount : int * bool -> int

Parameters

line
Int32

the index of the line

includeTrailingWhitespace
Boolean

whether to include trailing whitespace

Returns

the number of cluster count in the line.

Attributes

Remarks

Returns the number of letter spacing unit in the line.

This API returns a number of letters that is a target of letter spacing. The letter spacing won't be added to the middle of the characters that are needed to be treated as a single, e.g., ligatured or conjunct form. Note that this value is different from the number of] grapheme clusters that is calculated by BreakIterator#getCharacterInstance(Locale). For example, if the "fi" is ligatured, the ligatured form is treated as single uni and letter spacing is not added, but it has two separate grapheme cluster.

This value is used for calculating the letter spacing amount for the justification because the letter spacing is applied between clusters. For example, if extra W pixels needed to be filled by letter spacing, the amount of letter spacing to be applied is W/(letter spacing unit count - 1) px.

Java documentation for android.text.Layout.getLineLetterSpacingUnitCount(int, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to