Rasterizer:getBearing

Edit

Returns the bearing metric for a glyph, in pixels. The bearing is the horizontal distance from the cursor to the edge of the glyph.

bearing = Rasterizer:getBearing(glyph)

Arguments

NameTypeDescription
glyphstring | number A character or codepoint.

Returns

NameTypeDescription
bearingnumber The bearing of the glyph, in pixels.

Example

local rasterizer = lovr.data.newRasterizer()

-- In the default font, H is wider than i
assert(rasterizer:getBearing('H') > rasterizer:getBearing('i'))

See also