#include <assert.h>
#include "FTGLBitmapFont.h"
#include "FTBitmapGlyph.h"

#include "FTGLPixmapFont.h"
#include "FTPixmapGlyph.h"

#include "FTGLTextureFont.h"
#include "FTTextureGlyph.h"

#include "FTGlyphContainer.h"
#include "FTBBox.h"

#include "FTGLPolygonFont.h"
#include "FTPolyGlyph.h"

#include    "FTGLOutlineFont.h"
#include    "FTOutlineGlyph.h"

#include    "FTGLExtrdFont.h"
#include    "FTExtrdGlyph.h"



extern "C" {

bool __stdcall fgcSetFaceSize( FTFont* f
							  , unsigned int faceSize
							  , unsigned int res ) {
	return f->FaceSize( faceSize, res );
}

float __stdcall fgcAscender( FTFont* f ) {
	return f->Ascender( );
}

float __stdcall fgcDescender( FTFont* f ) {
	return f->Descender( );
}

float __stdcall fgcStringAdvance( FTFont* f, const char* string ) {
	return f->Advance( string );
}

float __stdcall fgcStringX( FTFont* f, const char* string ) {
    float llx,lly,llz,urx,ury,urz;

	f->BBox( string, llx, lly, llz, urx, ury, urz );
	return llx;
}

void __stdcall fgcRender( FTFont* f, const char *string ) {
	f->Render( string );
}

void __stdcall fgcFree( FTFont* f ) {
	delete f;
}

//--------- Bitmap ----------------------------------------------

FTGLBitmapFont* __stdcall fgcBitmapMake( const char* fontname ) {
	return new FTGLBitmapFont( fontname );
}

//--------- Pixmap ----------------------------------------------

FTGLPixmapFont* __stdcall fgcPixmapMake( const char* fontname ) {
	return new FTGLPixmapFont( fontname );
}

//--------- Texture ----------------------------------------------

FTGLTextureFont* __stdcall fgcTextureMake( const char* fontname ) {
	return new FTGLTextureFont( fontname );
}

//--------- Polygon ----------------------------------------------

FTGLPolygonFont* __stdcall fgcPolygonMake( const char* fontname ) {
	return new FTGLPolygonFont( fontname );
}

//--------- Outline ----------------------------------------------

FTGLOutlineFont* __stdcall fgcOutlineMake( const char* fontname ) {
	return new FTGLOutlineFont( fontname );
}

//--------- Extruded Polygon -------------------------------------

FTGLExtrdFont* __stdcall fgcExtrudedMake( const char* fontname ) {
	return new FTGLExtrdFont( fontname );
}

// make a new extrd ctor that takes a depth parm

bool FTGLExtrdFont::FaceDepth( float new_depth )
{
    Depth( new_depth );
	return FaceSize( this->FaceSize(), 96 ); // force new glyphs
}


bool __stdcall fgcSetFaceDepth( FTGLExtrdFont* f
							  , float depth ) {
	return f->FaceDepth( depth );
}


}

