Cavestory Mod API
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | Friends | List of all members
FontManager Class Reference

Manages fonts. More...

#include <CSMAPI_types.h>

Public Member Functions

 FontManager (const char *font_name, FontObject *fo, int width, int height)
 

Static Public Member Functions

static void LinkFontToTexture (FontObject *fo, VideoTexture *pTexture)
 Link a font to a texture. More...
 
static FontManagerGetManagerForFont (FontObject *fo)
 Fetch the font manager for a font object. More...
 
static void UseFont (FontObject *pFont)
 Increment the use count for a font. More...
 
static void ReadyAllFontsForWindowResize ()
 Ready all loaded font objects for a window resizing.
 
static void ResizeAllFonts ()
 Resize all fonts following a magnification change.
 
static void DestroyRendererTextures (void *pTarget)
 Destroy all textures related to the given renderer. More...
 

Public Attributes

char mFontName [127]
 The name of this font.
 
FontObject * mFont
 The font object tied to this manager.
 
int mUserCount
 How many users this font has If 0, it will be freed.
 
int mWidth
 Font width.
 
int mHeight
 Font height.
 

Static Protected Member Functions

static FontObject * LoadFont (const char *font_name, int font_width, int font_height, bool bDoNotUse=false, VideoTexture *pTexture=NULL, FontManager **resultingManager=NULL, unsigned int iMagnification=0xFFFFFFFF)
 Load a font by name & size. More...
 
static void UnloadFont (FontObject *fo)
 Unload a font object. More...
 

Friends

class FontHandle
 

Detailed Description

Manages fonts.

Member Function Documentation

◆ DestroyRendererTextures()

static void FontManager::DestroyRendererTextures ( void *  pTarget)
static

Destroy all textures related to the given renderer.

Parameters
pTargetThe target renderer.

◆ GetManagerForFont()

static FontManager* FontManager::GetManagerForFont ( FontObject *  fo)
static

Fetch the font manager for a font object.

Parameters
foThe font object to check.
Returns
Returns the FontManager on success, NULL otherwise.

◆ LinkFontToTexture()

static void FontManager::LinkFontToTexture ( FontObject *  fo,
VideoTexture pTexture 
)
static

Link a font to a texture.

Parameters
foThe font object to link.
pTextureThe texture that the fontobject should be linked to.

◆ LoadFont()

static FontObject* FontManager::LoadFont ( const char *  font_name,
int  font_width,
int  font_height,
bool  bDoNotUse = false,
VideoTexture pTexture = NULL,
FontManager **  resultingManager = NULL,
unsigned int  iMagnification = 0xFFFFFFFF 
)
staticprotected

Load a font by name & size.

Parameters
font_nameThe name of the font.
font_widthThe width of the font.
font_heightThe height of the font.
bDoNotuseDon't increment this font's ref value (unless it wasn't previously cached). DO NOT USE THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
pTextureThe texture this font belongs to.
resultingManagerA pointer to a FontManager* variable to hold the resulting font manager for this font.
iMagnificationThe magnification size of the font.
Returns
Returns a FontObject* on success, NULL on failure.
Examples
RenderPipeline.cpp, and WelcomeMode.cpp.

◆ UnloadFont()

static void FontManager::UnloadFont ( FontObject *  fo)
staticprotected

Unload a font object.

Parameters
foThe font object to unload.
Examples
RenderPipeline.cpp, and WelcomeMode.cpp.

◆ UseFont()

static void FontManager::UseFont ( FontObject *  pFont)
static

Increment the use count for a font.

Parameters
pFontThe font object.

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