Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::text::LayoutOptions Struct Reference

This struct defines parameters affecting layout of a single text string when passed to BuildLayout(). More...

#include "layout.h"

Collaboration diagram for ion::text::LayoutOptions:

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...
 

Detailed Description

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.

Definition at line 101 of file layout.h.

Constructor & Destructor Documentation

ion::text::LayoutOptions::LayoutOptions ( )
inline

Definition at line 102 of file layout.h.

Member Data Documentation

HorizontalAlignment ion::text::LayoutOptions::horizontal_alignment

Text alignment in the horizontal direction. (Default: kAlignLeft)

Definition at line 114 of file layout.h.

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

Location of the text rectangle. (Default: origin)

Definition at line 110 of file layout.h.

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

Text alignment in the vertical direction. (Default: kAlignBaseline)

Definition at line 116 of file layout.h.


The documentation for this struct was generated from the following file: