PXFontLoader Class Reference
| Inherits from | PXLoader : NSObject |
| Declared in | PXFontLoader.h PXFontLoader.m |
Overview
A PXFontLoader loads font information and creats PXFont objects from the loaded information.
The following font formats are supported natively:
- .fnt (AngelCode Texture Font Format)
- .ttf
- .otf
- .pfm
- .afm
- .inf
- .cff
- .bdf
- .pfr
Example:
PXFontLoader *fontLoader = [[PXFontLoader alloc] initWithContentsOfFile:@"font.fnt" options:nil];
PXFont *font = [fontLoader newFont];
[fontLoader release];
Tasks
Other Methods
-
optionsThe options object defines what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font would
be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
property -
– initWithContentsOfFile:options:Creates a new PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported. -
– initWithContentsOfURL:options:Creates a new PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported. -
– newFontCreates a new PXFont object containing all information needed to view the font.
-
+ fontLoaderWithContentsOfFile:options:Creates a PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported. -
+ fontLoaderWithContentsOfURL:options:Creates a PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported.
Other Methods
-
– initWithContentsOfFile:Creates a new PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported.
Other Methods
-
– initWithContentsOfURL:Creates a new PXFontLoader instance containing the loaded font data returns
nilif the file could not be found, or the format isn’t supported.
Properties
options
The options object defines what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font would
be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
@property (nonatomic, copy) PXFontOptions *optionsDeclared In
PXFontLoader.hClass Methods
fontLoaderWithContentsOfFile:options:
Creates a PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
+ (PXFontLoader *)fontLoaderWithContentsOfFile:(NSString *)path options:(PXFontOptions *)optionsParameters
- path
The path of the font file to load. The file path may be absolute or relative to the application bundle.
- options
The options defining what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font
would be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
Return Value
The resulting, autoreleased, PXFontLoader object.
Example:
PXFontLoader *fontLoader = [PXFontLoader fontLoaderWithContentsOfFile:@"font.fnt" options:nil];
PXFont *font = [fontLoader newFont];
[PXFont registerFont:font withName:@"font"];
// The font is now registered as the name "font", so any time you want to
// reference it, you can use "font.
[font release];
Declared In
PXFontLoader.mfontLoaderWithContentsOfURL:options:
Creates a PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
+ (PXFontLoader *)fontLoaderWithContentsOfURL:(NSURL *)url options:(PXFontOptions *)optionsParameters
- url
The url of the font to load.
- options
The options defining what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font
would be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
Return Value
The resulting, autoreleased, PXFontLoader object.
Example:
PXFontLoader *fontLoader = [PXFontLoader fontLoaderWithContentsOfURL:[NSURL URLWithString:@"www.myWebsite.com/font.fnt"] options:nil];
PXFont *font = [fontLoader newFont];
[PXFont registerFont:font withName:@"font"];
// The font is now registered as the name "font", so any time you want to
// reference it, you can use "font.
[font release];
Declared In
PXFontLoader.mInstance Methods
initWithContentsOfFile:
Creates a new PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
- (id)initWithContentsOfFile:(NSString *)pathParameters
- path
The path of the font file to load. The file path may be absolute or relative to the application bundle.
Example:
PXFontLoader *fontLoader = [[PXFontLoader alloc] initWithContentsOfFile:@"font.fnt"]; PXFont *font = [fontLoader newFont]; [PXFont registerFont:font withName:@"font"]; // The font is now registered as the name "font", so any time you want to // reference it, you can use "font. [font release]; [fontLoader release];
Declared In
PXFontLoader.minitWithContentsOfFile:options:
Creates a new PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
- (id)initWithContentsOfFile:(NSString *)path options:(PXFontOptions *)_optionsParameters
- path
The path of the font file to load. The file path may be absolute or relative to the application bundle.
- options
The options defining what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font
would be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
Example:
PXFontLoader *fontLoader = [[PXFontLoader alloc] initWithContentsOfFile:@"font.fnt" options:nil]; PXFont *font = [fontLoader newFont]; [PXFont registerFont:font withName:@"font"]; // The font is now registered as the name "font", so any time you want to // reference it, you can use "font. [font release]; [fontLoader release];
Declared In
PXFontLoader.minitWithContentsOfURL:
Creates a new PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
- (id)initWithContentsOfURL:(NSURL *)urlParameters
- url
The url of the font to load.
Example:
PXFontLoader *fontLoader = [[PXFontLoader alloc] initWithContentsOfURL:[NSURL URLWithString:@"www.myWebsite.com/font.fnt"]]; PXFont *font = [fontLoader newFont]; [PXFont registerFont:font withName:@"font"]; // The font is now registered as the name "font", so any time you want to // reference it, you can use "font. [font release]; [fontLoader release];
Declared In
PXFontLoader.minitWithContentsOfURL:options:
Creates a new PXFontLoader instance containing the loaded font data returns
nil if the file could not be found, or the format isn’t
supported.
- (id)initWithContentsOfURL:(NSURL *)url options:(PXFontOptions *)_optionsParameters
- url
The url of the font to load.
- options
The options defining what form of font you want. Ex. If a
PXTextureFontOption is given, then each glyph of the font
would be mapped to a texture. If the font file you are loading already has this information, it is also loaded.
Example:
PXFontLoader *fontLoader = [[PXFontLoader alloc] initWithContentsOfURL:[NSURL URLWithString:@"www.myWebsite.com/font.fnt"] options:nil]; PXFont *font = [fontLoader newFont]; [PXFont registerFont:font withName:@"font"]; // The font is now registered as the name "font", so any time you want to // reference it, you can use "font. [font release]; [fontLoader release];
Declared In
PXFontLoader.m