MythFontManager Class Reference

#include <mythfontmanager.h>

List of all members.

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:
directory The directory to scan
registeredFor The 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:
registeredFor The 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:
directory The directory to scan
registeredFor The user of the font. Used with releaseFonts() to unload the font if no longer in use (by any users)
maxDirs The 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:
directory The directory to scan
registeredFor The 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:
directory The directory to scan
registeredFor The 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:
directory The directory to scan
registeredFor The 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:
fontPath The 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().

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Mon May 28 06:42:15 2012 for MythTV by  doxygen 1.6.3