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
| Name | Type | Description |
| glyph | string | number |
A character or codepoint.
|
Returns
| Name | Type | Description |
| advance | number |
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