Short and sweet. Just enough C to let Cello at the FTGL C++ libs. These
files are for those not on win32. I just added this source to the FTGL
win32 VC++ project. The author of FTGL has expressed an interest in this
code, so maybe he will add a C interface soon and we can stop forking.
An alternative I guess would be for me to make my own FTGL-C dll and
link that against an unmodified FTGL static lib. I took the quick way
out for now.
--
http://tilton-technology.com
Why Lisp?
http://alu.cliki.net/RtL%20Highlight%20Film
Your Project Here!
http://alu.cliki.net/Industry%20Application
#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 );
}
}
DESCRIPTION 'C Interface to FTGL'
VERSION 0.1
EXPORTS
fgcSetFaceSize
fgcStringX
fgcAscender
fgcDescender
fgcStringAdvance
fgcRender
fgcFree
fgcBitmapMake
fgcPixmapMake
fgcTextureMake
fgcPolygonMake
fgcOutlineMake
fgcExtrudedMake
fgcSetFaceDepth