Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages | Examples

fgl::FGFontManager Class Reference

#include <base.h>

Collaboration diagram for fgl::FGFontManager:

Collaboration graph
[legend]
List of all members.

Detailed Description

The OpenGUI interface to the font manager. It registers and deregisters variable in-memory or in-file fonts. These fonts maybe with fixed width or proportional width. Object provides these fonts to others.


Public Member Functions

 FGFontManager ()
 ~FGFontManager ()

Static Public Member Functions

static int __fastcall register_font_ttf (char *filename, int points, int count=128-' ', int offset=' ', char *desc=0)
static int __fastcall register_font_fix (unsigned char *source, int width, int height, int count, int offset, char *desc)
static int __fastcall register_font_file (const char *source, char *desc)
static int __fastcall textwidth (int ID, const char *txt)
static int __fastcall textwidth (int ID, const char *txt, int cnt)
static int __fastcall charwidth (int ID, int c)
static FGFont *__fastcall get_font_ptr (int ID)
static int __fastcall GetW (int ID)
static int __fastcall GetH (int ID)
static variable_record *__fastcall IsVariableFont (int ID)
static FGPixel *__fastcall GetFontImage (int ID)
static char *__fastcall GetFontName (int ID)
static int __fastcall GetCounter (void)


Constructor & Destructor Documentation

fgl::FGFontManager::FGFontManager  ) 
 

Initializes font manager and creates all default system fonts.

See also:
FGFont FontDialog

fgl::FGFontManager::~FGFontManager  ) 
 

Destroys all system's registered fonts.


Member Function Documentation

int __fastcall fgl::FGFontManager::charwidth int  ID,
int  c
[static]
 

Returns:
the width of the character c for the font ID.
Parameters:
ID font ID for prepared font
c desired character

static FGFont* __fastcall fgl::FGFontManager::get_font_ptr int  ID  )  [inline, static]
 

Tests font ID and returns pointer to.

Returns:
a valid font record if exists one, or 0 if doesn't exist.
Parameters:
ID font ID for prepared font

static int __fastcall fgl::FGFontManager::GetCounter void   )  [inline, static]
 

Returns:
the number of registered fonts in system.

static FGPixel* __fastcall fgl::FGFontManager::GetFontImage int  ID  )  [inline, static]
 

Returns:
returns the font pixelmap or 0 if desn't exists.
Parameters:
ID font ID

static char* __fastcall fgl::FGFontManager::GetFontName int  ID  )  [inline, static]
 

Returns:
the font name (max. 23 chars in length+'\0').
Parameters:
ID font ID

static int __fastcall fgl::FGFontManager::GetH int  ID  )  [inline, static]
 

Returns:
returns the height in pixels for font ID or 0 if doesn't exists.
Parameters:
ID font ID

static int __fastcall fgl::FGFontManager::GetW int  ID  )  [inline, static]
 

Returns:
returns the width in pixels for font ID or 0 if doesn't exists. for proportional fonts there is the width of bigger glyph in the font.
Parameters:
ID font ID

static variable_record* __fastcall fgl::FGFontManager::IsVariableFont int  ID  )  [inline, static]
 

Returns:
returns the pointer to a structure for proportional font description or 0 if font is fixed size.
Parameters:
ID font ID

int __fastcall fgl::FGFontManager::register_font_file const char *  source,
char *  desc
[static]
 

registers a variable font from the special font file

Returns:
-1 if error, or font ID (to use with FGDrawBuffer::set_font())
Parameters:
source the filename
desc the font face name. It is used with FontDialog to choose.

int __fastcall fgl::FGFontManager::register_font_fix unsigned char *  source,
int  width,
int  height,
int  count,
int  offset,
char *  desc
[static]
 

registers fixed binary font

Returns:
-1 if error, or font ID (to use with FGDrawBuffer::set_font())
Parameters:
source the font pixmap (8-bit for a pixel, possible values are 0x00 and 0xff)
width a width of the font
height a height of the font
count number of glyphs to extract from TTF file (128-32)
offset offset of first glyph (32)
desc the font face name. It is used with FontDialog to choose.
Examples:
font.cpp.

int __fastcall fgl::FGFontManager::register_font_ttf char *  filename,
int  points,
int  count = 128-' ',
int  offset = ' ',
char *  desc = 0
[static]
 

registers truetype font (if TTF support is enabled)

Returns:
-1 if error, or font ID (to use with FGDrawBuffer::set_font())
Parameters:
filename full file name of ttf font (with path if needed)
points font size to build
count number of glyphs to extract from TTF file (128-32)
offset offset of first glyph (32)
desc optional face name (if null, then it is extracted from ttf file). It is used with FontDialog to choose.
Examples:
font.cpp.

int __fastcall fgl::FGFontManager::textwidth int  ID,
const char *  txt,
int  cnt
[static]
 

Returns:
the width of first cnt characters from rendered string txt with the font ID.
Note:
if the string contains a null byte, then this place stops the function early.
Parameters:
ID font ID for prepared font
txt desired text string in ASCII format.
cnt desired number of character to compute the width

int __fastcall fgl::FGFontManager::textwidth int  ID,
const char *  txt
[static]
 

Returns:
the width of rendered string txt with the font ID.
Parameters:
ID font ID for prepared font
txt desired text string in ASCII format terminated with null byte.


Generated on Wed Feb 9 11:31:38 2005 for OpenGUI by  doxygen 1.4.0