// // SemiSecretFont.m // flixel-ios // // Copyright Semi Secret Software 2009-2010. All rights reserved. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import @implementation SemiSecretFont - (NSString *) description { return [NSString stringWithFormat:@"", NSStringFromClass([self class]), size]; } + (SemiSecretFont *)fontWithName:(NSString *)name size:(CGFloat) size; { //dynamically search for a class with this name Class klass = NSClassFromString([NSString stringWithFormat:@"%@Font", name]); //NSLog(@"looking for font: %@", name); // NSLog(@"klass: %@", klass); SemiSecretFont * font = nil; if (klass) font = [[[klass alloc] initWithSize:size] autorelease]; return font; } - (id) fontWithSize:(CGFloat)s { Class klass = [self class]; SemiSecretFont * f = nil; f = [[[klass alloc] initWithSize:s] autorelease]; return f; } //this is not meant to be instantiated directly! - (id) initWithSize:(CGFloat)fontsize { if ((self = [super init])) { size = fontsize; font = nil; } return self; } - (void) setGlyphs:(CGGlyph *)glyphs forCharacters:(unichar *)chars size:(NSUInteger)length { for (unsigned i=0; i