Class 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 IPainter#BITMAP_HELVETICA_10, 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 IPainter#BITMAP_HELVETICA_12 will apply.
    • Constructor Detail

      • 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 {@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 Detail

      • 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