Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

MFont Class Reference

Represents a font with rendering possibility. More...

#include <MFont.h>

List of all members.

Public Types

typedef unsigned int TUnicodeChar
 Unicode character definition.

typedef TUnicodeCharTUnicodeString
 Unicode string definition.

enum  EFontParameters { KHeight, KMaxAdvanceWidth, KAscender, KDescender }
 Font parameters.

enum  EFixedFontType {
  KFixedFont6 = 1, KFixedFont12 = 2, KFixedFont24 = 3, KFixedFont48 = 4,
  KFixedFont96 = 5
}
 Describes different internal font widths.


Public Member Functions

virtual unsigned int GetCharHeight (TUnicodeChar aChar)=0
 Returns the width of given symbol in pixels.

virtual unsigned int GetStringHeight (const char *aString)=0
 Returns the width of given string in pixels.

virtual unsigned int GetStringHeight (const TUnicodeString aString)=0
 Unicode version of GetStringHeight.

virtual unsigned int GetCharWidth (TUnicodeChar aChar)=0
 Returns the height of given symbol in pixels.

virtual unsigned int GetStringWidth (const char *aString)=0
 Returns the height of given string in pixels.

virtual unsigned int GetStringWidth (const TUnicodeString aString)=0
 Unicode version of GetStringWidth.

virtual bool Render (MFrameBuffer &aFrameBuffer, TUnicodeChar aChar, unsigned int aX, unsigned int aY, CDesktop::TColor aColor)=0
 Renders given character on given MFrameBuffer.

virtual bool Render (MFrameBuffer &aFrameBuffer, const char *aString, unsigned int aX, unsigned int aY, CDesktop::TColor aColor)=0
 Renders given string on given MFrameBuffer.

virtual bool Render (MFrameBuffer &aFrameBuffer, const TUnicodeString aString, unsigned int aX, unsigned int aY, CDesktop::TColor aColor)=0
 Unicode version of Render.

virtual int GetFontParameter (EFontParameters aParameter)=0
 Returns various fond parameters in pixels.


Static Public Member Functions

MFontGetFixedWidthFont (EFixedFontType aFontType)
 Returns the reference of MFont that represents an internal fixed width font.

MFontCreateTrueTypeFont (const char *aFontName, unsigned int aFontSize)
 Returns the pointer to MFont that represents the True Type font that.

unsigned int UStrLen (const TUnicodeString aString)
 Calculates the length of an Unicode string.


Detailed Description

Represents a font with rendering possibility.

While rendering, the background is always left intact.

This interface contains static methods for obtaining the

references for default fixed character width fonts and

external True Type fonts. FreeType (www.freetype.org) library is used

for managing True Type fonts. Currently TrueType rendering uses kerning but

it does not use anti-aliasing


Member Function Documentation

MFont* MFont::CreateTrueTypeFont const char *  aFontName,
unsigned int  aFontSize
[static]
 

Returns the pointer to MFont that represents the True Type font that.

is stored in the given file.

Returned pointer should be deleted by the application explicitly when it is not longer needed

Parameters:
aFontName File name of TrueType font.
aFontSize Size of the font. Not that the size is a relative value that
might not directly correspond to the dimension of characters in

pixels

Warning:
True type fonts take a lot of memory so use only the fonts you really need

virtual unsigned int MFont::GetStringHeight const char *  aString  )  [pure virtual]
 

Returns the width of given string in pixels.

Note that the total string width sometimes is not just the sum of

all widths of all characters in this string. It could differ for True Type fonts

when kerning is used


The documentation for this class was generated from the following file:
Generated on Fri Jul 15 16:46:44 2005 for TomTom GO User Interface library by doxygen 1.3.5