Rasterizer:getAdvance

Edit

Returns the advance metric for a glyph, in pixels. The advance is the horizontal distance to advance the cursor after rendering the glyph.

advance = Rasterizer:getAdvance(glyph)

Arguments

NameTypeDescription
glyphstring | number A character or codepoint.

Returns

NameTypeDescription
advancenumber The advance of the glyph, in pixels.

Example

local rasterizer = lovr.data.newRasterizer()
local advance1 = rasterizer:getAdvance('H') + rasterizer:getAdvance('i')
local advance2 = rasterizer:getAdvance(72) + rasterizer:getAdvance(105)
assert(advance1 == advance2)

See also