KSD_EXPORT_CLASSclass TFont

Abstract font base class.

Inheritance:


Public Methods

[more]virtual void Open(const std::string& filename) = 0
Load the font data from a file
[more]virtual void Optimize(TFontAttr* List = NULL, int n = 0)
Optimize a font for use with a particular set of font attr's.
[more]virtual int GetHeight(const TFontAttr&) = 0
Return the height of the font (in pixels) with a particular attr
[more]virtual int GetAscent(const TFontAttr&) = 0
Return the ascent of the font (in pixels) with a particular attr.
[more]virtual int GetDescent(const TFontAttr&) = 0
Return the descent of the font (in pixels) with a particular attr.
[more]virtual int GetLineSkip(const TFontAttr&) = 0
Returns the suggested space between lines (in pixels) for this font with a particular font attr
[more]virtual void GetTextSize(const std::string& text, const TFontAttr&, int& width, int& height) = 0
Gets the size of the given text with a particular font attr.
[more]static TFont* LoadFont(const std::string& filename)
Loads a concrete font object.

Public Members

[more]enum Font style flags

Protected Methods

[more]virtual void DrawString(SDL_Surface*, int X, int Y, const std::string& text, TRect* ClipRect, const TFontAttr& attr = DefaultFontAttr) = 0
Does the actual string drawing.


Documentation

Abstract font base class. All 2D font types descend from this class.
oenum Font style flags
Font style flags

o Normal

o Bold

o Italic

o Underline

ovirtual void Open(const std::string& filename) = 0
Load the font data from a file

ovirtual void Optimize(TFontAttr* List = NULL, int n = 0)
Optimize a font for use with a particular set of font attr's. Some font implementations maintain a copy of the font in each form used so far. Optimize destroys all but the list of fonts types supplied and creates those that did not exist to begin with. If NULL is supplied as the list then the font is optimize to the default.

ovirtual int GetHeight(const TFontAttr&) = 0
Return the height of the font (in pixels) with a particular attr

ovirtual int GetAscent(const TFontAttr&) = 0
Return the ascent of the font (in pixels) with a particular attr. The acsent is the distance from the baseline to the top of the font. This is a positive value.

ovirtual int GetDescent(const TFontAttr&) = 0
Return the descent of the font (in pixels) with a particular attr. The descent is the distance from the the baseline to the bottom of the font. This is a negative value.

ovirtual int GetLineSkip(const TFontAttr&) = 0
Returns the suggested space between lines (in pixels) for this font with a particular font attr

ovirtual void GetTextSize(const std::string& text, const TFontAttr&, int& width, int& height) = 0
Gets the size of the given text with a particular font attr. The size (in pixels) is placed in the width and height variables.

ostatic TFont* LoadFont(const std::string& filename)
Loads a concrete font object. Use this function to generically load a font file.

ovirtual void DrawString(SDL_Surface*, int X, int Y, const std::string& text, TRect* ClipRect, const TFontAttr& attr = DefaultFontAttr) = 0
Does the actual string drawing. Pass NULL as a clip rect to disable clipping.


Direct child classes:
TTrueTypeFont
TBitmapFont
Friends:
class TCanvas

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.