PixelFontMeasure

Description

struct Tinman.Engine.Drawing.PixelFontMeasure

Stores the result of measuring a string with a PixelFont.

Public / Methods

Adjust


[Pure]
public method Adjust → (2)

box in : Box2I

A text box that has been returned by Box.

pad opt : int32 = 0

[>=0]
The padding amount to apply around the measured text.

returns → Box2I

The resulting box, to be used for drawing text boxes, for example.

Adjusts the given text box so that it can be used to render non-text things.

Use this method to compute bounding boxes for texts, for example.

Box


[Pure]
public method Box → (3)

anchor opt : Anchor = Anchor.TopLeft

The anchor type.

opt : int32 = 0

X-coordinate of anchor point.

opt : int32 = 0

Y-coordinate of anchor point.

returns → Box2I

The text box. Use the coordinates of the box corners to render text with Anchor.TopLeft, Anchor.TopRight, Anchor.BottomRight and Anchor.BottomLeft, respectively. To draw other elements around the measured text, use Adjust on the text box first.

Computes a box for text rendering, so that the given anchor point ends up at the specified pixel position.

Public / Attributes

Font​Ascent


public readonly attribute FontAscent → (int32)

The font ascent.

Font​Compact


public readonly attribute FontCompact → (int32)

The font compact extend.

Font​Descent


public readonly attribute FontDescent → (int32)

The font descent.

Measure​Height


public readonly attribute MeasureHeight → (RangeI)

The measured height range.

Measure​Width


public readonly attribute MeasureWidth → (int32)

The measured width.

Offset


public attribute Offset → (get)

value : int32

The pixel offset.

Returns the offset to add to the Y-coordinate of a Anchor.TopLeft anchor in order to render text with uniform padding.

Padding


public attribute Padding → (get)

value : int32

[>=0]
The required amount of padding.

Returns the amount of padding around the font compact extend that is necessary to contain the measured glyph pixels.