Home

BMFont

BMFont, short for Bitmap Font, is both a bitmap font format and a toolset used to generate bitmap fonts for real-time rendering, especially in 2D games and applications. It works by packing glyph images into a texture atlas and providing a font descriptor that maps character codes to their glyph positions and metrics.

The typical output consists of a texture atlas (commonly PNG) containing all glyph images and a font

BMFont supports multiple texture pages to accommodate large fonts or extensive glyph sets and may embed kerning

Usage involves drawing the appropriate glyphs from the atlas using the coordinates and metrics from the descriptor,

description
file
(often
with
a
.fnt
extension).
The
descriptor
can
be
in
plain
text,
XML,
JSON,
or
binary
form.
It
lists
each
glyph’s
source
rectangle
(x,
y,
width,
height),
its
offset
within
the
line
(xoffset,
yoffset),
the
xadvance,
and
the
page
index
when
multiple
texture
pages
are
used.
It
may
also
include
kerning
pairs
to
adjust
spacing
between
specific
character
combinations.
data.
Glyphs
can
be
exported
for
a
chosen
character
set,
such
as
ASCII
or
Unicode,
depending
on
the
needs
of
the
project.
The
descriptor
formats
differ
in
syntax
but
share
the
same
underlying
data:
how
to
locate
each
glyph
in
the
atlas
and
how
to
position
it
during
rendering.
advancing
with
xadvance
and
applying
xoffset
and
yoffset
for
proper
alignment.
This
approach
provides
consistent
rendering
across
platforms
and
resolutions
and
is
compatible
with
many
2D
rendering
frameworks
and
engines.
See
also
bitmap
font,
font
atlas,
and
TrueType
font.