com.jinke.gui
Class Font

java.lang.Object
  extended by com.jinke.gui.Font

public class Font
extends java.lang.Object


Field Summary
static int BOLD
          Bold
private  int fontID
          fontID, max 8 in system?
static int ITALIC
          Italic
static int NONE
          Plain
static int UNDERLINE
          Underline
 
Constructor Summary
Font(int i)
          //TODO: Creates font with given fontID?
Font(java.lang.String s, int i, int j)
          Creates font with given parameters.
 
Method Summary
 int createFont(byte[] abyte0, int i)
          Native probably nano-X: GrCreateFont
 void destoryFont(int i)
          native: GrDestroyFont?
 void destroy()
          Releases resources of font.
protected  void finalize()
          Releases resources of font.
 int getBaseLine()
          Returns Baseline of font.
 int getBaseLine(int i)
          native
 int getDescent()
          Returns descent for chars like: qypgj
 int getDescent(int i)
          native
 int getFontID()
          FontID registered in system.
 int getSize()
          Returns size.
 int getSize(int i)
          native
 int getStringWidth(int i, java.lang.String s)
          native: GrGetGCTextSize?
 int getStringWidth(java.lang.String s)
          Returns width of String in this font.
 void setAttribute(int i)
          Bold, italic, etc.
 void setAttribute(int i, int j)
          native: GrSetFontAttr?
 void setInvert(boolean flag)
          //TODO: Antialis?
 int setInvert(int i, boolean flag)
          native
 void setRotation(int i, short word0)
          Native probably nano-X: GrSetFontRotation
 void setRotation(short word0)
          Rotation in 1/10 of degree.
 void setSize(int i, short word0)
          Native probably: GrSetFontSize
 void setSize(short word0)
          Sets font size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Plain

See Also:
Constant Field Values

BOLD

public static final int BOLD
Bold

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
Italic

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
Underline

See Also:
Constant Field Values

fontID

private int fontID
fontID, max 8 in system?

Constructor Detail

Font

public Font(int i)
//TODO: Creates font with given fontID?

Parameters:
i - fontID

Font

public Font(java.lang.String s,
            int i,
            int j)
Creates font with given parameters.

Parameters:
s - Font name eg: "Arial", "/root/fonts/truetype/lBOOKN.ttf", etc.
i - Size
j - Style eg: Font.NONE
Method Detail

createFont

public int createFont(byte[] abyte0,
                      int i)
Native probably nano-X: GrCreateFont

Parameters:
abyte0 - font family name?
i - size
Returns:
fontID

destoryFont

public void destoryFont(int i)
native: GrDestroyFont?

Parameters:
i - fontID to destroy

getSize

public int getSize(int i)
native

Parameters:
i - fontID
Returns:
size

getBaseLine

public int getBaseLine(int i)
native

Parameters:
i - fontID
Returns:
baseline in pixels

getDescent

public int getDescent(int i)
native

Parameters:
i - fontID
Returns:
descent in pixels

setSize

public void setSize(int i,
                    short word0)
Native probably: GrSetFontSize

Parameters:
i - fontID
word0 - size

setRotation

public void setRotation(int i,
                        short word0)
Native probably nano-X: GrSetFontRotation

Parameters:
i - fontID
word0 - rotation in tenth degree

setAttribute

public void setAttribute(int i,
                         int j)
native: GrSetFontAttr?

Parameters:
i - fontID
j - attributes, like: Font.BOLD|Font.ITALIC

getStringWidth

public int getStringWidth(int i,
                          java.lang.String s)
native: GrGetGCTextSize?

Parameters:
i - fontID
s - text to draw
Returns:
width in pixels

setInvert

public int setInvert(int i,
                     boolean flag)
native

Parameters:
i - fontID
flag -
Returns:

getFontID

public int getFontID()
FontID registered in system.

Returns:
fontID

getSize

public int getSize()
Returns size. Warning: see getBaseLine().

Returns:
size
See Also:
setSize(int, short)

setSize

public void setSize(short word0)
Sets font size. Calls native.

Parameters:
word0 - size
See Also:
setSize(int, short)

setRotation

public void setRotation(short word0)
Rotation in 1/10 of degree. Calls native.

Parameters:
word0 - degree * 10
See Also:
setRotation(int, short)

setAttribute

public void setAttribute(int i)
Bold, italic, etc. Calls native.

Parameters:
i - attribs bit or
See Also:
setAttribute(int, int)

destroy

public void destroy()
Releases resources of font.

See Also:
destoryFont(int)

finalize

protected void finalize()
Releases resources of font.

See Also:
destoryFont(int)

getStringWidth

public int getStringWidth(java.lang.String s)
Returns width of String in this font.

Parameters:
s - String to be drawn
Returns:
width in pixels
See Also:
getStringWidth(int, String)

getBaseLine

public int getBaseLine()
Returns Baseline of font. Add it to y offset, when drawing string. Calls native.

Returns:
font baseline

getDescent

public int getDescent()
Returns descent for chars like: qypgj

Returns:
font descent

setInvert

public void setInvert(boolean flag)
//TODO: Antialis?

Parameters:
flag -