Packages

 

com.aspose.imaging

Interfaces

Classes

Exceptions

com.aspose.imaging

Class StringFormat

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public final class StringFormat
    extends DisposableObject

    Encapsulates text layout information (such as alignment, orientation and tab stops) display manipulations (such as ellipsis insertion and national digit substitution) and OpenType features. This class cannot be inherited.

    • Constructor Summary

      Constructors 
      Constructor and Description
      StringFormat()
      Initializes a new com.aspose.imaging.StringFormat object.
      StringFormat(int options)
      Initializes a new com.aspose.imaging.StringFormat object with the specified com.aspose.imaging.StringFormatFlags enumeration and language.
      StringFormat(StringFormat format)
      Initializes a new com.aspose.imaging.StringFormat object from the specified existing com.aspose.imaging.StringFormat object.
    • Constructor Detail

      • StringFormat

        public StringFormat()

        Initializes a new com.aspose.imaging.StringFormat object.

      • StringFormat

        public StringFormat(int options)

        Initializes a new com.aspose.imaging.StringFormat object with the specified com.aspose.imaging.StringFormatFlags enumeration and language.

        Parameters:
        options - The com.aspose.imaging.StringFormatFlags enumeration for the new com.aspose.imaging.StringFormat object.
      • StringFormat

        public StringFormat(StringFormat format)

        Initializes a new com.aspose.imaging.StringFormat object from the specified existing com.aspose.imaging.StringFormat object.

        Parameters:
        format - The com.aspose.imaging.StringFormat object from which to initialize the new com.aspose.imaging.StringFormat object.
        Throws:
        com.aspose.ms.System.ArgumentNullException - format is null.
    • Method Detail

      • getGenericDefault

        public static StringFormat getGenericDefault()

        Gets a generic default com.aspose.imaging.StringFormat object.

        Returns:
        The generic default com.aspose.imaging.StringFormat object.
      • getGenericTypographic

        public static StringFormat getGenericTypographic()

        Gets a generic typographic com.aspose.imaging.StringFormat object.

        Returns:
        A generic typographic com.aspose.imaging.StringFormat object.
      • getFormatFlags

        public int getFormatFlags()

        Gets a com.aspose.imaging.StringFormatFlags enumeration that contains formatting information.

        Returns:
        A com.aspose.imaging.StringFormatFlags enumeration that contains formatting information.
      • setFormatFlags

        public void setFormatFlags(int value)

        Sets a com.aspose.imaging.StringFormatFlags enumeration that contains formatting information.

        Parameters:
        value - A com.aspose.imaging.StringFormatFlags enumeration that contains formatting information.
      • getAlignment

        public int getAlignment()

        Gets text alignment information on the vertical plane.

        Returns:
        A com.aspose.imaging.StringAlignment enumeration that specifies text alignment information.
      • setAlignment

        public void setAlignment(int value)

        Sets text alignment information on the vertical plane.

        Parameters:
        value - A com.aspose.imaging.StringAlignment enumeration that specifies text alignment information.
      • getLineAlignment

        public int getLineAlignment()

        Gets the line alignment on the horizontal plane.

        Returns:
        A com.aspose.imaging.StringAlignment enumeration that represents the line alignment.
      • setLineAlignment

        public void setLineAlignment(int value)

        Sets the line alignment on the horizontal plane.

        Parameters:
        value - A com.aspose.imaging.StringAlignment enumeration that represents the line alignment.
      • getHotkeyPrefix

        public int getHotkeyPrefix()

        Gets the com.aspose.imaging.HotkeyPrefix object for this com.aspose.imaging.StringFormat object.

        Returns:
        The com.aspose.imaging.HotkeyPrefix object for this com.aspose.imaging.StringFormat object, the default is F:Aspose.Imaging.HotkeyPrefix.None.
      • setHotkeyPrefix

        public void setHotkeyPrefix(int value)

        Sets the com.aspose.imaging.HotkeyPrefix object for this com.aspose.imaging.StringFormat object.

        Parameters:
        value - The com.aspose.imaging.HotkeyPrefix object for this com.aspose.imaging.StringFormat object, the default is F:Aspose.Imaging.HotkeyPrefix.None.
      • getTrimming

        public int getTrimming()

        Gets the com.aspose.imaging.StringTrimming enumeration for this com.aspose.imaging.StringFormat object.

        Returns:
        A com.aspose.imaging.StringTrimming enumeration that indicates how text drawn with this com.aspose.imaging.StringFormat object is trimmed when it exceeds the edges of the layout rectangle.
      • setTrimming

        public void setTrimming(int value)

        Sets the com.aspose.imaging.StringTrimming enumeration for this com.aspose.imaging.StringFormat object.

        Parameters:
        value - A com.aspose.imaging.StringTrimming enumeration that indicates how text drawn with this com.aspose.imaging.StringFormat object is trimmed when it exceeds the edges of the layout rectangle.
      • getDigitSubstitutionMethod

        public int getDigitSubstitutionMethod()

        Gets the method to be used for digit substitution.

        Returns:
        A com.aspose.imaging.StringDigitSubstitute enumeration value that specifies how to substitute characters in a string that cannot be displayed because they are not supported by the current font.

        The setter is introduced for the obsolete method SetDigitSubstitution.

      • setDigitSubstitutionMethod

        public void setDigitSubstitutionMethod(int value)

        Sets the method to be used for digit substitution.

        Parameters:
        value - A com.aspose.imaging.StringDigitSubstitute enumeration value that specifies how to substitute characters in a string that cannot be displayed because they are not supported by the current font.

        The setter is introduced for the obsolete method SetDigitSubstitution.

      • getDigitSubstitutionLanguage

        public int getDigitSubstitutionLanguage()

        Gets the language that is used when local digits are substituted for western digits.

        Returns:
        A National Language Support (NLS) language identifier that identifies the language that will be used when local digits are substituted for western digits. You can pass the P:System.Globalization.CultureInfo.LCID property of a System.Globalization.CultureInfo object as the NLS language identifier. For example, suppose you create a System.Globalization.CultureInfo object by passing the string "ar-EG" to a System.Globalization.CultureInfo constructor. If you pass the P:System.Globalization.CultureInfo.LCID property of that System.Globalization.CultureInfo object along with. com.aspose.imaging.StringDigitSubstitute.Traditional to the com.aspose.imaging.StringFormat.setDigitSubstitution(int, com.aspose.imaging.StringDigitSubstitute) method, then Arabic-Indic digits will be substituted for western digits at display time.

        The setter is introduced for the obsolete method setDigitSubstitution.

      • setDigitSubstitutionLanguage

        public void setDigitSubstitutionLanguage(int value)

        Sets the language that is used when local digits are substituted for western digits.

        Parameters:
        value - A National Language Support (NLS) language identifier that identifies the language that will be used when local digits are substituted for western digits. You can pass the P:System.Globalization.CultureInfo.LCID property of a System.Globalization.CultureInfo object as the NLS language identifier. For example, suppose you create a System.Globalization.CultureInfo object by passing the string "ar-EG" to a System.Globalization.CultureInfo constructor. If you pass the P:System.Globalization.CultureInfo.LCID property of that System.Globalization.CultureInfo object along with. com.aspose.imaging.StringDigitSubstitute.Traditional to the com.aspose.imaging.StringFormat.setDigitSubstitution(int,com.aspose.imaging.StringDigitSubstitute) method, then Arabic-Indic digits will be substituted for western digits at display time.

        The setter is introduced for the obsolete method SetDigitSubstitution.

      • getFirstTabOffset

        public float getFirstTabOffset()

        Gets the number of spaces between the beginning of a line of text and the first tab stop.

        Returns:
        The first tab offset.

        The property is introduced for removed method GetTabStops.

      • getTabStops

        public float[] getTabStops()

        Gets an array of distances between tab stops in the units specified by the P:Aspose.Imaging.getGraphics().PageUnit property.

        Returns:
        The tab stops.

        The property is introduced for removed method GetTabStops.

      • deepClone

        public StringFormat deepClone()

        Creates a deep clone of this com.aspose.imaging.StringFormat object.

        Returns:
        The deep clone of the current com.aspose.imaging.StringFormat.
      • setTabStops

        public void setTabStops(float firstTabOffset,
                                float[] tabStops)

        Sets tab stops for this com.aspose.imaging.StringFormat object.

        Parameters:
        firstTabOffset - The number of spaces between the beginning of a line of text and the first tab stop.
        tabStops - An array of distances between tab stops in the units specified by the com.aspose.imaging.Graphics.PageUnit property.
      • toString

        public String toString()

        Converts this com.aspose.imaging.StringFormat object to a human-readable string.

        Overrides:
        toString in class Object
        Returns:
        A string representation of this com.aspose.imaging.StringFormat object.