TtfFont

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

public class TtfFont extends Font

Represents TrueType Font (TTF).

Methods

MethodDescription
getTtfTables()Gets TTF tables.
getCffFont()Gets CFF Font if present.
getFontType()Gets Font type.
getFontFamily()Gets Font family.
setFontFamily(String value)Sets Font family.
getStyle()Gets Font style.
setStyle(String value)Sets Font style.
getFontStyle()Gets Font style.
getFontName()Gets Font face name.
setFontName(String value)Sets Font face name.
getFontNames()Gets Font names.
getPostscriptNames()Gets Postscript font names.
getNumGlyphs()Gets number of glyphs in the Font.
isSymbolic()Returns true in case Font is symbolic.
getMetrics()Gets Font metrics.
getEncoding()Gets Font encoding.
getGlyphIdType()Gets glyph id type specification.
getFontDefinition()Gets Font definition.
getGlyphById(GlyphId id)Returns glyph by glyph id.
getGlyphById(String glyphName)Returns glyph by glyph name.
getGlyphById(long id)Returns glyph by glyph id.
getAllGlyphIds()Returns array of all glyph ids, available in the Font.
getGlyphComponentsById(GlyphId id, GlyphIdList componentsToPopulate)Gets a glyph by glyph identifier passed and fills passed list of glyph identifiers with components of this glyph.
getGlyphComponentsById(String glyphName, GlyphIdList componentsToPopulate)Gets a glyph by glyph name passed and fills passed list of glyph identifiers with components of this glyph.
getGlyphComponentsById(long id, GlyphIdList componentsToPopulate)Gets a glyph by glyph index passed and fills passed list of glyph identifiers with components of this glyph.
getGlyphsForText(String text)Get glyphs representation for text.
convert(FontType fontType)Converts the Font into another format.
convert(FontType fontType, Collection limitingCharacterSet)Converts the Font into another format with limiting character set Note: TTF Font type is now supported only.

getTtfTables()

public TtfTableRepository getTtfTables()

Gets TTF tables.

Returns: TtfTableRepository - TTF tables.

getCffFont()

public Font getCffFont()

Gets CFF Font if present.

Returns: Font - CFF Font.

getFontType()

public FontType getFontType()

Gets Font type. Returns FontType.TTF value.

Returns: FontType - Font type.

getFontFamily()

public String getFontFamily()

Gets Font family.

Returns: java.lang.String - Font family.

setFontFamily(String value)

public void setFontFamily(String value)

Sets Font family.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew Font family.

getStyle()

public String getStyle()

Gets Font style. This is a raw string value provided by Font file.

Returns: java.lang.String - Font style.

setStyle(String value)

public void setStyle(String value)

Sets Font style. This is a raw string value provided by Font file.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew Font style.

getFontStyle()

public EnumSet<FontStyle> getFontStyle()

Gets Font style. This is a value computed and represented in generalized type.

Returns: java.util.EnumSet<com.aspose.font.FontStyle> - Font style. Usually, a combination of FontStyle class constant flag values or 0.

getFontName()

public String getFontName()

Gets Font face name.

Returns: java.lang.String - Font face name.

setFontName(String value)

public void setFontName(String value)

Sets Font face name.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew Font face name.

getFontNames()

public MultiLanguageString getFontNames()

Gets Font names.

Returns: MultiLanguageString - Font names

getPostscriptNames()

public MultiLanguageString getPostscriptNames()

Gets Postscript font names.

Returns: MultiLanguageString - Postscript font names.

getNumGlyphs()

public int getNumGlyphs()

Gets number of glyphs in the Font.

Returns: int - Number of glyphs in the Font.

isSymbolic()

public boolean isSymbolic()

Returns true in case Font is symbolic.

Returns: boolean - True in case Font is symbolic.

getMetrics()

public IFontMetrics getMetrics()

Gets Font metrics.

Returns: IFontMetrics - Font metrics.

getEncoding()

public IFontEncoding getEncoding()

Gets Font encoding.

Returns: IFontEncoding - Font encoding.

getGlyphIdType()

public GlyphIdType getGlyphIdType()

Gets glyph id type specification.

Returns: GlyphIdType - Glyph id type specification.

getFontDefinition()

public FontDefinition getFontDefinition()

Gets Font definition.

Returns: FontDefinition - Font definition.

getGlyphById(GlyphId id)

public Glyph getGlyphById(GlyphId id)

Returns glyph by glyph id. Glyph id is a unique number for a glyph, which is font type dependent. TTF Font glyph id can be instance of ( GlyphStringId ) class or ( GlyphUInt32Id ) class. Name (string) glyph addressing is supported for TTF Fonts via Post table mapping. In case CFF Font inside, the CFF structures are used to address glyphs by name.

Parameters:

ParameterTypeDescription
idGlyphId

Returns: Glyph

getGlyphById(String glyphName)

public Glyph getGlyphById(String glyphName)

Returns glyph by glyph name. Name (string) glyph addressing is supported for TTF fonts via Post table mapping. In case CFF Font inside, the CFF structures are used to address glyphs by name.

Parameters:

ParameterTypeDescription
glyphNamejava.lang.StringGlyph string identifier.

Returns: Glyph - Glyph.

getGlyphById(long id)

public Glyph getGlyphById(long id)

Returns glyph by glyph id.

Parameters:

ParameterTypeDescription
idlongGlyph index.

Returns: Glyph - Glyph.

getAllGlyphIds()

public GlyphId[] getAllGlyphIds()

Returns array of all glyph ids, available in the Font. Glyph id is a unique number for a glyph, which is font type dependent. TTF Font glyph id can be instance of ( GlyphStringId ) class or ( GlyphUInt32Id ) class. Name (string) glyph addressing is supported for TTF Fonts via Post table mapping. In case CFF Font inside, the CFF structures are used to address glyphs by name.

Returns: com.aspose.font.GlyphId[] - Glyph identifiers.

getGlyphComponentsById(GlyphId id, GlyphIdList componentsToPopulate)

public void getGlyphComponentsById(GlyphId id, GlyphIdList componentsToPopulate)

Gets a glyph by glyph identifier passed and fills passed list of glyph identifiers with components of this glyph. Glyph id is a unique number for a glyph, which is font type dependent. TTF Font glyph id can be instance of ( GlyphStringId ) class or ( GlyphUInt32Id ) class. Name (string) glyph addressing is supported for TTF Fonts via Post table mapping. In case CFF Font inside, the CFF structures are used to address glyphs by name.


Empty collection componentsToPopulate should be passed that will contain glyph components id list.

Parameters:

ParameterTypeDescription
idGlyphIdGlyph id.
componentsToPopulateGlyphIdListList of glyph identifiers to fill.

getGlyphComponentsById(String glyphName, GlyphIdList componentsToPopulate)

public void getGlyphComponentsById(String glyphName, GlyphIdList componentsToPopulate)

Gets a glyph by glyph name passed and fills passed list of glyph identifiers with components of this glyph.


Empty collection componentsToPopulate should be passed that will contain glyph components id list.

Parameters:

ParameterTypeDescription
glyphNamejava.lang.StringGlyph name.
componentsToPopulateGlyphIdListList of glyph identifiers to fill.

getGlyphComponentsById(long id, GlyphIdList componentsToPopulate)

public void getGlyphComponentsById(long id, GlyphIdList componentsToPopulate)

Gets a glyph by glyph index passed and fills passed list of glyph identifiers with components of this glyph.


Empty collection componentsToPopulate should be passed that will contain glyph components id list.

Parameters:

ParameterTypeDescription
idlongGlyph index.
componentsToPopulateGlyphIdListList of glyph identifiers to fill.

getGlyphsForText(String text)

public GlyphId[] getGlyphsForText(String text)

Get glyphs representation for text.

Parameters:

ParameterTypeDescription
textjava.lang.StringInput text.

Returns: com.aspose.font.GlyphId[] - GlyphId array.

convert(FontType fontType)

public Font convert(FontType fontType)

Converts the Font into another format. Note: TTF Font type is now supported only.

Parameters:

ParameterTypeDescription
fontTypeFontTypeFont format type to convert into.

Returns: Font - Font converted into new format.

convert(FontType fontType, Collection limitingCharacterSet)

public Font convert(FontType fontType, Collection<Integer> limitingCharacterSet)

Converts the Font into another format with limiting character set Note: TTF Font type is now supported only.

Parameters:

ParameterTypeDescription
fontTypeFontTypeFont format type to convert into.
limitingCharacterSetjava.util.Collection<java.lang.Integer>Limiting character set.

Returns: Font - Font converted into new format.