Font:getVertices

Edit

Returns a table of vertices for a piece of text, along with a Material to use when rendering it. The Material returned by this function may not be the same if the Font's texture atlas needs to be recreated with a bigger size to make room for more glyphs.



Arguments

NameTypeDefaultDescription
stringstring The text to render.
wrapnumber0 The maximum line length. The units depend on the pixel density of the font, but are in meters by default.
halignHorizontalAlign The horizontal align.
valignVerticalAlign The vertical align.

Returns

NameTypeDescription
verticestable The table of vertices. See below for the format of each vertex.
materialMaterial A Material to use when rendering the vertices.

Arguments

NameTypeDefaultDescription
stringstable A table of colored strings, each given as a { color, string } pair. The color can be a Vec3, Vec4, table, or hexcode.
wrapnumber0 The maximum line length. The units depend on the pixel density of the font, but are in meters by default.
halignHorizontalAlign The horizontal align.
valignVerticalAlign The vertical align.

Returns

NameTypeDescription
verticestable The table of vertices. See below for the format of each vertex.
materialMaterial A Material to use when rendering the vertices.

Notes

Each vertex is a table of 4 floating point numbers with the following data:

{ x, y, u, v }

These could be placed in a vertex buffer using the following buffer format:

{ 'vec2:VertexPosition', 'vec2:VertexUV' }

See also