I have loaded an "arial.ttf" file (taken from my /Windows/Fonts folder) into 
memory, however passing this into FT_New_Memory_Face crashes (I have also tried 
other ttf files, and this function still crashes). Any clues as to what I might 
be doing wrong? Note that I am using Freetype with the Android NDK, so it is 
difficult to debug, however I find that eventually, the crash occurs within:

FT_New_Memory_Face -> FT_Open_Face -> FT_Stream_ReadLong -> crashes at:if ( p 
){       result = FT_NEXT_LONG( p ); //crashes here, in file ftstream.c, method 
FT_Stream_ReadLong}
And below is my code:unsigned char *fontBuffer = LoadFile("arial.ttf");
zip_uint64_t fSize = GetFileSize("arial.ttf"); // I checked this, and it 
returns the correct size
FT_Library  library;
FT_Face     face; 
int error = FT_Init_FreeType( &library ); // I checked this, this step succeeds
if( error != 0 )
    printf("FT_Init_FreeType failed");

error = FT_New_Memory_Face( library,
                            (FT_Byte*)buffer,
                            fSize,                  
                            0,                      
                            &face );                                      
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to