public abstract class Font extends Object implements IFont, IGlyphAccessor, IFontSaver
Represents base Font class.
Modifier and Type | Method and Description |
---|---|
abstract Font |
convert(FontType fontType)
Converts the Font into another format.
|
abstract GlyphId[] |
getAllGlyphIds()
Returns all glyph ids, available in the Font.
|
abstract IFontEncoding |
getEncoding()
Gets Font encoding.
|
abstract FontDefinition |
getFontDefinition()
Gets Font definition.
|
abstract String |
getFontFamily()
Gets Font family.
|
abstract String |
getFontName()
Gets Font face name.
|
abstract MultiLanguageString |
getFontNames()
Gets Font names.
|
IFontSaver |
getFontSaver()
Gets Font save functionality.
|
abstract int |
getFontStyle()
Gets Font style.
|
abstract FontType |
getFontType()
Gets Font type.
|
IGlyphAccessor |
getGlyphAccessor()
Font glyph accessor.
|
abstract Glyph |
getGlyphById(GlyphId id)
Returns glyph by glyph Id.
|
abstract GlyphIdType |
getGlyphIdType()
Glyph id type specification.
|
GlyphId[] |
getGlyphsForText(String text)
Gets glyphs representation for text.
|
abstract IFontMetrics |
getMetrics()
Gets Font metrics.
|
abstract int |
getNumGlyphs()
Gets number of glyphs in the Font.
|
abstract MultiLanguageString |
getPostscriptNames()
Gets postscript font names.
|
abstract String |
getStyle()
Gets Font style.
|
static Font |
open(FontDefinition fontDefinition)
Opens a font, using FontDefinition object.
|
static Font |
open(FontType fontType,
byte[] fontData)
Opens a font, using font type and font data byte array.
|
static Font |
open(FontType fontType,
StreamSource fontStreamSource)
Opens a font, using font type and stream source.
|
static Font |
open(FontType fontType,
String fileName)
Opens a font, using font type and font file name.
|
void |
save(OutputStream stream)
Saves the Font into original format.
|
void |
save(String fileName)
Saves the Font into original format.
|
void |
saveToFormat(OutputStream stream,
FontSavingFormats outFormat)
Saves the Font into format specified.
|
abstract void |
setFontFamily(String value)
Sets Font family.
|
abstract void |
setFontName(String value)
Sets Font face name.
|
abstract void |
setStyle(String value)
Sets Font style.
|
public static Font open(FontDefinition fontDefinition)
Opens a font, using FontDefinition object.
fontDefinition
- Font definition object.public static Font open(FontType fontType, StreamSource fontStreamSource)
Opens a font, using font type and stream source.
fontType
- Font type.fontStreamSource
- Stream source for font.public static Font open(FontType fontType, String fileName)
Opens a font, using font type and font file name.
fontType
- Font type.fileName
- Font file name.public static Font open(FontType fontType, byte[] fontData)
Opens a font, using font type and font data byte array.
fontType
- Font type.fontData
- Byte array to load font from.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.
save
in interface IFontSaver
stream
- Stream to save font.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.
save
in interface IFontSaver
fileName
- File to save font.public void saveToFormat(OutputStream stream, FontSavingFormats outFormat) throws IOException
Saves the Font into format specified.
saveToFormat
in interface IFontSaver
stream
- stream to save fontoutFormat
- desired formatIOException
- when there's a problem while saving.public abstract Font convert(FontType fontType)
Converts the Font into another format.
fontType Font format type to convert into.Note: TTF Font type is now supported only.
public GlyphId[] getGlyphsForText(String text)
Gets glyphs representation for text.
getGlyphsForText
in interface IGlyphAccessor
text
- Input text.public abstract FontType getFontType()
Gets Font type.
Type1, TrueType etc.
getFontType
in interface IFont
public abstract String getStyle()
Gets Font style. This is a raw string value provided by Font file.
public abstract void setStyle(String value)
Sets Font style. This is a raw string value provided by Font file.
public abstract int getFontStyle()
Gets Font style. This is a value computed and represented in generalized type.
getFontStyle
in interface IFont
public abstract String getFontFamily()
Gets Font family.
getFontFamily
in interface IFont
public abstract void setFontFamily(String value)
Sets Font family.
setFontFamily
in interface IFont
value
- New Font family.public abstract String getFontName()
Gets Font face name.
getFontName
in interface IFont
public abstract void setFontName(String value)
Sets Font face name.
setFontName
in interface IFont
value
- New Font face name.public abstract MultiLanguageString getFontNames()
Gets Font names.
getFontNames
in interface IFont
public abstract MultiLanguageString getPostscriptNames()
Gets postscript font names.
getPostscriptNames
in interface IFont
public abstract int getNumGlyphs()
Gets number of glyphs in the Font.
getNumGlyphs
in interface IFont
public abstract IFontMetrics getMetrics()
Gets Font metrics.
getMetrics
in interface IFont
public abstract IFontEncoding getEncoding()
Gets Font encoding.
getEncoding
in interface IFont
public IGlyphAccessor getGlyphAccessor()
Font glyph accessor. Retrieves glyphs and glyph identifiers.
getGlyphAccessor
in interface IFont
public abstract Glyph getGlyphById(GlyphId id)
Returns glyph by glyph Id.
Glyph id is a unique number for a glyph, which is font type dependent. GlyphId - derived object.
for example:
Type1's id is a glyph name, instance of (GlyphStringId
) class.
TTF's id is an int index, instance of (GlyphInt32Id
) class.
getGlyphById
in interface IGlyphAccessor
id
- Glyph id.public abstract GlyphId[] getAllGlyphIds()
Returns all glyph ids, available in the Font.
Glyph id is a unique number for a glyph, which is font type dependent.
for example:
Type1's id is a glyph name, instance of (GlyphStringId
) class.
TTF's id is an int index, instance of (GlyphInt32Id
) class.
getAllGlyphIds
in interface IGlyphAccessor
public abstract GlyphIdType getGlyphIdType()
Glyph id type specification. For consumers who needs to know the 'bytes[]' real type.
getGlyphIdType
in interface IGlyphAccessor
public abstract FontDefinition getFontDefinition()
Gets Font definition.
getFontDefinition
in interface IFont
public IFontSaver getFontSaver()
Gets Font save functionality.
getFontSaver
in interface IFont