Difference between revisions of "love.graphics.newImageFont"
m |
m |
||
Line 18: | Line 18: | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | font = love.graphics.newImageFont( | + | font = love.graphics.newImageFont( imagedata, glyphs ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param| | + | {{param|ImageData|imageData|The ImageData object to create the font from.}} |
{{param|string|glyphs|A string of the characters in the image in order from left to right.}} | {{param|string|glyphs|A string of the characters in the image in order from left to right.}} | ||
=== Returns === | === Returns === |
Revision as of 00:38, 10 October 2016
Creates a new Font by loading a specifically formatted image.
In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused! |
Contents
Function
Synopsis
font = love.graphics.newImageFont( filename, glyphs )
Arguments
string filename
- The filepath to the image file.
string glyphs
- A string of the characters in the image in order from left to right.
Returns
Font font
- A Font object which can be used to draw text on screen.
Function
Synopsis
font = love.graphics.newImageFont( imagedata, glyphs )
Arguments
ImageData imageData
- The ImageData object to create the font from.
string glyphs
- A string of the characters in the image in order from left to right.
Returns
Font font
- A Font object which can be used to draw text on screen.
Function
Available since LÖVE 0.10.0 |
This variant is not supported in earlier versions. |
Synopsis
font = love.graphics.newImageFont( filename, glyphs, extraspacing )
Arguments
string filename
- The filepath to the image file.
string glyphs
- A string of the characters in the image in order from left to right.
number extraspacing
- Additional spacing (positive or negative) to apply to each glyph in the Font.
Returns
Font font
- A Font object which can be used to draw text on screen.
Notes
Instead of using this function, consider using a BMFont generator such as bmfont, littera, or bmGlyph with love.graphics.newFont. Because slime said it was better.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info