natiny.font.create
Lua
natiny.font.create(resource, size) -> font
Creates a font from loaded font data.
Parameters
| Name |
Type |
Description |
resource |
number |
Resource handle containing TrueType font data |
size |
number |
Font size in drawing units; values at or below 0 use 16 |
Returns
| Type |
Description |
number |
Font handle; raises an error if the resource is invalid, the data is not a supported font, or allocation fails |
Example
Lua
local res = natiny.resource.load("fonts/roboto.ttf")
local font = natiny.font.create(res, 24)