FontMetrics

Overview

FontMetrics is a class in Aspose.Pdf FOSS for Java.

Holds computed font metrics derived from a {@link FontDescriptor} and font-specific data.

Properties

NameTypeAccessDescription
ascentdoubleReadReturns the ascent (maximum height above baseline) in glyph units (typically 1/1000 em).
descentdoubleReadReturns the descent (maximum depth below baseline, usually negative).
capHeightdoubleReadReturns the cap height (height of uppercase letters).
missingWidthdoubleReadReturns the missing width — default width for characters not in the font’s width table.
widthsdouble[]ReadReturns the custom width table if set.

Methods

SignatureDescription
FontMetrics(descriptor: FontDescriptor)Creates FontMetrics from a FontDescriptor.
FontMetrics(ascent: double, descent: double, missingWidth: double)Creates FontMetrics with explicit values.
getAscent()doubleReturns the ascent (maximum height above baseline) in glyph units (typically 1/1000 em).
getDescent()doubleReturns the descent (maximum depth below baseline, usually negative).
getCapHeight()doubleReturns the cap height (height of uppercase letters).
getMissingWidth()doubleReturns the missing width — default width for characters not in the font’s width table.
getWidths()double[]Returns the custom width table if set.
setWidths(widths: double[])Sets the custom width table.
setAscent(ascent: double)Sets the ascent.
setDescent(descent: double)Sets the descent.

See Also