Difference between revisions of "BmfFonts"
Jump to navigation
Jump to search
Dat one dev (talk | contribs) (Previously this page was using font on path ("fonts/ming.bmf") which wasn't part of /sys directory. so i edited this to use font which is part of /sys directory) |
m (Updated URL) |
||
| Line 1: | Line 1: | ||
| − | This module defines a Font class which can read fonts in [ | + | This module defines a Font class which can read fonts in [http://bmf.wz.cz:8080/?page=format 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. | 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. | ||
Latest revision as of 15:02, 22 November 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"
clear
// Load a font
f = bmfFonts.Font.load("/sys/fonts/Arial14Bold.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