Home

TTFFontHeight

TTFFontHeight is a metric used in font rendering to describe the vertical size of a TrueType font as it is laid out on a device. It is primarily used to determine line spacing when rendering multi-line text and is not a fixed property of the font file itself.

TTFFontHeight is a derived value that depends on both the font’s intrinsic metrics and the rendering context.

Because TTFFontHeight depends on the chosen size and pixel density, it can vary between fonts and rendering

Usage and practical notes: TTFFontHeight is primarily used to calculate line spacing and vertical layout when

TrueType
fonts
encode
several
key
metrics,
including
unitsPerEm,
ascent,
descent,
and
lineGap.
When
these
metrics
are
mapped
from
font
units
to
device
units
(pixels
or
points)
at
a
given
point
size
and
DPI,
they
define
the
line
height
that
a
rendering
engine
will
apply.
In
practice,
TTFFontHeight
is
often
computed
from
the
sum
of
ascent
and
descent
plus
any
leading
or
line
gap,
scaled
to
the
current
display
resolution
and
size.
environments
even
for
the
same
nominal
point
size.
It
is
therefore
distinct
from
other
related
metrics
such
as
the
em
height
(the
font’s
design
grid,
typically
unitsPerEm)
or
per-glyph
bounding
box
heights.
Some
platforms
expose
a
comparable
value
(for
example,
tmHeight
in
Windows
via
GetTextMetrics),
but
the
exact
interpretation
can
differ
across
systems
and
font
engines.
rendering
text.
Developers
should
obtain
height
through
the
rendering
API
in
use,
as
it
accounts
for
the
specific
font,
size,
and
device
context.
See
also
TrueType,
font
metrics,
unitsPerEm,
ascent,
descent,
lineGap.