TtfFont

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

public class TtfFont extends Font

Represents TrueType Font (TTF).

Methods

MethodDescription
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.
equals(Object arg0)
getAllGlyphIds()Returns array of all glyph ids, available in the Font.
getCffFont()Gets CFF Font if present.
getClass()
getEncoding()Gets Font encoding.
getFontDefinition()Gets Font definition.
getFontFamily()Gets Font family.
getFontName()Gets Font face name.
getFontNames()Gets Font names.
getFontSaver()Gets Font save functionality.
getFontStyle()Gets Font style.
getFontType()Gets Font type.
getGlyphAccessor()Font glyph accessor.
getGlyphById(GlyphId id)Returns glyph by glyph id.
getGlyphById(String glyphName)Returns glyph by glyph name.
getGlyphById(long id)Returns glyph by glyph id.
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.
getGlyphIdType()Gets glyph id type specification.
getGlyphsForText(String text)Get glyphs representation for text.
getMetrics()Gets Font metrics.
getNumGlyphs()Gets number of glyphs in the Font.
getPostscriptNames()Gets Postscript font names.
getStyle()Gets Font style.
getTtfTables()Gets TTF tables.
hashCode()
isSymbolic()Returns true in case Font is symbolic.
notify()
notifyAll()
open(FontDefinition fontDefinition)Opens a font, using FontDefinition object.
open(FontType fontType, byte[] fontData)Opens a font, using font type and font data byte array.
open(FontType fontType, StreamSource fontStreamSource)Opens a font, using font type and stream source.
open(FontType fontType, String fileName)Opens a font, using font type and font file name.
save(OutputStream stream)Saves the Font into original format.
save(String fileName)Saves the Font into original format.
saveToFormat(OutputStream stream, FontSavingFormats outFormat)Saves the Font into format specified.
setFontFamily(String value)Sets Font family.
setFontName(String value)Sets Font face name.
setStyle(String value)Sets Font style.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

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.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

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.

getCffFont()

public Font getCffFont()

Gets CFF Font if present.

Returns: Font - CFF Font.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getEncoding()

public IFontEncoding getEncoding()

Gets Font encoding.

Returns: IFontEncoding - Font encoding.

getFontDefinition()

public FontDefinition getFontDefinition()

Gets Font definition.

Returns: FontDefinition - Font definition.

getFontFamily()

public String getFontFamily()

Gets Font family.

Returns: java.lang.String - Font family.

getFontName()

public String getFontName()

Gets Font face name.

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

getFontNames()

public MultiLanguageString getFontNames()

Gets Font names.

Returns: MultiLanguageString - Font names

getFontSaver()

public IFontSaver getFontSaver()

Gets Font save functionality.

Returns: IFontSaver - Font save functionality.

getFontStyle()

public int getFontStyle()

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

Returns: int - Font style. Usually, a combination of FontStyle class constant flag values or 0.

getFontType()

public FontType getFontType()

Gets Font type. Returns FontType.TTF value.

Returns: FontType - Font type.

getGlyphAccessor()

public IGlyphAccessor getGlyphAccessor()

Font glyph accessor. Retrieves glyphs and glyph identifiers.

Returns: IGlyphAccessor - Font glyph accessor.

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.

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.

getGlyphIdType()

public GlyphIdType getGlyphIdType()

Gets glyph id type specification.

Returns: GlyphIdType - Glyph id type specification.

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.

getMetrics()

public IFontMetrics getMetrics()

Gets Font metrics.

Returns: IFontMetrics - Font metrics.

getNumGlyphs()

public int getNumGlyphs()

Gets number of glyphs in the Font.

Returns: int - Number of glyphs in the Font.

getPostscriptNames()

public MultiLanguageString getPostscriptNames()

Gets Postscript font names.

Returns: MultiLanguageString - Postscript font names.

getStyle()

public String getStyle()

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

Returns: java.lang.String - Font style.

getTtfTables()

public TtfTableRepository getTtfTables()

Gets TTF tables.

Returns: TtfTableRepository - TTF tables.

hashCode()

public native int hashCode()

Returns: int

isSymbolic()

public boolean isSymbolic()

Returns true in case Font is symbolic.

Returns: boolean - True in case Font is symbolic.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

open(FontDefinition fontDefinition)

public static Font open(FontDefinition fontDefinition)

Opens a font, using FontDefinition object.

Parameters:

ParameterTypeDescription
fontDefinitionFontDefinitionFont definition object.

Returns: Font - Font loaded.

open(FontType fontType, byte[] fontData)

public static Font open(FontType fontType, byte[] fontData)

Opens a font, using font type and font data byte array.

Parameters:

ParameterTypeDescription
fontTypeFontTypeFont type.
fontDatabyte[]Byte array to load font from.

Returns: Font - Font loaded.

open(FontType fontType, StreamSource fontStreamSource)

public static Font open(FontType fontType, StreamSource fontStreamSource)

Opens a font, using font type and stream source.

Parameters:

ParameterTypeDescription
fontTypeFontTypeFont type.
fontStreamSourceStreamSourceStream source for font.

Returns: Font - Font loaded.

open(FontType fontType, String fileName)

public static Font open(FontType fontType, String fileName)

Opens a font, using font type and font file name.

Parameters:

ParameterTypeDescription
fontTypeFontTypeFont type.
fileNamejava.lang.StringFont file name.

Returns: Font - Font loaded.

save(OutputStream stream)

public void save(OutputStream stream)

Saves the Font into original format.


Note: following Font types are supported for saving:
 New TTF fonts;
 TTF Font subsets;
 CFF Font subsets;
 Type1 Font subsets.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamStream to save font.

save(String fileName)

public void save(String fileName)

Saves the Font into original format.


Note: following Font types are supported for saving:
 New TTF fonts;
 TTF Font subsets;
 CFF Font subsets;
 Type1 Font subsets.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringFile to save font.

saveToFormat(OutputStream stream, FontSavingFormats outFormat)

public void saveToFormat(OutputStream stream, FontSavingFormats outFormat)

Saves the Font into format specified.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamstream to save font
outFormatFontSavingFormatsdesired format

setFontFamily(String value)

public void setFontFamily(String value)

Sets Font family.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew Font family.

setFontName(String value)

public void setFontName(String value)

Sets Font face name.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew Font face name.

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.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int