FreeType: cannot load font from memory
Posted: Sat Sep 17, 2016 5:13 am
Hello, can anyone here explain why when I load some unique font from memory (eg. Helvetica font) it always failed to load, and my machine (and Virtual machine) always hang when reach that line. In my assembler file, I have include my font file using as a binary using "incbin", like this:
global HelveticaFont
HelveticaFont:
incbin "res/font/Helvetica.ttf"
And in my C header file, I've included this:
extern "C" unsigned int HelveticaFont;
Anda in my C source that will use the font, I use this:
print_string("Setting font as Helvetica..");
FT_Library library;
FT_Face face;
FT_Init_FreeType(&library);
FT_New_Memory_Face(library, (char*)&HelveticaFont, HELVETICA_FONT_SIZE, 0, &face);
print_string("OK");
When I test that code, my machine and virtual machine shows text:
Setting font as Helvetica..
But never reach the line that print "OK".
Can anyone here explain how is that happening? What fault that I've done? Is that because of my Newlib? Do I have a bad malloc function? Big thanks for You if you can answer this
global HelveticaFont
HelveticaFont:
incbin "res/font/Helvetica.ttf"
And in my C header file, I've included this:
extern "C" unsigned int HelveticaFont;
Anda in my C source that will use the font, I use this:
print_string("Setting font as Helvetica..");
FT_Library library;
FT_Face face;
FT_Init_FreeType(&library);
FT_New_Memory_Face(library, (char*)&HelveticaFont, HELVETICA_FONT_SIZE, 0, &face);
print_string("OK");
When I test that code, my machine and virtual machine shows text:
Setting font as Helvetica..
But never reach the line that print "OK".
Can anyone here explain how is that happening? What fault that I've done? Is that because of my Newlib? Do I have a bad malloc function? Big thanks for You if you can answer this