Freetype font from memory

Hi

Everytime I try to opens a ttf font from memory it fails (returns value != 0). Here's the code :

// Get the ttf font as a byte[]
byte[] data = ResourceManager.OpenResource(fileName);
if (data == null)
{
Log.Send(new LogEventArgs(LogLevel.Fatal, "Failed to open \""+ fileName + "\". Binary missing ?", null));
return false;
}
IntPtr faceptr = IntPtr.Zero;
if (FT.FT_New_Memory_Face(libptr, data, data.Length, 0, faceptr) != 0)
{
// ALWAYS fails here !
Log.Send(new LogEventArgs(LogLevel.Fatal, "Failed to create FT_Face from memory.", null));
return false;
}

FT_FaceRec face = (FT_FaceRec)Marshal.PtrToStructure(faceptr, typeof(FT_FaceRec));

So does anyone ever succeded in using ttf font from memory ?

Iliak

Theme by La Boite a site | Powered by Drupal