Class MFont

java.lang.Object
chemaxon.struc.graphics.MFont
All Implemented Interfaces:
Serializable, Cloneable

@PublicApi public class MFont extends Object implements Serializable, Cloneable
Font wrapper class that does not require an X server.
Since:
Marvin 4.1, 11/29/2005
See Also:
  • Field Details

  • Constructor Details

    • MFont

      public MFont(String family, int style, double size)
      Contructs a font.
      Parameters:
      family - the family
      style - the style
      size - the size
    • MFont

      public MFont(String str) throws IllegalArgumentException
      Parses a font from a string.
      Parameters:
      str - the string to be converted
      Throws:
      IllegalArgumentException
    • MFont

      public MFont(MFont f)
      Copy constructor.
      Parameters:
      f - the font to copy
    • MFont

      public MFont(Font f)
      Create a wrapper for the specified AWT font.
      Parameters:
      f - the AWT font
  • Method Details

    • getFamily

      public String getFamily()
      Gets the font family name.
      Returns:
      the font family
    • getStyle

      public int getStyle()
      Gets the font style.
      Returns:
      the font style
    • getSizeDouble

      public double getSizeDouble()
      Gets the font size.
      Returns:
      the font size
    • isBold

      public boolean isBold()
      Tests whether the font is bold.
      Returns:
      true if the font is bold, false otherwise
    • isItalic

      public boolean isItalic()
      Tests whether the font is italic.
      Returns:
      true if the font is italic, false otherwise
    • getAWTFont

      public Font getAWTFont()
      Gets an AWT font instance.
      Returns:
      the AWT font
    • getScaledAWTFont

      public Font getScaledAWTFont(Float scale)
      Gets an AWT font instance after scaling.
      Parameters:
      scale - the scaling factor
      Returns:
      the AWT font
    • getString

      public String getString()
      Gets the string representation.
      Returns:
      the string representation
    • equals

      public boolean equals(Object o)
      Tests whether two font objects equal.
      Overrides:
      equals in class Object
      Returns:
      true if they are equal, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • cloneMFont

      public MFont cloneMFont()
      Creates a clone.
      Returns:
      the clone
    • clone

      public Object clone()
      Creates a clone.
      Overrides:
      clone in class Object
      Returns:
      the clone
    • sizeToString

      public static String sizeToString(double size)
      Converts an integer or fractional size to a string.
      Returns:
      the string
    • toString

      public String toString()
      Overrides:
      toString in class Object