Package org.jzy3d.painters
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 asNativeDesktopPainter
use OpenGL for font rendering and address a font name AND size through a font ID (e.gIPainter#BITMAP_HELVETICA_10
,IPainter#BITMAP_HELVETICA_12
, etc). Painters such asEmulGLPainter
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 followFont font = new org.jzy3d.painters.Painter.Font("Arial", 11);
Font names not supported by OpenGL 1 will be ignored. Instead, the default fontIPainter#BITMAP_HELVETICA_12
will apply.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
BITMAP_8_BY_13
protected static int
BITMAP_9_BY_15
protected static int
BITMAP_HELVETICA_10
protected static int
BITMAP_HELVETICA_12
protected static int
BITMAP_HELVETICA_18
protected static int
BITMAP_TIMES_ROMAN_10
protected static int
BITMAP_TIMES_ROMAN_24
protected int
code
protected int
height
protected static String
HELVETICA
static Font
Helvetica_10
static Font
Helvetica_12
static Font
Helvetica_18
protected String
name
protected static int
STROKE_MONO_ROMAN
protected static int
STROKE_ROMAN
protected int
style
protected static String
TIMES_NEW_ROMAN
static Font
TimesRoman_10
static Font
TimesRoman_24
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
clone()
protected void
detectFontNameFromOpenGLCode(int code)
protected void
detectOpenGLFontCodeFromName(String name, int height)
boolean
equals(Object obj)
static Font
getById(int id)
Load a font from its IDint
getCode()
int
getHeight()
String
getName()
int
getStyle()
int
hashCode()
void
setHeight(int height)
String
toString()
-
-
-
Field Detail
-
STROKE_ROMAN
protected static final int STROKE_ROMAN
- See Also:
- Constant Field Values
-
STROKE_MONO_ROMAN
protected static final int STROKE_MONO_ROMAN
- See Also:
- Constant Field Values
-
BITMAP_9_BY_15
protected static final int BITMAP_9_BY_15
- See Also:
- Constant Field Values
-
BITMAP_8_BY_13
protected static final int BITMAP_8_BY_13
- See Also:
- Constant Field Values
-
BITMAP_TIMES_ROMAN_10
protected static final int BITMAP_TIMES_ROMAN_10
- See Also:
- Constant Field Values
-
BITMAP_TIMES_ROMAN_24
protected static final int BITMAP_TIMES_ROMAN_24
- See Also:
- Constant Field Values
-
BITMAP_HELVETICA_10
protected static final int BITMAP_HELVETICA_10
- See Also:
- Constant Field Values
-
BITMAP_HELVETICA_12
protected static final int BITMAP_HELVETICA_12
- See Also:
- Constant Field Values
-
BITMAP_HELVETICA_18
protected static final int BITMAP_HELVETICA_18
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
HELVETICA
protected static final String HELVETICA
- See Also:
- Constant Field Values
-
name
protected String name
-
code
protected int code
-
height
protected int height
-
style
protected int style
-
-
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 defaultBITMAP_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 rendererheight
-
-
-
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
-
-