Enum TextAnchor
- Namespace
- Stride.CommunityToolkit.Rendering.Text
- Assembly
- Stride.CommunityToolkit.dll
Which point of a block of text is placed on the position it is drawn at.
public enum TextAnchor
Fields
BottomCenter = 7Anchor under the middle of the text, leaving the text above the point.
BottomLeft = 6Anchor at the text's bottom-left corner. The text runs right and up.
BottomRight = 8Anchor at the text's bottom-right corner. The text runs left and up.
MiddleCenter = 4Anchor at the centre of the text, horizontally and vertically.
MiddleLeft = 3Anchor at the middle of the text's left edge.
MiddleRight = 5Anchor at the middle of the text's right edge.
TopCenter = 1Anchor at the middle of the text's top edge.
TopLeft = 0Anchor at the text's top-left corner. The text runs right and down.
TopRight = 2Anchor at the text's top-right corner. The text runs left and down.
Remarks
This is the setting people usually mean by "centre the text". It is not TextAlignment, which only decides how lines sit relative to each other inside a multi-line block and does nothing at all to single-line text.
The names say where the anchor point sits on the text, so the text extends away from it: TopLeft puts the point at the text's top-left corner and the text runs right and down, while BottomCenter puts the point under the middle of the text, leaving the text sitting above it - which is what a label floating over an object wants.