Guiliani  Version 2.5 revision 7293 (documentation build 13)
CFntWrap Class Referenceabstract

The font wrapper base class. More...

#include <FntWrap.h>

Inheritance diagram for CFntWrap:

Classes

struct  GlyphMetrics_t
 

Public Types

enum  GUIFont_t { FNT_NORMAL = 0 , FNT_ITALIC = 1 , FNT_UNDERLINED = 2 , FNT_BOLD = 4 }
 
enum  TextOperation_t { RENDER_TEXT , GET_REQUIRED_SPACE }
 

Public Member Functions

void ChangeFont (const FontResource_t &eFontID, const eC_String &pcPath, const eC_UInt uiFontSize, const GUIFont_t &eFontStyle)
 
virtual void FittingNumChars (const eC_String *const pkText, eC_Value vWidthMax, eC_UInt &uiNumChars, const eC_Bool &bStartAtEnd=false)
 
virtual eC_Int GetAscender () const
 
virtual eC_Int GetDescender () const
 
virtual void GetGlyphMetrics (const eC_Char cChar, GlyphMetrics_t &kMetrics)
 
virtual eC_Int GetInternalLeading () const
 
virtual eC_UInt GetNOFFonts ()
 
CGUICommonEnums::Rotation_t GetRotation () const
 
virtual eC_Value GetTextXPosAdjustment (const CGUIText::HorAligned_t eHorAlignment)
 
virtual eC_Value GetTextYPosAdjustment (const CGUIText::VerAligned_t eVerAlignment)
 
virtual void LoadFont (const FontResource_t &eFontID)
 
virtual void RequiredSpace (const eC_String *const pkText, eC_Value &vWidth, eC_Value &vHeight)=0
 
virtual void SetFont (const FontResource_t &eID)
 
virtual void SetFontSpacing (const eC_Float &fSpacing)
 
virtual eC_Bool SetNOFFonts (const eC_UInt uiNOFFonts)
 
void SetRotation (const CGUICommonEnums::Rotation_t &eRotation)
 
virtual void Text (const eC_Value &vX1, const eC_Value &vY1, const eC_String *const lpString)=0
 
virtual void UnloadFont (const FontResource_t &eFontID)
 

Static Public Member Functions

static void DeleteInstance ()
 

Protected Member Functions

 CFntWrap ()
 Constructor.
 
virtual ~CFntWrap ()
 Destructor.
 

Protected Attributes

FontResource_t m_eCurFont
 Current font id.
 
CGUICommonEnums::Rotation_t m_eRotation
 Rotation.
 
eC_UInt m_uiNOFFonts
 Total number of fonts.
 
eC_Value m_vSpacing
 Font spacing, i.e the space between letters.
 

Friends

class CGUIComponentManager
 

Detailed Description

The font wrapper base class.

This is the font wrapper base class. Guiliani is designed independently of a certain font engine. This class declares interfaces for handling all font functions such as loading fonts and printing text on the screen.

Please be aware that due to the cross-platform character of the framework, not all functions declared within the CFntWrap base class need to be available in all platform-specific implementations.

Member Enumeration Documentation

◆ GUIFont_t

Definition of font styles.

◆ TextOperation_t

Internal flag to indicate whether the text is actually being rendered or only its size is being calculated. Used by function RenderTextInternal().

Enumerator
RENDER_TEXT 

render the text

GET_REQUIRED_SPACE 

get required space for text

Member Function Documentation

◆ ChangeFont()

void CFntWrap::ChangeFont ( const FontResource_t eFontID,
const eC_String &  pcPath,
const eC_UInt  uiFontSize,
const GUIFont_t eFontStyle 
)

Change the font at position eFontID with the font identified by pcPath. If the font already exists, it is unloaded first.

Parameters
eFontIDid (and hence index) of the font.
pcPathPath or name of the font.
uiFontSizeSize of the font.
eFontStyleStyle of the font (italic, underline, bold, ... see GUIFont.h).

◆ DeleteInstance()

static void CFntWrap::DeleteInstance ( )
static

Delete the instance if it exists. Set the pointer NULL.

◆ FittingNumChars()

virtual void CFntWrap::FittingNumChars ( const eC_String *const  pkText,
eC_Value  vWidthMax,
eC_UInt &  uiNumChars,
const eC_Bool &  bStartAtEnd = false 
)
virtual

Calculates number of characters that fit in a given width with the currently active font.

Parameters
pkTextThe text.
vWidthMaxMaximum width for the text in pixels.
uiNumCharsReference value returning the number of characters that fit into that width.
bStartAtEndif this is true the text will be processed the other way round (e.g. RTL-languages)

◆ GetAscender()

virtual eC_Int CFntWrap::GetAscender ( ) const
inlinevirtual

Returns the currently set font's ascender-metric. If the ascender is not supported by a given Font-Wrapper, this returns 0.

Returns
ascender in pixels

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, and CFntWrapGlyphLibGL.

◆ GetDescender()

virtual eC_Int CFntWrap::GetDescender ( ) const
inlinevirtual

Returns the currently set font's descender-metric. If the descender is not supported by a given Font-Wrapper, this returns 0.

Returns
descender in pixels

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, and CFntWrapGlyphLibGL.

◆ GetGlyphMetrics()

virtual void CFntWrap::GetGlyphMetrics ( const eC_Char  cChar,
GlyphMetrics_t kMetrics 
)
inlinevirtual

Get the metrics of a glyph for a specific character

Parameters
cCharcharacter
kMetricsmetrics of glyph

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, and CFntWrapGlyphLibGL.

◆ GetInternalLeading()

virtual eC_Int CFntWrap::GetInternalLeading ( ) const
inlinevirtual

Returns the currently set font's internal leading. If the internal leading is not supported by a given Font-Wrapper, this returns 0.

Returns
internal leading in pixels

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, CFntWrapGlyphLibGL, and CFntWrapFreeTypeVG.

◆ GetNOFFonts()

virtual eC_UInt CFntWrap::GetNOFFonts ( )
inlinevirtual

Gets the number of fonts (array size).

Returns
Number of fonts.

◆ GetRotation()

CGUICommonEnums::Rotation_t CFntWrap::GetRotation ( ) const
inline

Get the current rotation for text-rendering

Returns
rotation

◆ GetTextXPosAdjustment()

virtual eC_Value CFntWrap::GetTextXPosAdjustment ( const CGUIText::HorAligned_t  eHorAlignment)
inlinevirtual

Get the x position adjustment because of platform specific font structure.

Parameters
eHorAlignmentThe horizontal alignment of GUIText object.
Returns
The x position adjustment. The GUItext object should add this adjustment to get the correct position.

◆ GetTextYPosAdjustment()

virtual eC_Value CFntWrap::GetTextYPosAdjustment ( const CGUIText::VerAligned_t  eVerAlignment)
inlinevirtual

Get the Y position adjustment because of platform specific font structure.

Parameters
eVerAlignmentThe vertical alignment of GUIText object.
Returns
The y position adjustment. The GUItext object should add this adjustment to get the correct position.

◆ LoadFont()

virtual void CFntWrap::LoadFont ( const FontResource_t eFontID)
inlinevirtual

Loads a font identified by eFontID into an array of fonts at position eFontID. If the font already exists, it's not loaded again. Should only be called by a FntWrapper.

Parameters
eFontIDid (and hence index) of the font. False else.

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, CFntWrapGlyphLibGL, and CFntWrapFreeTypeVG.

◆ RequiredSpace()

virtual void CFntWrap::RequiredSpace ( const eC_String *const  pkText,
eC_Value &  vWidth,
eC_Value &  vHeight 
)
pure virtual

Calculates the required space in x- and y-direction of a given text with the currently active font.

Parameters
pkTextThe text.
vWidthReference to width of the font in pixels.
vHeightReference to height of the font in pixels.

Implemented in CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapNull, and CFntWrapFreeTypeVG.

◆ SetFont()

virtual void CFntWrap::SetFont ( const FontResource_t eID)
virtual

Sets a new font for the application.

Parameters
eIDid (and hence index) of the font.

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, and CFntWrapGlyphLib.

◆ SetFontSpacing()

virtual void CFntWrap::SetFontSpacing ( const eC_Float &  fSpacing)
virtual

Sets a new font spacing, i.e the space between letters.

Parameters
fSpacingNew font spacing.

◆ SetNOFFonts()

virtual eC_Bool CFntWrap::SetNOFFonts ( const eC_UInt  uiNOFFonts)
virtual

Sets the total number of fonts. This is called internally by the ResourceManager when dynamically allocated font resources require the total number of fonts to be raised. Derived classes will have to override this method and resize their internal font-storage structures according to the new number of fonts which will have to be stored.

Parameters
uiNOFFontsThe number of fonts
Returns
True if internal storage has been successfully adapted to support the requested number of fonts. False otherwise.

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapNull, CFntWrapFreeTypeGL, CFntWrapGlyphLibGL, and CFntWrapFreeTypeVG.

◆ SetRotation()

void CFntWrap::SetRotation ( const CGUICommonEnums::Rotation_t eRotation)
inline

Set the current rotation for text-rendering

Parameters
eRotationrotation

◆ Text()

virtual void CFntWrap::Text ( const eC_Value &  vX1,
const eC_Value &  vY1,
const eC_String *const  lpString 
)
pure virtual

Print the text to screen.

Parameters
vX1Absolute x position of the top-left corner of the bounding rectangle.
vY1Absolute y position of the top-left corner of the bounding rectangle.
lpStringThe string to be printed.

Implemented in CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapNull, and CFntWrapFreeTypeVG.

◆ UnloadFont()

virtual void CFntWrap::UnloadFont ( const FontResource_t eFontID)
inlinevirtual

Removes the font from the font list. Should only be called by a FntWrapper.

Parameters
eFontIDId of font to be removed.

Reimplemented in CFntWrapFreeTypeDAVE, CFntWrapGlyphLibDAVE, CFntWrapFreeType, CFntWrapGlyphLib, CFntWrapFreeTypeGL, CFntWrapGlyphLibGL, and CFntWrapFreeTypeVG.

Friends And Related Function Documentation

◆ CGUIComponentManager

friend class CGUIComponentManager
friend

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