Scrappy Fonts

by Scrappy Ferret

About

Scrappy Fonts is a simple helper library for Solar2D for working with font files. Bitmap fonts coming soon!

API

A full API listing can be found here.

Examples

Register and use a font.

-- Load plugin library
require "plugin.scrappyFonts"

-- Initiate the library
Scrappy.Fonts:init()

-- Register a font and call it 'menu'
Scrappy.Fonts:register( "menu", "fonts/font1.ttf" )

-- Register a font and call it 'hud'
Scrappy.Fonts:register( "hud", "fonts/font2.ttf" )

-- Later on create a label using a font
local options =
{
	text = "Hello, world!",
	width = 100,
	x = display.contentCenterX,
	y = display.contentCenterY,
	font = Scrappy.Fonts:get( "menu" ),
	align = "center",
	fontSize = 12
}

-- Create the label
local label = display.newText( options )

Get a list of registered fonts.

-- Get a list of all registered fonts
local registered = Scrappy.Fonts:list()

-- And loop through them
for i = 1, #registered, 1 do

	-- Printing out their names
	print( registered[ i ] )

end

Register the system fonts.

-- Register the native fonts, this just allows for consistent access with the rest of the api
Scrappy.Fonts:registerNativeFonts()

-- So you can now do things like this if you want
Scrappy.Fonts:get( "systemFont" )

Trusted vendor

Documentation

$5.00

Log in now to purchase this plugin from Scrappy Ferret.

Once you've activated this plugin, appropriate build.settings code will be generated for you to copy into your Solar2D project. Download links will also be available for inclusion into a Solar2D Native project.

Latest Solar2D contributions by Scrappy Ferret view all