Functions, messages and properties used to manipulate font resources.
Version: alpha
| FUNCTIONS | |
|---|---|
| font.add_font() | associates a ttf resource to a .fontc file. |
| font.get_info() | Gets information about a font, such as the associa... |
| font.prewarm_text() | prepopulates the font glyph cache with rasterised ... |
| font.remove_font() | associates a ttf resource to a .fontc file |
font.add_font(fontc,ttf)
associates a ttf resource to a .fontc file.
PARAMETERS
fontc |
stringhash |
The path to the .fontc resource |
ttf |
stringhash |
The path to the .ttf resource |
EXAMPLES
local font_hash = hash("/assets/fonts/roboto.fontc")
local ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf")
font.add_font(font_hash, ttf_hash)
font.get_info(fontc)
Gets information about a font, such as the associated font files
PARAMETERS
fontc |
stringhash |
The path to the .fontc resource |
RETURNS
info |
table |
the information table contains these fields:
|
font.prewarm_text(fontc,text,callback)
prepopulates the font glyph cache with rasterised glyphs
PARAMETERS
fontc |
stringhash |
The path to the .fontc resource |
text |
string |
The text to layout |
[callback] |
function(self, request_id, result, errstring) |
(optional) A callback function that is called after the request is finished
|
RETURNS
request_id |
number |
Returns the asynchronous request id |
EXAMPLES
local font_hash = hash("/assets/fonts/roboto.fontc")
font.prewarm_text(font_hash, "Some text", function (self, request_id, result, errstring)
-- cache is warm, show the text!
end)
font.remove_font(fontc,ttf)
associates a ttf resource to a .fontc file
PARAMETERS
fontc |
stringhash |
The path to the .fontc resource |
ttf |
stringhash |
The path to the .ttf resource |
EXAMPLES
local font_hash = hash("/assets/fonts/roboto.fontc")
local ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf")
font.remove_font(font_hash, ttf_hash)