Ion
|
This struct defines parameters affecting layout of a single text string when passed to BuildLayout(). More...
#include "layout.h"
Public Member Functions | |
LayoutOptions () | |
Public Attributes | |
math::Point2f | target_point |
Location of the text rectangle. (Default: origin) More... | |
math::Vector2f | target_size |
Target width and height of the text rectangle. (Default: 0 in x, 1 in y) More... | |
HorizontalAlignment | horizontal_alignment |
Text alignment in the horizontal direction. (Default: kAlignLeft) More... | |
VerticalAlignment | vertical_alignment |
Text alignment in the vertical direction. (Default: kAlignBaseline) More... | |
float | line_spacing |
Spacing between baselines of lines of multi-line text, expressed as a fraction of the font's FontMetrics::line_advance_height. More... | |
This struct defines parameters affecting layout of a single text string when passed to BuildLayout().
The text string is assumed to be encoded as UTF-8; Ascii characters are treated normally.
Placement: The text is placed relative to target_point according to the alignment enum values. For example, if kAlignLeft/kAlignBottom is specified, the bottom-left corner of the text's bounding rectangle is placed at target_point. If kAlignBaseline is specified for a multi-line text string, the baseline of the first line is placed at target_point.
Size: The target_size field is interpreted as a width and height. If either component of the size is positive and the other is zero, the text rectangle will be scaled uniformly to match that component (width or height). If both are positive, the rectangle will be scaled non-uniformly to match both. If either is negative or both are zero, the returned Layout will be empty.
Scaling: If the SDF padding in the Font is positive, each Quad of the resulting Layout is scaled up about its center to compensate, since increased padding means the portion of the quad covered by each glyph effectively shrinks.
Line spacing: A text string containing newline (
) characters is treated as multi-line text. The line_spacing field indicates how to space the lines. It is expressed as a fraction of the font's maximum glyph height.
Bad glyphs: Any missing glyphs in the font will be treated as spaces.
HorizontalAlignment ion::text::LayoutOptions::horizontal_alignment |
float ion::text::LayoutOptions::line_spacing |
Spacing between baselines of lines of multi-line text, expressed as a fraction of the font's FontMetrics::line_advance_height.
(Default: 1.0)
Definition at line 119 of file layout.h.
Referenced by ion::text::ComputeTextSize(), and ion::text::ComputeTransformData().
math::Point2f ion::text::LayoutOptions::target_point |
math::Vector2f ion::text::LayoutOptions::target_size |
Target width and height of the text rectangle. (Default: 0 in x, 1 in y)
Definition at line 112 of file layout.h.
Referenced by ion::text::FreeTypeFont::BuildLayout(), and ion::text::ComputeTransformData().
VerticalAlignment ion::text::LayoutOptions::vertical_alignment |