#include "ft2build.h" #include FT_FREETYPE_H #include FT_TRUETYPE_TABLES_H #include FT_CID_H #include int main( void ) { const char * aCffFile = "font.cff"; FT_Library library; FT_Face face; FT_Error error; error = FT_Init_FreeType( &library ); FT_Byte * fontInMemory=NULL; long fontInMemorySize=0; FILE * fp = fopen( aCffFile, "r+b" ); fseek(fp, 0L, SEEK_END); fontInMemorySize = ftell(fp); fseek(fp, 0L, SEEK_SET); fontInMemory = new FT_Byte[fontInMemorySize+1]; fread(fontInMemory, 1, fontInMemorySize, fp ); fclose( fp ); fontInMemory[fontInMemorySize]=0; error = FT_New_Memory_Face( library, fontInMemory, fontInMemorySize, 0, &face ); error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); printf( "error %i \r\n", (int)error ); error = FT_Done_Face( face ); error = FT_Done_FreeType( library ); delete []fontInMemory; }