greenfoot

## Class Font

- java.lang.Object
- - greenfoot.Font

-     public class Font
      extends java.lang.Object

  A representation of a Font. The Font can be used to write text on the screen.
  Author:
    Fabio Heday, Amjad Altadmri

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Font(boolean bold, boolean italic, int size)` Creates a sans serif font with the specified size and style.
    `Font(int size)` Creates a sans serif font of a given size.
    `Font(java.lang.String name, boolean bold, boolean italic, int size)` Creates a font from the specified font name, size and style.
    `Font(java.lang.String name, int size)` Creates a font from the specified font name and size.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Font` | `deriveFont(float size)` Returns a new `Font` object obtained by deriving the `java.awt.Font font` field applying a new size to it.
    `boolean` | `equals(java.lang.Object obj)` * Determines whether another object is equal to this font.
    `java.lang.String` | `getName()` Returns the logical name of this font.
    `int` | `getSize()` Returns the point size of this font, rounded to an integer.
    `int` | `hashCode()` Returns a hashcode for this font.
    `boolean` | `isBold()` Indicates whether or not this Font style is bold.
    `boolean` | `isItalic()` Indicates whether or not this Font style is italic.
    `boolean` | `isPlain()` Indicates whether or not this Font style is plain.
    `java.lang.String` | `toString()` Return a text representation of the font.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Font

          public Font(java.lang.String name,
                      boolean bold,
                      boolean italic,
                      int size)

      Creates a font from the specified font name, size and style.
      Parameters:
        `name` - The font name
        `bold` - True if the font is meant to be bold
        `italic` - True if the font is meant to be italic
        `size` - The size of the font

    - #### Font

          public Font(boolean bold,
                      boolean italic,
                      int size)

      Creates a sans serif font with the specified size and style.
      Parameters:
        `bold` - True if the font is meant to be bold
        `italic` - True if the font is meant to be italic
        `size` - The size of the font

    - #### Font

          public Font(java.lang.String name,
                      int size)

      Creates a font from the specified font name and size.
      Parameters:
        `name` - The font name
        `size` - The size of the font

    - #### Font

          public Font(int size)

      Creates a sans serif font of a given size.
      Parameters:
        `size` - The size of the font

  - ### Method Detail

    - #### isPlain

          public boolean isPlain()

      Indicates whether or not this Font style is plain.
      Returns:
        true if this font style is plain; false otherwise

    - #### isBold

          public boolean isBold()

      Indicates whether or not this Font style is bold.
      Returns:
        true if this font style is bold; false otherwise

    - #### isItalic

          public boolean isItalic()

      Indicates whether or not this Font style is italic.
      Returns:
        true if this font style is italic; false otherwise

    - #### getName

          public java.lang.String getName()

      Returns the logical name of this font.
      Returns:
        a `String` representing the logical name of this font.

    - #### getSize

          public int getSize()

      Returns the point size of this font, rounded to an integer.
      Returns:
        the point size of this font in 1/72 of an inch units.

    - #### deriveFont

          public Font deriveFont(float size)

      Returns a new `Font` object obtained by deriving the `java.awt.Font font` field applying a new size to it.
      Parameters:
        `size` - the size for the new `Font`
      Returns:
        a new `Font` object.

    - #### equals

          public boolean equals(java.lang.Object obj)

      * Determines whether another object is equal to this font.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object to test for equality with this font
      Returns:
        true if the fonts are the same; false otherwise.

    - #### hashCode

          public int hashCode()

      Returns a hashcode for this font.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hashcode value for this font.

    - #### toString

          public java.lang.String toString()

      Return a text representation of the font.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:

Greenfoot homepage