TtfFontMetrics

Inheritance: java.lang.Object, com.aspose.font.FontMetrics

public class TtfFontMetrics extends FontMetrics

Represents TTF Font metrics.

Methods

MethodDescription
getGlyphWidth(GlyphId glyphId)Returns glyphs width by glyph id.
measureString(String unicode, double fontSize)Measures string and returns string width.
measureString(long[] charCodes, double fontSize)Measures text represented as array of character codes and returns string width.
getAscender()Gets ascender value.
setAscender(double value)Sets ascender value.
getDescender()Gets descender value.
setDescender(double value)Sets descender value.
getTypoAscender()Gets TypoAscender value.
setTypoAscender(double value)Sets TypoAscender value.
getTypoDescender()Gets TypoDescender value.
setTypoDescender(double value)Sets TypoDescender value.
getLineGap()Gets LineGap value.
getTypoLineGap()Gets TypoLineGap value.
getFontBBox()Gets FontBBox value.
getFontMatrix()Gets FontBBox value.
getKerningValue(GlyphId prevGlyphId, GlyphId nextGlyphId)Returns kerning value for the glyph pair.
getUnitsPerEM()Gets UnitsPerEM value.
setUnitsPerEM(long value)

getGlyphWidth(GlyphId glyphId)

public double getGlyphWidth(GlyphId glyphId)

Returns glyphs width by glyph id.

Parameters:

ParameterTypeDescription
glyphIdGlyphIdGlyph identifier.

Returns: double - Glyph width.

measureString(String unicode, double fontSize)

public double measureString(String unicode, double fontSize)

Measures string and returns string width.

Parameters:

ParameterTypeDescription
unicodejava.lang.StringUnicode string.
fontSizedoubleFont size.

Returns: double - String width.

measureString(long[] charCodes, double fontSize)

public double measureString(long[] charCodes, double fontSize)

Measures text represented as array of character codes and returns string width.

Parameters:

ParameterTypeDescription
charCodeslong[]Text string represented as array of character codes.
fontSizedoubleFont size.

Returns: double - String width.

getAscender()

public double getAscender()

Gets ascender value.

Returns: double - Ascender value.

setAscender(double value)

public void setAscender(double value)

Sets ascender value.

Parameters:

ParameterTypeDescription
valuedoubleAscender value.

getDescender()

public double getDescender()

Gets descender value.

Returns: double - Descender value.

setDescender(double value)

public void setDescender(double value)

Sets descender value.

Parameters:

ParameterTypeDescription
valuedoubleDescender value.

getTypoAscender()

public double getTypoAscender()

Gets TypoAscender value.

Returns: double - TypoAscender value.

setTypoAscender(double value)

public void setTypoAscender(double value)

Sets TypoAscender value.

Parameters:

ParameterTypeDescription
valuedoubleTypoAscender value.

getTypoDescender()

public double getTypoDescender()

Gets TypoDescender value.

Returns: double - TypoDescender value.

setTypoDescender(double value)

public void setTypoDescender(double value)

Sets TypoDescender value.

Parameters:

ParameterTypeDescription
valuedoubleTypoDescender value.

getLineGap()

public double getLineGap()

Gets LineGap value.

Returns: double - LineGap value.

getTypoLineGap()

public double getTypoLineGap()

Gets TypoLineGap value.

Returns: double - TypoLineGap value.

getFontBBox()

public FontBBox getFontBBox()

Gets FontBBox value.

Returns: FontBBox

getFontMatrix()

public TransformationMatrix getFontMatrix()

Gets FontBBox value.

Returns: TransformationMatrix

getKerningValue(GlyphId prevGlyphId, GlyphId nextGlyphId)

public double getKerningValue(GlyphId prevGlyphId, GlyphId nextGlyphId)

Returns kerning value for the glyph pair.

Parameters:

ParameterTypeDescription
prevGlyphIdGlyphIdFirst glyph in pair.
nextGlyphIdGlyphIdFont size.

Returns: double - Kerning value

getUnitsPerEM()

public long getUnitsPerEM()

Gets UnitsPerEM value.

Returns: long

setUnitsPerEM(long value)

public void setUnitsPerEM(long value)

Sets UnitsPerEM value.

Parameters:

ParameterTypeDescription
valuelong