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.

This class provides 10 methods for working with FontMetrics objects in Java programs. Available methods include: FontMetrics, getAscent, getCapHeight, getDescent, getMissingWidth, getWidths, setAscent, setDescent, setWidths. All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package. Properties: ascent, capHeight, descent, missingWidth, widths.

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

 English