MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
MythFontManager Class Reference

#include <mythfontmanager.h>

Public Member Functions

 MythFontManager ()
void LoadFonts (const QString &directory, const QString &registeredFor)
 Loads the fonts in font files within the given directory structure.
void ReleaseFonts (const QString &registeredFor)
 Removes the font references for registeredFor, and unloads the application font if it's no longer in use.

Static Public Member Functions

static MythFontManagerGetGlobalFontManager (void)

Private Member Functions

void LoadFonts (const QString &directory, const QString &registeredFor, int *maxDirs)
 Loads the fonts in font files within the given directory structure.
void LoadFontsFromDirectory (const QString &directory, const QString &registeredFor)
 Loads fonts from font files in the specified directory.
void LoadFontFile (const QString &fontPath, const QString &registeredFor)
 Loads fonts from the file specified in fontPath.
bool RegisterFont (const QString &fontPath, const QString &registeredFor, const int fontID=-1)
 Registers the font as being used by registeredFor.
bool IsFontFileLoaded (const QString &fontPath)
 Checks whether the specified font file has already been loaded.

Private Attributes

QMutex m_lock
FontPathToReference m_fontPathToReference

Detailed Description

Definition at line 13 of file mythfontmanager.h.

Constructor & Destructor Documentation

MythFontManager::MythFontManager ( )
inline

Definition at line 16 of file mythfontmanager.h.

Referenced by GetGlobalFontManager().

Member Function Documentation

void MythFontManager::LoadFonts ( const QString &  directory,
const QString &  registeredFor 
)

Loads the fonts in font files within the given directory structure.

Scans directory and its subdirectories, up to MAX_DIRS total, looking for TrueType (.ttf) and OpenType (.otf) font files or TrueType font collections (.ttc) and loads the fonts to make them available to the application.

Parameters
directoryThe directory to scan
registeredForThe user of the font. Used with releaseFonts() to unload the font if no longer in use (by any users)
See Also
LoadFonts(const QString &, const QString &, int *)

Definition at line 28 of file mythfontmanager.cpp.

Referenced by MythThemeBase::Init(), LoadFonts(), and MythThemeBase::Reload().

void MythFontManager::ReleaseFonts ( const QString &  registeredFor)

Removes the font references for registeredFor, and unloads the application font if it's no longer in use.

Parameters
registeredForThe user of the font, as specified to LoadFonts()

Definition at line 84 of file mythfontmanager.cpp.

Referenced by MythThemeBase::Reload(), and MythThemeBase::~MythThemeBase().

MythFontManager * MythFontManager::GetGlobalFontManager ( void  )
static

Definition at line 249 of file mythfontmanager.cpp.

Referenced by GetGlobalFontManager().

void MythFontManager::LoadFonts ( const QString &  directory,
const QString &  registeredFor,
int maxDirs 
)
private

Loads the fonts in font files within the given directory structure.

Recursively scans all directories under directory looking for TrueType (.ttf) and OpenType (.otf) font files or TrueType font collections (.ttc) and loads the fonts to make them available to the application.

Parameters
directoryThe directory to scan
registeredForThe user of the font. Used with releaseFonts() to unload the font if no longer in use (by any users)
maxDirsThe maximum number of subdirectories to scan

Definition at line 47 of file mythfontmanager.cpp.

void MythFontManager::LoadFontsFromDirectory ( const QString &  directory,
const QString &  registeredFor 
)
private

Loads fonts from font files in the specified directory.

Non-recursive function called by the recursive MythFontManager::LoadFonts() function.

Parameters
directoryThe directory to scan
registeredForThe user of the font.

Definition at line 134 of file mythfontmanager.cpp.

Referenced by LoadFonts().

void MythFontManager::LoadFontFile ( const QString &  fontPath,
const QString &  registeredFor 
)
private

Loads fonts from the file specified in fontPath.

Parameters
directoryThe directory to scan
registeredForThe user of the font.

Definition at line 159 of file mythfontmanager.cpp.

Referenced by LoadFontsFromDirectory().

bool MythFontManager::RegisterFont ( const QString &  fontPath,
const QString &  registeredFor,
const int  fontID = -1 
)
private

Registers the font as being used by registeredFor.

Parameters
directoryThe directory to scan
registeredForThe user of the font.

Definition at line 215 of file mythfontmanager.cpp.

Referenced by LoadFontFile().

bool MythFontManager::IsFontFileLoaded ( const QString &  fontPath)
private

Checks whether the specified font file has already been loaded.

Parameters
fontPathThe absolute path to the font file

Definition at line 243 of file mythfontmanager.cpp.

Referenced by LoadFontFile(), and ReleaseFonts().

Member Data Documentation

QMutex MythFontManager::m_lock
private

Definition at line 33 of file mythfontmanager.h.

Referenced by LoadFontFile(), and ReleaseFonts().

FontPathToReference MythFontManager::m_fontPathToReference
private

Definition at line 34 of file mythfontmanager.h.

Referenced by IsFontFileLoaded(), RegisterFont(), and ReleaseFonts().


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