Skip to content

Commit

Permalink
Move API to navigator.Fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
eb1 committed Dec 2, 2014
1 parent e3e0d2c commit b8493fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<keywords>cordova,fonts</keywords>
<repo>https://github.com/adapt-it/cordova-fonts.git</repo>
<issue>https://github.com/adapt-it/cordova-fonts/issues</issue>
<!-- expose our API under navigator.Fonts -->
<js-module name="fonts" src="www/fonts.js">
<clobbers target="cordova.plugins.fonts" />
<clobbers target="navigator.Fonts" />
</js-module>
<!-- ios -->
<platform name="ios">
Expand Down
7 changes: 3 additions & 4 deletions src/ios/CDVFonts.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ - (void)fonts:(CDVInvokedUrlCommand*)command

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSMutableArray* fonts = [NSMutableArray array];
NSMutableArray *fonts = [NSMutableArray array];
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
fonts.addObjectsFromArray(fontNames);
[fontNames release];
[fonts addObjectsFromArray:fontNames];
}

if (fonts != nil && [fonts length] > 0) {
if (fonts != nil) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fonts];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
Expand Down

0 comments on commit b8493fc

Please sign in to comment.