#import <AppKit/AppKit.h>
/* Print out width of characters in font. */

@interface Tester : NSObject
{}
- menuOp;
- updateMenu;
@end

NSMenu *menu;

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSString *fontName;
    int fontSize;
    NSFont *font;
    char a;

    if (argc != 3)
      {
        fprintf(stderr, "usage: %s font_name font_size\n", argv[0]);
        exit (1);
      }
    fontName = [NSString stringWithCString: argv[1]];
    fontSize = atoi(argv[2]);

    [NSApplication sharedApplication];

    font = [NSFont fontWithName: fontName size: fontSize];
    if (font == nil)
      {
        NSLog(@"Unable to load font.");
        exit (1);
      }
    else
      {
        NSLog(@"Loaded font '%@'.", font);
      }

    for (a = 'a'; a<='z'; a++)
      {
        NSString *str =  [NSString stringWithFormat: @"%c",a];
        fprintf(stderr, "%c\t%.1f", a, [font widthOfString: str]);
        str =  [NSString stringWithFormat: @"%c",a+'A'-'a'];
        fprintf(stderr, "\t%.1f\n", [font widthOfString: str]);      }

    [pool release];
    return 0;
}
