soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SFontPool Class Reference

Font pool management class. More...

#include <SFontPool.h>

Inheritance diagram for SFontPool:
SCmnMap< IFontPtr, FontInfo > SUiDef

Static Public Member Functions

static void SetFontChecker (FunFontCheck fontCheck)
 Set the callback function for checking fonts.
 
static BOOL CheckFont (const SStringW &strFontName)
 Check if a font is valid.
 
static FontInfo FontInfoFromString (const SStringW &strFontInfo, const FontInfo &defFontInfo)
 Convert font description to FontInfo.
 
static SStringW FontInfoToString (const FontInfo &fi)
 Convert FontInfo to font description.
 
static IFontPtr GetFont (const SStringW &strFont, int scale)
 Get IFontPtr corresponding to the specified description string.
 
static void SetDefFontInfo (const SStringW &strFontInfo)
 Set default font.
 
static FontInfo GetDefFontInfo ()
 Get default font information.
 

Protected Member Functions

 SFontPool (IRenderFactory *fac)
 Constructor.
 
const FontInfo_GetDefFontInfo () const
 Get constant reference to default font information.
 
void SetRenderFactory (IRenderFactory *fac)
 Set render factory object.
 
IFontPtr _GetFont (const SStringW &strFont, int scale)
 Get IFontPtr corresponding to the specified description string.
 
void _SetDefFontInfo (const SStringW &strFontInfo)
 Set default font description string.
 
IFontPtr _CreateFont (const FontInfo &fontInfo)
 Create font object corresponding to FontInfo.
 
void _SetDefFontInfo (const FontInfo &fontInfo)
 Set default font information.
 

Static Protected Member Functions

static void OnKeyRemoved (const IFontPtr &obj)
 Callback function when FontInfo is removed.
 

Protected Attributes

SAutoRefPtr< IRenderFactorym_RenderFactory
 
FontInfo m_defFontInfo
 
- Protected Attributes inherited from SCmnMap< IFontPtr, FontInfo >
void(* m_pFunOnKeyRemoved )(const IFontPtr &obj)
 
SMap< FontInfo, IFontPtr > * m_mapNamedObj
 

Static Protected Attributes

static FunFontCheck s_funFontCheck = DefFontCheck
 

Additional Inherited Members

- Public Member Functions inherited from SCmnMap< IFontPtr, FontInfo >
 SCmnMap (void(*funOnKeyRemoved)(const IFontPtr &)=NULL)
 Constructor.
 
virtual ~SCmnMap ()
 Destructor.
 
bool HasKey (const FontInfo &key) const
 Checks if a key exists in the map.
 
bool GetKeyObject (const FontInfo &key, IFontPtr &obj) const
 Retrieves an object associated with a key.
 
IFontPtrGetKeyObject (const FontInfo &key) const
 Retrieves an object associated with a key.
 
bool AddKeyObject (const FontInfo &key, const IFontPtr &obj)
 Adds a key-object pair to the map.
 
void SetKeyObject (const FontInfo &key, const IFontPtr &obj)
 Sets an object for a key, replacing any existing object.
 
bool RemoveKeyObject (const FontInfo &key)
 Removes a key-object pair from the map.
 
void RemoveAll ()
 Removes all key-object pairs from the map.
 
size_t GetCount ()
 Gets the number of key-object pairs in the map.
 

Detailed Description

Font pool management class.

Manages and retrieves font resources, supporting font caching and reuse.

Definition at line 93 of file SFontPool.h.

Constructor & Destructor Documentation

◆ SFontPool()

SFontPool::SFontPool ( IRenderFactory * fac)
protected

Constructor.

Parameters
facRender factory object pointer

Definition at line 41 of file SFontPool.cpp.

Member Function Documentation

◆ _CreateFont()

IFontPtr SFontPool::_CreateFont ( const FontInfo & fontInfo)
protected

Create font object corresponding to FontInfo.

Parameters
fontInfoFontInfo object
Returns
IFontPtr Font object pointer

Definition at line 92 of file SFontPool.cpp.

◆ _GetDefFontInfo()

const FontInfo & SFontPool::_GetDefFontInfo ( ) const
protected

Get constant reference to default font information.

Returns
FontInfo Constant reference to default font information

Definition at line 135 of file SFontPool.cpp.

◆ _GetFont()

IFontPtr SFontPool::_GetFont ( const SStringW & strFont,
int scale )
protected

Get IFontPtr corresponding to the specified description string.

Parameters
strFontFont description string
scaleScale factor
Returns
IFontPtr Font object pointer

Definition at line 74 of file SFontPool.cpp.

◆ _SetDefFontInfo() [1/2]

void SFontPool::_SetDefFontInfo ( const FontInfo & fontInfo)
protected

Set default font information.

Parameters
fontInfoFontInfo object

Definition at line 140 of file SFontPool.cpp.

◆ _SetDefFontInfo() [2/2]

void SFontPool::_SetDefFontInfo ( const SStringW & strFontInfo)
protected

Set default font description string.

Parameters
strFontInfoDefault font description string

Definition at line 147 of file SFontPool.cpp.

◆ CheckFont()

BOOL SFontPool::CheckFont ( const SStringW & strFontName)
static

Check if a font is valid.

Parameters
strFontNameFont name
Returns
TRUE if valid, FALSE if invalid

Definition at line 36 of file SFontPool.cpp.

◆ FontInfoFromString()

FontInfo SFontPool::FontInfoFromString ( const SStringW & strFontInfo,
const FontInfo & defFontInfo )
static

Convert font description to FontInfo.

Parameters
strFontInfoFont description string
defFontInfoDefault FontInfo
Returns
FontInfo object

Definition at line 161 of file SFontPool.cpp.

◆ FontInfoToString()

SStringW SFontPool::FontInfoToString ( const FontInfo & fi)
static

Convert FontInfo to font description.

Parameters
fiFontInfo object
Returns
Font description string

Definition at line 251 of file SFontPool.cpp.

◆ GetDefFontInfo()

FontInfo SFontPool::GetDefFontInfo ( )
static

Get default font information.

Returns
FontInfo Default font information

Definition at line 279 of file SFontPool.cpp.

◆ GetFont()

IFontPtr SFontPool::GetFont ( const SStringW & strFont,
int scale )
static

Get IFontPtr corresponding to the specified description string.

Parameters
strFontFont description string
scaleScale factor
Returns
IFontPtr Font object pointer

Description string format: face:宋体,bold:0,italic:1,underline:1,strike:1,adding:10

Definition at line 269 of file SFontPool.cpp.

◆ OnKeyRemoved()

void SFontPool::OnKeyRemoved ( const IFontPtr & obj)
staticprotected

Callback function when FontInfo is removed.

Parameters
objRemoved IFontPtr object

Definition at line 54 of file SFontPool.cpp.

◆ SetDefFontInfo()

void SFontPool::SetDefFontInfo ( const SStringW & strFontInfo)
static

Set default font.

Parameters
strFontInfoDefault font description string

Definition at line 274 of file SFontPool.cpp.

◆ SetFontChecker()

void SFontPool::SetFontChecker ( FunFontCheck fontCheck)
static

Set the callback function for checking fonts.

Parameters
fontCheckCallback function for checking fonts

Definition at line 31 of file SFontPool.cpp.

◆ SetRenderFactory()

void SFontPool::SetRenderFactory ( IRenderFactory * fac)
protected

Set render factory object.

Parameters
facRender factory object pointer

Definition at line 49 of file SFontPool.cpp.

Member Data Documentation

◆ m_defFontInfo

FontInfo SFontPool::m_defFontInfo
protected

Default font information

Definition at line 200 of file SFontPool.h.

◆ m_RenderFactory

SAutoRefPtr<IRenderFactory> SFontPool::m_RenderFactory
protected

Render factory object pointer

Definition at line 199 of file SFontPool.h.

◆ s_funFontCheck

FunFontCheck SFontPool::s_funFontCheck = DefFontCheck
staticprotected

Font check callback function

Definition at line 202 of file SFontPool.h.


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