Class Font

java.lang.Object
org.jzy3d.painters.Font

public class Font extends Object
A Font subset supported both by OpenGL 1 and AWT. These fonts can be used both for charts based on native OpenGL and charts based on raw AWT. Painters such as NativeDesktopPainter use OpenGL for font rendering and address a font name AND size through a font ID (e.g
invalid @link
IPainter#BITMAP_HELVETICA_10
,
invalid @link
IPainter#BITMAP_HELVETICA_12
, etc). Painters such as EmulGLPainter use AWT for font rendering and may support more font names and size than those provided as default to fit OpenGL 1 spec. To use other fonts than the defaults (e.g. Helvetica_12), simply build them as follow Font font = new org.jzy3d.painters.Painter.Font("Arial", 11); Font names not supported by OpenGL 1 will be ignored. Instead, the default font
invalid @link
IPainter#BITMAP_HELVETICA_12
will apply.
  • Field Details

    • STROKE_ROMAN

      protected static final int STROKE_ROMAN
      See Also:
    • STROKE_MONO_ROMAN

      protected static final int STROKE_MONO_ROMAN
      See Also:
    • BITMAP_9_BY_15

      protected static final int BITMAP_9_BY_15
      See Also:
    • BITMAP_8_BY_13

      protected static final int BITMAP_8_BY_13
      See Also:
    • BITMAP_TIMES_ROMAN_10

      protected static final int BITMAP_TIMES_ROMAN_10
      See Also:
    • BITMAP_TIMES_ROMAN_24

      protected static final int BITMAP_TIMES_ROMAN_24
      See Also:
    • BITMAP_HELVETICA_10

      protected static final int BITMAP_HELVETICA_10
      See Also:
    • BITMAP_HELVETICA_12

      protected static final int BITMAP_HELVETICA_12
      See Also:
    • BITMAP_HELVETICA_18

      protected static final int BITMAP_HELVETICA_18
      See Also:
    • Helvetica_10

      public static final Font Helvetica_10
    • Helvetica_12

      public static final Font Helvetica_12
    • Helvetica_18

      public static final Font Helvetica_18
    • TimesRoman_10

      public static final Font TimesRoman_10
    • TimesRoman_24

      public static final Font TimesRoman_24
    • TIMES_NEW_ROMAN

      protected static final String TIMES_NEW_ROMAN
      See Also:
    • HELVETICA

      protected static final String HELVETICA
      See Also:
    • name

      protected String name
    • code

      protected int code
    • height

      protected int height
    • style

      protected int style
  • Constructor Details

    • Font

      protected Font()
    • Font

      public Font(int code, int height)
    • Font

      public Font(String name, int height)
    • Font

      public Font(String name, int style, int height)
      Build a font from its name. Its OpenGL code will be guessed to ensure the font is usable with OpenGL 1 renderer supporting a limited font set. If the font name is not recognized among such set, the default BITMAP_HELVETICA_12 will be loaded. See also
      invalid @link
      {@link AWTFont.toAWT(font)
      } to convert to AWT an font.
      Parameters:
      name -
      style - a style value. May not be supported by the text renderer
      height -
  • Method Details

    • getName

      public String getName()
    • getCode

      public int getCode()
    • getHeight

      public int getHeight()
    • getStyle

      public int getStyle()
    • setHeight

      public void setHeight(int height)
    • detectFontNameFromOpenGLCode

      protected void detectFontNameFromOpenGLCode(int code)
    • detectOpenGLFontCodeFromName

      protected void detectOpenGLFontCodeFromName(String name, int height)
    • getById

      public static Font getById(int id)
      Load a font from its ID
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public Font clone()
      Overrides:
      clone in class Object