Class Font

java.lang.Object
javafx.scene.text.Font

public class Font extends Object
Author:
Bruno Salmon
  • Constructor Details

    • Font

      public Font(double size)
      Constructs a font using the default face "System". The underlying font used is determined by the implementation based on the typical UI font for the current UI environment.
      Parameters:
      size - the font size to use
    • Font

      public Font(String name, double size)
      Constructs a font using the specified full face name and size
      Parameters:
      name - full name of the font.
      size - the font size to use
    • Font

      public Font(String family, FontWeight weight, FontPosture posture, double size)
    • Font

      public Font(String name, String family, FontWeight weight, FontPosture posture, double size)
  • Method Details

    • font

      public static Font font(String family)
      Searches for an appropriate font based on the given font family name and default font size. This method is not guaranteed to return a specific font, but does its best to find one that fits the specified requirements. A null or empty value for family allows the implementation to select any suitable font.
      Parameters:
      family - The family of the font
      Returns:
      The font that best fits the specified requirements.
    • getName

      public String getName()
    • getFamily

      public String getFamily()
    • getWeight

      public FontWeight getWeight()
    • getPosture

      public FontPosture getPosture()
    • getSize

      public double getSize()
    • getUrl

      public String getUrl()
    • isBaselineOffsetSet

      public boolean isBaselineOffsetSet()
    • getBaselineOffset

      public double getBaselineOffset()
    • setBaselineOffset

      public void setBaselineOffset(double baselineOffset)
    • font

      public static Font font(String family, FontWeight weight, FontPosture posture, double size)
    • font

      public static Font font(String family, FontPosture posture, double size)
    • font

      public static Font font(String family, FontWeight weight, double size)
    • font

      public static Font font(String family, double size)
    • font

      public static Font font(double size)
    • getDefault

      public static Font getDefault()
      Gets the default font which will be from the family "System", and typically the style "Regular", and be of a size consistent with the user's desktop environment, to the extent that can be determined.
      Returns:
      The default font.
    • loadFont

      public static Font loadFont(String url, double size)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public static ObservableList<Font> getRequestedFonts()
    • getLoadingFonts

      public static ObservableList<Font> getLoadingFonts()