crystalspace.jbind.interfaces.ivideo.fontserv
Interface iFont

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csFont

public interface iFont
extends iBase

A font object. Objects of this class are used by canvas driver to paint glyphs.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/devapi/structiFont.php

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.
 int getSize()
          Query current font size in Point.
 boolean hasGlyph(int c)
          Returns whether a specific glyph is present in this font.
 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 interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

addDeleteCallback

public void addDeleteCallback(iFontDeleteNotify func)
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.

Parameters:
func -

getAscent

public int getAscent()
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.

Returns:

getDescent

public int getDescent()
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.

Returns:

getDimensions

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

Parameters:
text -
Returns:

getGlyphAlphaBitmap

public iDataBuffer getGlyphAlphaBitmap(int c,
                                       csBitmapMetrics metrics)
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.

Parameters:
c -
metrics -
Returns:

getGlyphBitmap

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

Parameters:
c -
metrics -
Returns:

getGlyphMetrics

public boolean getGlyphMetrics(int c,
                               csGlyphMetrics metrics)
Return the metrics of a glyph. Implemented in csDefaultFont, and csFreeType2Font.

Parameters:
c -
metrics -
Returns:

getLength

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

Parameters:
text -
maxwidth -
Returns:

getMaxSize

public int[] getMaxSize()
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.

Returns:

getSize

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

Returns:

hasGlyph

public boolean hasGlyph(int c)
Returns whether a specific glyph is present in this font. Implemented in csDefaultFont, and csFreeType2Font.

Parameters:
c -
Returns:

removeDeleteCallback

public boolean removeDeleteCallback(iFontDeleteNotify func)
Remove a font delete notification callback. Implemented in csDefaultFont, and csFreeType2Font.

Parameters:
func -
Returns:

setSize

public void setSize(int iSize)
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

Parameters:
iSize -