Also note, that I have verified that my 'LoadFile' function correctly reads in 
the input TTF file. I have tested this by writing out the bytes that this 
function reads in, to a different file, and then comparing the original TTF 
file with the output. The result is that the two are identical.

From: lost_bits1...@hotmail.ca
To: freetype-devel@nongnu.org
Subject: RE: [ft-devel] FT_New_Memory_Face crashes
Date: Wed, 7 Sep 2011 09:23:01 -0700








I apologize, I made a copy\paste error when providing the sample, I have 
corrected it below as they are in fact the same buffers in the code I'm 
running. 

Unfortunately I cannot provide a complete standalone sample as I am working in 
the Android NDK.
LD
From: david.be...@pb.com
To: lost_bits1...@hotmail.ca
Date: Wed, 7 Sep 2011 03:47:26 -0400
Subject: RE: [ft-devel] FT_New_Memory_Face crashes



















In the code sample, FT_NEW_MEMORY_Face()
is passed a different buffer from the one created by LoadFile().

 









From:
freetype-devel-bounces+david.bevan=pb....@nongnu.org
[mailto:freetype-devel-bounces+david.bevan=pb....@nongnu.org] On Behalf Of 
Louis Desjardins

Sent: 07 September 2011 00:13

To: freetype-devel@nongnu.org

Subject: [ft-devel]
FT_New_Memory_Face crashes



 





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 
sizeFT_Library  library;FT_Face     face; int error = FT_Init_FreeType( 
&library ); // I checked this, this step succeedsif( error != 0 )    
printf("FT_Init_FreeType failed"); error = FT_New_Memory_Face( library,         
                   (FT_Byte*)fontBuffer,                            fSize,      
                                        0,                                      
            &face );



                                                                                
                                          
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to