Version 0.3.2
LÖVE Documentation
OverviewLicenseCreditsInstallingGetting started
Devices
love.graphicslove.audiolove.keyboardlove.mouselove.filesystemlove.timerlove.system
Types
AnimationColorFontFileImageMusicParticleSystemSound
Callbacks
loadupdatedrawmousepressedmousereleasedkeypressedkeyreleased
Miscellaneous
ConstantsConfig filesKeyboard shortcuts
Function
love.graphics.newImageFont( filename, glyphs, spacing )
An image font is created by having a series of characters set next to each other in a horizontal row. Between all the characters and on the left and right sides should be a dividing line consisting of a single color (which is not found in the actual characters themselves).
This example image is consiting of black and white glyphs on a pink background (background can be transparent) where they are separated by yellow lines. The yellow will be used in determining where each character begins and ends.
Usage
love.graphics.newImageFont( filename, glyphs, spacing )
Arguments
filenameThe filepath to the image file.
glyphsA list of the characters as they are in the image.
spacingThe spacing factor.
Returns
FontA Font object containing the font data.
Examples
Example 1: Add the example font with different spacing. example = love.graphics.newImageFont("imagefont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0.5) -- half spacing
example = love.graphics.newImageFont("imagefont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ", 2) -- double spacing
example = love.graphics.newImageFont("imagefont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1) -- negative spacing works too