FontManager Class Reference
Inherits from | NSObject |
Declared in | FontManager.h |
Tasks
-
+ sharedManager
-
– loadFont:
Loads a TTF font from the main bundle
-
– loadFontURL:
Loads a font from the given file URL
-
– fontWithName:
Returns the loaded font with the given filename
-
– zFontWithName:pointSize:
Returns a ZFont object corresponding to the loaded font with the given filename and point size
-
– zFontWithURL:pointSize:
Returns a ZFont object corresponding to the loaded font with the given file URL and point size
-
– copyAllFonts
Returns a CFArrayRef of all loaded CGFont objects
Instance Methods
copyAllFonts
Returns a CFArrayRef of all loaded CGFont objects
- (CFArrayRef)copyAllFonts
Return Value
A CFArrayRef of all loaded CGFont objects
@description You are responsible for releasing the CFArrayRef
Declared In
FontManager.h
fontWithName:
Returns the loaded font with the given filename
- (CGFontRef)fontWithName:(NSString *)filename
Parameters
- filename
The name of the font file that was given to -loadFont:
Return Value
A CGFontRef, or NULL if the specified font cannot be found
Discussion
If the font has not been loaded yet, -loadFont: will be
called with the given name first.
Declared In
FontManager.h
loadFont:
Loads a TTF font from the main bundle
- (BOOL)loadFont:(NSString *)filename
Parameters
- filename
The name of the font file to load (with or without extension).
Return Value
YES if the font was loaded, NO if an error occurred
Discussion
If the font has already been loaded, this method does nothing and returns YES.
This method first attempts to load the font by appending .ttf to the filename.
If that file does not exist, it tries the filename exactly as given.
Declared In
FontManager.h
loadFontURL:
Loads a font from the given file URL
- (BOOL)loadFontURL:(NSURL *)url
Parameters
- url
A file URL that points to a font file
Return Value
YES if the font was loaded, NO if an error occurred
Discussion
If the font has already been loaded, this method does nothing and returns YES.
Declared In
FontManager.h
zFontWithName:pointSize:
Returns a ZFont object corresponding to the loaded font with the given filename and point size
- (ZFont *)zFontWithName:(NSString *)filename pointSize:(CGFloat)pointSize
Parameters
- filename
The name of the font file that was given to -loadFont:
- pointSize
The point size of the font
Return Value
A ZFont, or NULL if the specified font cannot be found
Discussion
If the font has not been loaded yet, -loadFont: will be
called with the given name first.
Declared In
FontManager.h
zFontWithURL:pointSize:
Returns a ZFont object corresponding to the loaded font with the given file URL and point size
- (ZFont *)zFontWithURL:(NSURL *)url pointSize:(CGFloat)pointSize
Parameters
- url
A file URL that points to a font file
- pointSize
The point size of the font
Return Value
A ZFont, or NULL if the specified font cannot be loaded
Discussion
If the font has not been loaded yet, -loadFontURL: will be called with the given URL first.
Declared In
FontManager.h