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 asNativeDesktopPainteruse 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 asEmulGLPainteruse 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_12will apply. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static intBITMAP_8_BY_13protected static intBITMAP_9_BY_15protected static intBITMAP_HELVETICA_10protected static intBITMAP_HELVETICA_12protected static intBITMAP_HELVETICA_18protected static intBITMAP_TIMES_ROMAN_10protected static intBITMAP_TIMES_ROMAN_24protected intcodeprotected intheightprotected static StringHELVETICAstatic FontHelvetica_10static FontHelvetica_12static FontHelvetica_18protected Stringnameprotected static intSTROKE_MONO_ROMANprotected static intSTROKE_ROMANprotected intstyleprotected static StringTIMES_NEW_ROMANstatic FontTimesRoman_10static FontTimesRoman_24 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Fontclone()protected voiddetectFontNameFromOpenGLCode(int code)protected voiddetectOpenGLFontCodeFromName(String name, int height)booleanequals(Object obj)static FontgetById(int id)Load a font from its IDintgetCode()intgetHeight()StringgetName()intgetStyle()inthashCode()voidsetHeight(int height)StringtoString() 
 - 
 
- 
- 
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_12will 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 
 - 
 
 -