diff options
Diffstat (limited to 'libs/FontLabel/FontManager.h')
-rwxr-xr-x | libs/FontLabel/FontManager.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/libs/FontLabel/FontManager.h b/libs/FontLabel/FontManager.h new file mode 100755 index 0000000..1592b8a --- /dev/null +++ b/libs/FontLabel/FontManager.h | |||
@@ -0,0 +1,85 @@ | |||
1 | // | ||
2 | // FontManager.h | ||
3 | // FontLabel | ||
4 | // | ||
5 | // Created by Kevin Ballard on 5/5/09. | ||
6 | // Copyright © 2009 Zynga Game Networks | ||
7 | // | ||
8 | // | ||
9 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
10 | // you may not use this file except in compliance with the License. | ||
11 | // You may obtain a copy of the License at | ||
12 | // | ||
13 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
14 | // | ||
15 | // Unless required by applicable law or agreed to in writing, software | ||
16 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
18 | // See the License for the specific language governing permissions and | ||
19 | // limitations under the License. | ||
20 | // | ||
21 | |||
22 | #import <Foundation/Foundation.h> | ||
23 | #import <CoreGraphics/CoreGraphics.h> | ||
24 | |||
25 | @class ZFont; | ||
26 | |||
27 | @interface FontManager : NSObject { | ||
28 | CFMutableDictionaryRef fonts; | ||
29 | NSMutableDictionary *urls; | ||
30 | } | ||
31 | + (FontManager *)sharedManager; | ||
32 | /*! | ||
33 | @method | ||
34 | @abstract Loads a TTF font from the main bundle | ||
35 | @param filename The name of the font file to load (with or without extension). | ||
36 | @return YES if the font was loaded, NO if an error occurred | ||
37 | @discussion If the font has already been loaded, this method does nothing and returns YES. | ||
38 | This method first attempts to load the font by appending .ttf to the filename. | ||
39 | If that file does not exist, it tries the filename exactly as given. | ||
40 | */ | ||
41 | - (BOOL)loadFont:(NSString *)filename; | ||
42 | /*! | ||
43 | @method | ||
44 | @abstract Loads a font from the given file URL | ||
45 | @param url A file URL that points to a font file | ||
46 | @return YES if the font was loaded, NO if an error occurred | ||
47 | @discussion If the font has already been loaded, this method does nothing and returns YES. | ||
48 | */ | ||
49 | - (BOOL)loadFontURL:(NSURL *)url; | ||
50 | /*! | ||
51 | @method | ||
52 | @abstract Returns the loaded font with the given filename | ||
53 | @param filename The name of the font file that was given to -loadFont: | ||
54 | @return A CGFontRef, or NULL if the specified font cannot be found | ||
55 | @discussion If the font has not been loaded yet, -loadFont: will be | ||
56 | called with the given name first. | ||
57 | */ | ||
58 | - (CGFontRef)fontWithName:(NSString *)filename __AVAILABILITY_INTERNAL_DEPRECATED; | ||
59 | /*! | ||
60 | @method | ||
61 | @abstract Returns a ZFont object corresponding to the loaded font with the given filename and point size | ||
62 | @param filename The name of the font file that was given to -loadFont: | ||
63 | @param pointSize The point size of the font | ||
64 | @return A ZFont, or NULL if the specified font cannot be found | ||
65 | @discussion If the font has not been loaded yet, -loadFont: will be | ||
66 | called with the given name first. | ||
67 | */ | ||
68 | - (ZFont *)zFontWithName:(NSString *)filename pointSize:(CGFloat)pointSize; | ||
69 | /*! | ||
70 | @method | ||
71 | @abstract Returns a ZFont object corresponding to the loaded font with the given file URL and point size | ||
72 | @param url A file URL that points to a font file | ||
73 | @param pointSize The point size of the font | ||
74 | @return A ZFont, or NULL if the specified font cannot be loaded | ||
75 | @discussion If the font has not been loaded yet, -loadFontURL: will be called with the given URL first. | ||
76 | */ | ||
77 | - (ZFont *)zFontWithURL:(NSURL *)url pointSize:(CGFloat)pointSize; | ||
78 | /*! | ||
79 | @method | ||
80 | @abstract Returns a CFArrayRef of all loaded CGFont objects | ||
81 | @return A CFArrayRef of all loaded CGFont objects | ||
82 | @description You are responsible for releasing the CFArrayRef | ||
83 | */ | ||
84 | - (CFArrayRef)copyAllFonts; | ||
85 | @end | ||