2011-09-06 41 views
0

我已經將「arial.ttf」文件(取自我的/ Windows/Fonts文件夾)加載到內存中,但是將其傳遞到FT_New_Memory_Face崩潰(FT_Open_Face中的某處)。我無法調試這個,任何線索我可能做錯了什麼?FreeType FT_New_Memory_Face崩潰

unsigned char *fontBuffer = LoadFile("arial.ttf"); 
zip_uint64_t fSize = GetFileSize("arial.ttf"); 
FT_Library library; /* handle to library  */ 
FT_Face  face; 
int error = FT_Init_FreeType(&library); 
if(error != 0) 
    printf("FT_Init_FreeType failed"); 

error = FT_New_Memory_Face(library, 
          (FT_Byte*)fontBuffer, 
          fSize,     
          0,      
          &face); 

回答

4

原來的問題是我的結束,特別是,所述方法的LoadFile是從棧返回的存儲器,而不是堆。圖書館工作正常。謝謝!

+0

嗨,幾年後,但你能提供'LoadFile'嗎?我有同樣的問題。我認爲我的裝載機是錯誤的。 –