//
//  glFont.h
//  CGL
//
//  Created by kat on Sat Jun 15 2002.
//  Copyright (c) 2001 Katherine Tattersall. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>

#import <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>

#define max_chars 96

/*
    Apple does not provide for a bitmap font except with respect to glutBitmapFont
    glutBitmapFont does not provide many different fonts
    To compete with windows programs, we may want to use bitmap fonts, but with the above, we are limited
    Therefore, we create glBitmapFont
    glBitmapFont handles writing text to the open gl context
    glBitmapFont will create a Bitmap font with any font you can name as a font 
        as long as it can be used in both NSFont and CGContext
 */
@interface NSGLFont : NSObject {

    GLuint	base;
    
    NSFont	*font;
    
    unsigned char *	data      [max_chars];
    size_t		width     [max_chars];
    size_t		height    [max_chars];
    
    size_t		max_height;
    size_t		max_width;
    unsigned int        x_offset  [max_chars];
    
}

// fontname should be as defined on the apple NSFont page (postscript name)
-(id) 	initFont: (NSString *)fontname 
        atSize:(int)size;
-(void) writeString: (NSString *)s;
-(void) convertBitmap: (int) number;
-(void) drawLetter:(char) 	ch 
        context: (CGContextRef)	cg_context 
        atx:(int)		xpos 
        withFont:(const char *)	fontname 
        atSize:(int)		size;

@end

void glPrint( NSGLFont *f, float x, float y, const char *fmt, ... );

