Font pool management class. More...
#include <SFontPool.h>
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< IRenderFactory > | m_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. | |
| IFontPtr & | GetKeyObject (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. | |
Font pool management class.
Manages and retrieves font resources, supporting font caching and reuse.
Definition at line 93 of file SFontPool.h.
|
protected |
Constructor.
| fac | Render factory object pointer |
Definition at line 41 of file SFontPool.cpp.
Create font object corresponding to FontInfo.
| fontInfo | FontInfo object |
Definition at line 92 of file SFontPool.cpp.
|
protected |
Get constant reference to default font information.
Definition at line 135 of file SFontPool.cpp.
Get IFontPtr corresponding to the specified description string.
| strFont | Font description string |
| scale | Scale factor |
Definition at line 74 of file SFontPool.cpp.
|
protected |
Set default font information.
| fontInfo | FontInfo object |
Definition at line 140 of file SFontPool.cpp.
|
protected |
Set default font description string.
| strFontInfo | Default font description string |
Definition at line 147 of file SFontPool.cpp.
|
static |
Check if a font is valid.
| strFontName | Font name |
Definition at line 36 of file SFontPool.cpp.
|
static |
Convert font description to FontInfo.
| strFontInfo | Font description string |
| defFontInfo | Default FontInfo |
Definition at line 161 of file SFontPool.cpp.
Convert FontInfo to font description.
| fi | FontInfo object |
Definition at line 251 of file SFontPool.cpp.
|
static |
Get default font information.
Definition at line 279 of file SFontPool.cpp.
Get IFontPtr corresponding to the specified description string.
| strFont | Font description string |
| scale | Scale factor |
Description string format: face:宋体,bold:0,italic:1,underline:1,strike:1,adding:10
Definition at line 269 of file SFontPool.cpp.
|
staticprotected |
Callback function when FontInfo is removed.
| obj | Removed IFontPtr object |
Definition at line 54 of file SFontPool.cpp.
|
static |
Set default font.
| strFontInfo | Default font description string |
Definition at line 274 of file SFontPool.cpp.
|
static |
Set the callback function for checking fonts.
| fontCheck | Callback function for checking fonts |
Definition at line 31 of file SFontPool.cpp.
|
protected |
Set render factory object.
| fac | Render factory object pointer |
Definition at line 49 of file SFontPool.cpp.
|
protected |
Default font information
Definition at line 200 of file SFontPool.h.
|
protected |
Render factory object pointer
Definition at line 199 of file SFontPool.h.
|
staticprotected |
Font check callback function
Definition at line 202 of file SFontPool.h.