@@ -27,15 +27,15 @@ g_font::g_font(std::string name, uint8_t* source, uint32_t sourceLength) : name(
2727 data = new uint8_t [sourceLength];
2828 if (!data)
2929 {
30- klog (" failed to allocate memory buffer for font '%s'" , name);
30+ printf (" failed to allocate memory buffer for font '%s'\n " , name);
3131 return ;
3232 }
3333 memcpy (data, source, sourceLength);
3434
3535 FT_Error error = FT_New_Memory_Face (g_font_manager::getInstance ()->getLibraryHandle (), data, sourceLength, 0 , &face);
3636 if (error)
3737 {
38- klog (" freetype2 failed at FT_New_Memory_Face with error code %i" , error);
38+ printf (" freetype2 failed at FT_New_Memory_Face with error code %i\n " , error);
3939 delete data;
4040 return ;
4141 }
@@ -45,7 +45,7 @@ g_font::g_font(std::string name, uint8_t* source, uint32_t sourceLength) : name(
4545 if (status != CAIRO_STATUS_SUCCESS)
4646 {
4747 FT_Done_Face (face);
48- klog (" cairo failed at cairo_ft_font_face_create_for_ft_face with error %i" , status);
48+ printf (" cairo failed at cairo_ft_font_face_create_for_ft_face with error %i\n " , status);
4949 cairo_face = 0 ;
5050 delete data;
5151 return ;
@@ -80,11 +80,12 @@ bool g_font::readAllBytes(FILE* file, uint32_t offset, uint8_t* buffer, uint32_t
8080
8181g_font* g_font::load (std::string path, std::string name)
8282{
83- FILE* file = fopen (path.c_str (), " r " );
83+ FILE* file = fopen (path.c_str (), " rb " );
8484 if (!file)
8585 return nullptr ;
8686
87- int64_t length = g_length (fileno (file));
87+ fseek (file, 0 , SEEK_END);
88+ long length = ftell (file);
8889 if (length == -1 )
8990 {
9091 fclose (file);
0 commit comments