| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iFont Struct Reference
[2D]

A font object. More...

`#include <ivideo/fontserv.h>`

Inheritance diagram for iFont:

[legend]
List of all members.

## Public Member Functions
virtual void | AddDeleteCallback (iFontDeleteNotify *func)=0
| Add a font delete notification callback routine.
virtual int | GetAscent ()=0
| Get the font's ascent in pixels.
virtual int | GetDescent ()=0
| Get the font's descent in pixels.
virtual void | GetDimensions (const char *text, int &oW, int &oH, int &desc)=0
| Return the width and height of text written with this font.
virtual void | GetDimensions (const char *text, int &oW, int &oH)=0
| Return the width and height of text written with this font.
virtual csPtr< iDataBuffer > | GetGlyphAlphaBitmap (utf32_char c, csBitmapMetrics &metrics)=0
| Return a pointer to a bitmap containing the alpha bitmap for the rendered character.
virtual csPtr< iDataBuffer > | GetGlyphBitmap (utf32_char c, csBitmapMetrics &metrics)=0
| Return a pointer to a bitmap containing a rendered character.
virtual bool | GetGlyphMetrics (utf32_char c, csGlyphMetrics &metrics)=0
| Return the metrics of a glyph.
virtual int | GetLength (const char *text, int maxwidth)=0
| Determine how many characters from this string can be written without exceeding given width (in pixels).
virtual void | GetMaxSize (int &oW, int &oH)=0
| Return the maximum width and height of a single glyph, in pixels.
virtual float | GetSize ()=0
| Query current font size in Point.
virtual int | GetTextHeight ()=0
| Gets the default baseline to baseline distance between two lines of text using this font.
virtual int | GetUnderlinePosition ()=0
| When displaying or rendering underlined text, this value corresponds to the vertical position, relative to the baseline, of the underline bar.
virtual int | GetUnderlineThickness ()=0
| When displaying or rendering underlined text, this value corresponds to the vertical thickness of the underline bar/rectangle.
virtual bool | HasGlyph (utf32_char c)=0
| Returns whether a specific glyph is present in this font.
virtual bool | RemoveDeleteCallback (iFontDeleteNotify *func)=0
| Remove a font delete notification callback.

## Detailed Description

A font object.

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

Main creators of instances implementing this interface:

- iFontServer::LoadFont()

Definition at line 112 of file fontserv.h.

## Member Function Documentation

virtual void iFont::AddDeleteCallback | ( | iFontDeleteNotify * | func | ) | `[pure virtual]`

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.

virtual int iFont::GetAscent | ( |  | ) | `[pure virtual]`

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.

Referenced by csG2DDrawText< Tpixel, Tpixmixer1, Tpixmixer2, Tpixmixer3 >::DrawText().

virtual int iFont::GetDescent | ( |  | ) | `[pure virtual]`

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.

virtual void iFont::GetDimensions | ( | const char * | text,
|  | int & | oW,
|  | int & | oH,
|  | int & | desc |
| ) |  |  | `[pure virtual]`

Return the width and height of text written with this font.

desc gives the maximum descender.

virtual void iFont::GetDimensions | ( | const char * | text,
|  | int & | oW,
|  | int & | oH |
| ) |  |  | `[pure virtual]`

Return the width and height of text written with this font.

virtual csPtr<iDataBuffer> iFont::GetGlyphAlphaBitmap | ( | utf32_char | c,
|  | csBitmapMetrics & | metrics |
| ) |  |  | `[pure virtual]`

Return a pointer to a bitmap containing the alpha bitmap for the rendered character.

Returns 0 if the glyph can't be retrieved.

virtual csPtr<iDataBuffer> iFont::GetGlyphBitmap | ( | utf32_char | c,
|  | csBitmapMetrics & | metrics |
| ) |  |  | `[pure virtual]`

Return a pointer to a bitmap containing a rendered character.

Returns 0 if the glyph can't be retrieved.

virtual bool iFont::GetGlyphMetrics | ( | utf32_char | c,
|  | csGlyphMetrics & | metrics |
| ) |  |  | `[pure virtual]`

Return the metrics of a glyph.

virtual int iFont::GetLength | ( | const char * | text,
|  | int | maxwidth |
| ) |  |  | `[pure virtual]`

Determine how many characters from this string can be written without exceeding given width (in pixels).

virtual void iFont::GetMaxSize | ( | int & | oW,
|  | int & | oH |
| ) |  |  | `[pure virtual]`

Return the maximum width and height of a single glyph, in pixels.

Return -1 if it could not be determined.

virtual float iFont::GetSize | ( |  | ) | `[pure virtual]`

Query current font size in Point.

If server does not support rescalable fonts, this method returns 0.

virtual int iFont::GetTextHeight | ( |  | ) | `[pure virtual]`

Gets the default baseline to baseline distance between two lines of text using this font.

virtual int iFont::GetUnderlinePosition | ( |  | ) | `[pure virtual]`

When displaying or rendering underlined text, this value corresponds to the vertical position, relative to the baseline, of the underline bar.

It is positive if the underline it is below the baseline. The position returned is to the top of the underline bar/rectagle.

virtual int iFont::GetUnderlineThickness | ( |  | ) | `[pure virtual]`

When displaying or rendering underlined text, this value corresponds to the vertical thickness of the underline bar/rectangle.

virtual bool iFont::HasGlyph | ( | utf32_char | c | ) | `[pure virtual]`

Returns whether a specific glyph is present in this font.

virtual bool iFont::RemoveDeleteCallback | ( | iFontDeleteNotify * | func | ) | `[pure virtual]`

Remove a font delete notification callback.

The documentation for this struct was generated from the following file:

- ivideo/fontserv.h