Packages

 

com.aspose.cad

Class Font



  • public final class Font
    extends Object

    Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.

    • Constructor Summary

      Constructors 
      Constructor and Description
      Font(Font prototype, int newStyle)
      Initializes a new T:Aspose.CAD.Font that uses the specified existing T:Aspose.CAD.Font and T:Aspose.CAD.FontStyle enumeration.
      Font(String fontName, float emSize)
      Initializes a new T:Aspose.CAD.Font using a specified size.
      Font(String fontName, float emSize, int style)
      Initializes a new T:Aspose.CAD.Font using a specified size and style.
      Font(String fontName, float emSize, int style, int unit)
      Initializes a new T:Aspose.CAD.Font using a specified size, style, and unit.
      Font(String fontName, float emSize, int style, int unit, int characterSet)
      Initializes a new T:Aspose.CAD.Font using a specified size, style, unit, and character set.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      Font deepClone()
      Creates an exact deep copy of this Font.
      boolean equals(Object obj)
      Indicates whether the specified object is a T:Aspose.CAD.Font and has the same property values as this T:Aspose.CAD.Font.
      boolean getBold()
      Gets a value indicating whether this Font is bold.
      int getCharacterSet()
      Gets a byte value that specifies the character set that this Font uses.
      boolean getItalic()
      Gets a value indicating whether this Font is italic.
      String getName()
      Gets the face name of this Font.
      float getSize()
      Gets the em-size of this Font measured in the units specified by the P:Aspose.CAD.Font.Unit property.
      boolean getStrikeout()
      Gets a value indicating whether this Font specifies a horizontal line through the font.
      int getStyle()
      Gets style information for this Font.
      boolean getUnderline()
      Gets a value indicating whether this Font is underlined.
      int getUnit()
      Gets the unit of measure for this Font.
      int hashCode()
      Gets the hash code for this T:Aspose.CAD.Font.
      static Font makeFontWithGraphUnit(String fontName, float emSize, int unit)
      Initializes a new T:Aspose.Imaging.Font using a specified size and unit.
      String toString()
      Returns a human-readable string representation of this T:Aspose.CAD.Font.
    • Constructor Detail

      • Font

        public Font(Font prototype,
            int newStyle)

        Initializes a new T:Aspose.CAD.Font that uses the specified existing T:Aspose.CAD.Font and T:Aspose.CAD.FontStyle enumeration.

        Parameters:
        prototype - The existing T:Aspose.CAD.Font from which to create the new T:Aspose.CAD.Font.
        newStyle - The T:Aspose.CAD.FontStyle to apply to the new T:Aspose.CAD.Font. Multiple values of the T:Aspose.CAD.FontStyle enumeration can be combined with the OR operator.
        Throws:
        T:System.ArgumentNullException - prototype is null.
      • Font

        public Font(String fontName,
            float emSize)

        Initializes a new T:Aspose.CAD.Font using a specified size. The character set is set to F:Aspose.CAD.CharacterSet.Default, the graphics unit to F:Aspose.CAD.GraphicsUnit.Point, the font style to F:Aspose.CAD.FontStyle.Regular.

        Parameters:
        fontName - A string representation of the T:Aspose.CAD.Font name.
        emSize - The em-size, in points, of the new font.
        Throws:
        T:System.ArgumentOutOfRangeException - emSize is less than or equal to 0, evaluates to infinity or is not a valid number.
        T:System.ArgumentNullException - fontName is null.
      • Font

        public Font(String fontName,
            float emSize,
            int style)

        Initializes a new T:Aspose.CAD.Font using a specified size and style. The character set is set to F:Aspose.CAD.CharacterSet.Default, the graphics unit to F:Aspose.CAD.GraphicsUnit.Point.

        Parameters:
        fontName - A string representation of the T:Aspose.CAD.Font name.
        emSize - The em-size, in points, of the new font.
        style - The T:Aspose.CAD.FontStyle of the new font.
        Throws:
        T:System.ArgumentOutOfRangeException - emSize is less than or equal to 0, evaluates to infinity or is not a valid number.
        T:System.ArgumentNullException - fontName is null.
      • Font

        public Font(String fontName,
            float emSize,
            int style,
            int unit,
            int characterSet)

        Initializes a new T:Aspose.CAD.Font using a specified size, style, unit, and character set.

        Parameters:
        fontName - A string representation of the T:Aspose.CAD.Font name.
        emSize - The em-size of the new font in the units specified by the unit parameter.
        style - The T:Aspose.CAD.FontStyle of the new font.
        unit - The T:Aspose.CAD.GraphicsUnit of the new font.
        characterSet - A character set to use for this font.
        Throws:
        T:System.ArgumentOutOfRangeException - emSize is less than or equal to 0, evaluates to infinity or is not a valid number.
        T:System.ArgumentNullException - fontName is null.
      • Font

        public Font(String fontName,
            float emSize,
            int style,
            int unit)

        Initializes a new T:Aspose.CAD.Font using a specified size, style, and unit.

        Parameters:
        fontName - A string representation of the T:Aspose.CAD.Font name.
        emSize - The em-size of the new font in the units specified by the unit parameter.
        style - The T:Aspose.CAD.FontStyle of the new font.
        unit - The T:Aspose.CAD.GraphicsUnit of the new font.
        Throws:
        T:System.ArgumentOutOfRangeException - emSize is less than or equal to 0, evaluates to infinity or is not a valid number.
        T:System.ArgumentNullException - fontName is null.
    • Method Detail

      • makeFontWithGraphUnit

        public static Font makeFontWithGraphUnit(String fontName,
                                 float emSize,
                                 int unit)

        Initializes a new T:Aspose.Imaging.Font using a specified size and unit. The character set is set to F:Aspose.Imaging.CharacterSet.Default, the style is set to F:Aspose.Imaging.FontStyle.Regular.

        Parameters:
        fontName - A string representation of the T:Aspose.Imaging.Font name.
        emSize - The em-size of the new font in the units specified by the unit parameter.
        unit - The T:Aspose.Imaging.GraphicsUnit of the new font.
        Throws:
        com.aspose.ms.System.ArgumentOutOfRangeException - emSize is less than or equal to 0, evaluates to infinity or is not a valid number.
        com.aspose.ms.System.ArgumentNullException - fontName is null.
      • getBold

        public boolean getBold()

        Gets a value indicating whether this Font is bold.

        Returns:
        True if this Font is bold; otherwise, false.
      • getCharacterSet

        public int getCharacterSet()

        Gets a byte value that specifies the character set that this Font uses.

        Returns:
        A character set that this Font uses.
      • getItalic

        public boolean getItalic()

        Gets a value indicating whether this Font is italic.

        Returns:
        True if this Font is italic; otherwise, false.
      • getName

        public String getName()

        Gets the face name of this Font.

        Returns:
        A string representation of the face name of this Font.
      • getStrikeout

        public boolean getStrikeout()

        Gets a value indicating whether this Font specifies a horizontal line through the font.

        Returns:
        True if this Font has a horizontal line through it; otherwise, false.
      • getUnderline

        public boolean getUnderline()

        Gets a value indicating whether this Font is underlined.

        Returns:
        True if this Font is underlined; otherwise, false.
      • getStyle

        public int getStyle()

        Gets style information for this Font.

        Returns:
        A FontStyle enumeration that contains style information for this Font.
      • getSize

        public float getSize()

        Gets the em-size of this Font measured in the units specified by the P:Aspose.CAD.Font.Unit property.

        Returns:
        The em-size of this Font.
      • getUnit

        public int getUnit()

        Gets the unit of measure for this Font.

        Returns:
        A GraphicsUnit that represents the unit of measure for this Font.
      • deepClone

        public Font deepClone()

        Creates an exact deep copy of this Font.

        Returns:
        The Font this method creates.
      • equals

        public boolean equals(Object obj)

        Indicates whether the specified object is a T:Aspose.CAD.Font and has the same property values as this T:Aspose.CAD.Font.

        Overrides:
        equals in class Object
        Parameters:
        obj - The object to test.
        Returns:
        True if the obj parameter is a T:Aspose.CAD.Font and has the same property values as this T:Aspose.CAD.Font; otherwise, false.
      • hashCode

        public int hashCode()

        Gets the hash code for this T:Aspose.CAD.Font.

        Overrides:
        hashCode in class Object
        Returns:
        The hash code for this T:Aspose.CAD.Font.
      • toString

        public String toString()

        Returns a human-readable string representation of this T:Aspose.CAD.Font.

        Overrides:
        toString in class Object
        Returns:
        A string that represents this T:Aspose.CAD.Font.