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

  •   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
  • – initWithContentsOfFile: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.

  • – initWithContentsOfURL: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.

  • – newFont

    Creates a new PXFont object containing all information needed to view the font.

  • + 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.

  • + fontLoaderWithContentsOfURL: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.

Other 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.

Other Methods

  • – initWithContentsOfURL:

    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.

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 *options

Declared In

PXFontLoader.h

Class 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 *)options

Parameters

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.m

fontLoaderWithContentsOfURL: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 *)options

Parameters

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.m

Instance 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 *)path

Parameters

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.m

initWithContentsOfFile: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 *)_options

Parameters

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.m

initWithContentsOfURL:

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

Parameters

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.m

initWithContentsOfURL: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 *)_options

Parameters

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

newFont

Creates a new PXFont object containing all information needed to view the font.

- (PXFont *)newFont

Return Value

The new PXFont object.

Declared In

PXFontLoader.m