Difference between revisions of "BmfFonts"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "This module defines a Font class which can read fonts in [https://bmf.php5.cz/index.php?page=format BMF format] version 1.1 or 1.2. Version 1.2 is a recent but significant upg...")
 
m (Redspark moved page BmfFonts Module to BmfFonts: Removing the Word Module because it is under the category Sys Modules.)
 
(No difference)

Latest revision as of 02:06, 31 January 2025

This module defines a Font class which can read fonts in BMF format version 1.1 or 1.2. Version 1.2 is a recent but significant upgrade, adding support for non-ASCII Unicode characters, kerning, and an alpha channel for anti-aliased fonts.

If you run bmfFonts.demo (or load and run the module directly instead of using import), it will look for the fonts folder, and draw a string with each one. The final font will be drawn at 3X scale at the bottom of the screen.

Classes

Name Description
Font Stores all data about a particular font.
CharData Stores all data about a single character in a specific font.

Example

import "bmfFonts"

// Load a font
f = bmfFonts.Font.load("fonts/ming.bmf")

// Print a string in that font to gfx
f.print "Hello world!", 20, 500

// Get a character image, and make a Sprite out of it
spr = new Sprite
spr.image = f.getCharImage("R")
spr.x = 600
spr.y = 500
spr.scale = 3
spr.rotation = 30
display(4).sprites.push spr