TextCluster Class

  • Experimental (WEBPLATEXP0024)

A cluster of a measured text (https://github.com/whatwg/html/pull/11000), returned by TextMetrics.GetTextClusters: a range of the text (a grapheme cluster, or several when a glyph spans them) and the position of its alignment point relative to the alignment point and to the baseline of the text.

[Experimental("WEBPLATEXP0024", UrlFormat = "https://github.com/meziantou/Meziantou.Framework/blob/main/src/Meziantou.Framework.WebPlatform/docs/experimental-apis.md#{0}")]
public sealed class TextCluster

Properties

NameDescription
AlignGets the alignment the cluster is drawn with.
BaselineGets the baseline the cluster is drawn with.
EndGets the index (in UTF-16 code units) after the last character of the cluster.
StartGets the index (in UTF-16 code units) of the first character of the cluster.
XGets the horizontal distance of the alignment point of the cluster (for TextCluster.Align) from the alignment point of the text.
YGets the vertical distance of the baseline of the cluster (for TextCluster.Baseline) below the baseline of the text.

Gets the alignment the cluster is drawn with.

public CanvasTextAlign Align { get; }

Gets the index (in UTF-16 code units) after the last character of the cluster.

public uint End { get; }

Gets the index (in UTF-16 code units) of the first character of the cluster.

public uint Start { get; }

Gets the horizontal distance of the alignment point of the cluster (for TextCluster.Align) from the alignment point of the text.

public double X { get; }

Gets the vertical distance of the baseline of the cluster (for TextCluster.Baseline) below the baseline of the text.

public double Y { get; }