com.aspose.font

Interfaces

Classes

Enums

Exceptions

com.aspose.font

Class Font

    • Method Detail

      • open

        public static Font open(FontDefinition fontDefinition)

        Opens a font, using FontDefinition object.

        Parameters:
        fontDefinition - Font definition object.
        Returns:
        Font loaded.
      • open

        public static Font open(FontType fontType,
                                StreamSource fontStreamSource)

        Opens a font, using font type and stream source.

        Parameters:
        fontType - Font type.
        fontStreamSource - Stream source for font.
        Returns:
        Font loaded.
      • open

        public static Font open(FontType fontType,
                                String fileName)

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

        Parameters:
        fontType - Font type.
        fileName - Font file name.
        Returns:
        Font loaded.
      • open

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

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

        Parameters:
        fontType - Font type.
        fontData - Byte array to load font from.
        Returns:
        Font loaded.
      • save

        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.
         
        Specified by:
        save in interface IFontSaver
        Parameters:
        stream - Stream to save font.
      • save

        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.
         
        Specified by:
        save in interface IFontSaver
        Parameters:
        fileName - File to save font.
      • convert

        public abstract Font convert(FontType fontType)

        Converts the Font into another format.


         Note: TTF Font type is now supported only.
         
        fontType Font format type to convert into.
        Specified by:
        convert in interface IFont
        Parameters:
        fontType - type to convert to font into
        Returns:
        Font converted into new format.
      • getGlyphsForText

        public GlyphId[] getGlyphsForText(String text)

        Gets glyphs representation for text.

        Specified by:
        getGlyphsForText in interface IGlyphAccessor
        Parameters:
        text - Input text.
        Returns:
        GlyphId array.
      • getFontType

        public abstract FontType getFontType()

        Gets Font type.


        Type1, TrueType etc.
        Specified by:
        getFontType in interface IFont
        Returns:
        Font type.
      • getStyle

        public abstract String getStyle()

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

        Specified by:
        getStyle in interface IFont
        Returns:
        Font style.
      • setStyle

        public abstract void setStyle(String value)

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

        Specified by:
        setStyle in interface IFont
        Parameters:
        value - New Font style.
      • getFontStyle

        public abstract int getFontStyle()

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

        Specified by:
        getFontStyle in interface IFont
        Returns:
        Font style. Usually, a combination of FontStyle class constant flag values or 0.
      • getFontFamily

        public abstract String getFontFamily()

        Gets Font family.

        Specified by:
        getFontFamily in interface IFont
        Returns:
        Font family.
      • setFontFamily

        public abstract void setFontFamily(String value)

        Sets Font family.

        Specified by:
        setFontFamily in interface IFont
        Parameters:
        value - New Font family.
      • getFontName

        public abstract String getFontName()

        Gets Font face name.

        Specified by:
        getFontName in interface IFont
        Returns:
        Font face name.
      • setFontName

        public abstract void setFontName(String value)

        Sets Font face name.

        Specified by:
        setFontName in interface IFont
        Parameters:
        value - New Font face name.
      • getNumGlyphs

        public abstract int getNumGlyphs()

        Gets number of glyphs in the Font.

        Specified by:
        getNumGlyphs in interface IFont
        Returns:
        Number of glyphs in the Font.
      • getMetrics

        public abstract IFontMetrics getMetrics()

        Gets Font metrics.

        Specified by:
        getMetrics in interface IFont
        Returns:
        Font metrics.
      • getEncoding

        public abstract IFontEncoding getEncoding()

        Gets Font encoding.

        Specified by:
        getEncoding in interface IFont
        Returns:
        Font encoding.
      • getGlyphAccessor

        public IGlyphAccessor getGlyphAccessor()

        Font glyph accessor. Retrieves glyphs and glyph identifiers.

        Specified by:
        getGlyphAccessor in interface IFont
        Returns:
        Font glyph accessor.
      • getGlyphById

        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.

        Specified by:
        getGlyphById in interface IGlyphAccessor
        Parameters:
        id - Glyph id.
        Returns:
        Glyph.
      • getAllGlyphIds

        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.

        Specified by:
        getAllGlyphIds in interface IGlyphAccessor
        Returns:
        Glyph identifiers.
      • getGlyphIdType

        public abstract GlyphIdType getGlyphIdType()

        Glyph id type specification. For consumers who needs to know the 'bytes[]' real type.

        Specified by:
        getGlyphIdType in interface IGlyphAccessor
        Returns:
        Id type specification
      • getFontSaver

        public IFontSaver getFontSaver()

        Gets Font save functionality.

        Specified by:
        getFontSaver in interface IFont
        Returns:
        Font save functionality.