18 #ifndef ION_TEXT_LAYOUT_H_
19 #define ION_TEXT_LAYOUT_H_
28 #ifdef ION_PLATFORM_NACL
29 #include <sys/types.h>
135 points[0] = points[1] = points[2] = points[3] = math::Point3f::Zero();
140 Quad(
const math::Point3f& lower_left,
const math::Point3f& lower_right,
141 const math::Point3f& upper_right,
const math::Point3f& upper_left) {
142 points[0] = lower_left;
143 points[1] = lower_right;
144 points[2] = upper_right;
145 points[3] = upper_left;
149 explicit Quad(
const math::Point3f points_in[4]) {
150 for (
int i = 0; i < 4; ++i)
151 points[i] = points_in[i];
154 math::Point3f points[4];
169 const math::Vector2f& offset_in)
170 : glyph_index(glyph_index_in), quad(quad_in),
171 bounds(bounds_in),
offset(offset_in) {}
188 bool AddGlyph(
const Glyph& glyph);
191 size_t GetGlyphCount()
const;
194 void Reserve(
size_t s);
198 const Glyph& GetGlyph(
size_t i)
const;
203 bool ReplaceGlyph(
size_t i,
const Glyph& new_glyph);
206 void GetGlyphSet(
GlyphSet* glyphs)
const;
210 float GetLineAdvanceHeight()
const;
212 void SetLineAdvanceHeight(
float line_advance);
215 std::vector<Glyph> glyphs_;
216 float line_advance_height_;
220 std::ostream&
operator<<(std::ostream& os,
const Layout& layout);
221 std::ostream&
operator<<(std::ostream& out,
const Layout::Glyph& g);
222 std::ostream&
operator<<(std::ostream& out,
const Layout::Quad& q);
227 #endif // ION_TEXT_LAYOUT_H_
std::ostream & operator<<(std::ostream &out, const Layout::Quad &q)
Helpers for logging Layouts/Glyphs/Quads.
math::Vector2f offset
Offset from text insertion point to glyph bounds' lower left corner.
Glyph(GlyphIndex glyph_index_in, const Quad &quad_in, const math::Range2f &bounds_in, const math::Vector2f &offset_in)
Constructor taking specifics.
A Quad represents a 3D quadrilateral onto which a character glyph in the layout will be drawn...
math::Point2f target_point
Location of the text rectangle. (Default: origin)
Range< 2, float > Range2f
This struct defines parameters affecting layout of a single text string when passed to BuildLayout()...
Glyph()
The default constructor sets an invalid index (0, the NUL character) and sets all quadrilateral point...
base::AllocSet< GlyphIndex > GlyphSet
Quad()
The default constructor sets all points to the origin.
Quad(const math::Point3f points_in[4])
Constructor taking all four quadrilateral points as an array.
math::Vector2f target_size
Target width and height of the text rectangle. (Default: 0 in x, 1 in y)
A Layout instance specifies how glyphs are arranged to form text.
HorizontalAlignment horizontal_alignment
Text alignment in the horizontal direction. (Default: kAlignLeft)
VerticalAlignment vertical_alignment
Text alignment in the vertical direction. (Default: kAlignBaseline)
Quad(const math::Point3f &lower_left, const math::Point3f &lower_right, const math::Point3f &upper_right, const math::Point3f &upper_left)
Constructor taking all four individual quadrilateral points in the correct order. ...
HorizontalAlignment
Alignment enums.
float line_spacing
Spacing between baselines of lines of multi-line text, expressed as a fraction of the font's FontMetr...
A Glyph represents one character glyph in the layout.