crystalspace.jbind.impl.video.fontserv
Class csFont

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.video.fontserv.csFont
All Implemented Interfaces:
iBase, iFont, iPointer

public class csFont
extends csBase
implements iFont

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csFont(iPointer nPointer)
           
 
Method Summary
 void addDeleteCallback(iFontDeleteNotify func)
          Add a font delete notification callback routine.
 int getAscent()
          Get the font's ascent in pixels.
 int getDescent()
          Get the font's descent in pixels.
 int[] getDimensions(java.lang.String text)
          Return the width and height of text written with this font. desc gives the maximum descender.
 iDataBuffer getGlyphAlphaBitmap(int c, csBitmapMetrics metrics)
          Return a pointer to a bitmap containing the alpha bitmap for the rendered character.
 iDataBuffer getGlyphBitmap(int c, csBitmapMetrics metrics)
          Return a pointer to a bitmap containing a rendered character.
 boolean getGlyphMetrics(int c, csGlyphMetrics metrics)
          Return the metrics of a glyph.
 int getLength(java.lang.String text, int maxwidth)
          Determine how many characters from this string can be written without exceeding given width (in pixels);.
 int[] getMaxSize()
          Return the maximum width and height of a single glyph, in pixels.
 java.lang.String getName()
          Return the name of the interface
 int getSize()
          Query current font size in Point.
 int getVersion()
          Return the version of the interface
 boolean hasGlyph(int c)
          Returns whether a specific glyph is present in this font.
protected  boolean isNativePointerValidSafe(long pointer)
           
 boolean removeDeleteCallback(iFontDeleteNotify func)
          Remove a font delete notification callback.
 void setSize(int iSize)
          Set the size for this font in Point.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csFont

public csFont(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase
See Also:
iBase.getVersion()

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

addDeleteCallback

public void addDeleteCallback(iFontDeleteNotify func)
Description copied from interface: iFont
Add a font delete notification callback routine. This routine will be called from font destructor, with the font instance being passed as argument. Another parameter is provided to supply additional data. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
addDeleteCallback in interface iFont
Parameters:
func -
See Also:
iFont.addDeleteCallback(crystalspace.jbind.interfaces.ivideo.fontserv.iFontDeleteNotify)

getAscent

public int getAscent()
Description copied from interface: iFont
Get the font's ascent in pixels. Returns a value <0 if an error occured. The sum of descent and ascent must not necessarily equal the maximum height. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getAscent in interface iFont
Returns:
See Also:
iFont.getAscent()

getDescent

public int getDescent()
Description copied from interface: iFont
Get the font's descent in pixels. Returns a value <0 if an error occured. The sum of descent and ascent must not necessarily equal the maximum height. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getDescent in interface iFont
Returns:
See Also:
iFont.getDescent()

getDimensions

public int[] getDimensions(java.lang.String text)
Description copied from interface: iFont
Return the width and height of text written with this font. desc gives the maximum descender. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getDimensions in interface iFont
Parameters:
text -
Returns:
See Also:
iFont.getDimensions(java.lang.String)

getGlyphAlphaBitmap

public iDataBuffer getGlyphAlphaBitmap(int c,
                                       csBitmapMetrics metrics)
Description copied from interface: iFont
Return a pointer to a bitmap containing the alpha bitmap for the rendered character. Returns 0 if the glyph can't be retrieved. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getGlyphAlphaBitmap in interface iFont
Parameters:
c -
metrics -
Returns:
See Also:
iFont.getGlyphAlphaBitmap(int, crystalspace.jbind.impl.video.fontserv.csBitmapMetrics)

getGlyphBitmap

public iDataBuffer getGlyphBitmap(int c,
                                  csBitmapMetrics metrics)
Description copied from interface: iFont
Return a pointer to a bitmap containing a rendered character. Returns 0 if the glyph can't be retrieved. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getGlyphBitmap in interface iFont
Parameters:
c -
metrics -
Returns:
See Also:
iFont.getGlyphBitmap(int, crystalspace.jbind.impl.video.fontserv.csBitmapMetrics)

getGlyphMetrics

public boolean getGlyphMetrics(int c,
                               csGlyphMetrics metrics)
Description copied from interface: iFont
Return the metrics of a glyph. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getGlyphMetrics in interface iFont
Parameters:
c -
metrics -
Returns:
See Also:
iFont.getGlyphMetrics(int, crystalspace.jbind.impl.video.fontserv.csGlyphMetrics)

getLength

public int getLength(java.lang.String text,
                     int maxwidth)
Description copied from interface: iFont
Determine how many characters from this string can be written without exceeding given width (in pixels);. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getLength in interface iFont
Parameters:
text -
maxwidth -
Returns:
See Also:
iFont.getLength(java.lang.String, int)

getMaxSize

public int[] getMaxSize()
Description copied from interface: iFont
Return the maximum width and height of a single glyph, in pixels. Return null if it could not be determined. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getMaxSize in interface iFont
Returns:
See Also:
iFont.getMaxSize()

getSize

public int getSize()
Description copied from interface: iFont
Query current font size in Point. If server does not support rescalable fonts, this method returns 0. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
getSize in interface iFont
Returns:
See Also:
iFont.getSize()

hasGlyph

public boolean hasGlyph(int c)
Description copied from interface: iFont
Returns whether a specific glyph is present in this font. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
hasGlyph in interface iFont
Parameters:
c -
Returns:
See Also:
iFont.hasGlyph(int)

removeDeleteCallback

public boolean removeDeleteCallback(iFontDeleteNotify func)
Description copied from interface: iFont
Remove a font delete notification callback. Implemented in csDefaultFont, and csFreeType2Font.

Specified by:
removeDeleteCallback in interface iFont
Parameters:
func -
Returns:
See Also:
iFont.removeDeleteCallback(crystalspace.jbind.interfaces.ivideo.fontserv.iFontDeleteNotify)

setSize

public void setSize(int iSize)
Description copied from interface: iFont
Set the size for this font in Point. All other methods will change their behaviour as soon as you call this method; but not all font managers supports rescalable fonts in which case this method will be unimplemented. Implemented in csDefaultFont, and csFreeType2Font

Specified by:
setSize in interface iFont
Parameters:
iSize -
See Also:
iFont.setSize(int)