fix fix some fonts not getting loaded on OSX

This commit is contained in:
UnknownShadow200 2018-10-31 19:16:22 +11:00
parent 75ceeda229
commit 4c63243c3b
4 changed files with 20 additions and 12 deletions

View File

@ -891,11 +891,11 @@ void Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
/* For OSX font suitcase files */
#ifdef CC_BUILD_OSX
char fileBuffer[FILENAME_SIZE + 1];
String file = String_NT_Array(fileBuffer);
String_Copy(&file, &path);
file.buffer[file.length] = '\0';
args.pathname = file.buffer;
char filenameBuffer[FILENAME_SIZE + 1];
String filename = String_NT_Array(filenameBuffer);
String_Copy(&filename, &path);
filename.buffer[filename.length] = '\0';
args.pathname = filename.buffer;
#endif
err = FT_New_Face(ft_lib, &args, 0, &face);
@ -948,7 +948,17 @@ static void Font_DirCallback(const String* path, void* obj) {
FT_Error err;
if (!Font_MakeArgs(path, &stream, &args)) return;
err = FT_Open_Face(ft_lib, &args, 0, &face);
/* For OSX font suitcase files */
#ifdef CC_BUILD_OSX
char filenameBuffer[FILENAME_SIZE + 1];
String filename = String_NT_Array(filenameBuffer);
String_Copy(&filename, path);
filename.buffer[filename.length] = '\0';
args.pathname = filename.buffer;
#endif
err = FT_New_Face(ft_lib, &args, 0, &face);
if (err) { stream.close(&stream); return; }
if (face->style_flags == FT_STYLE_FLAG_BOLD) {

View File

@ -128,10 +128,7 @@ FT_BEGIN_HEADER
#ifdef ECANCELED /* defined since 10.2 */
#include "AvailabilityMacros.h"
#endif
#if defined( __LP64__ ) && \
( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
#undef FT_MACINTOSH
#endif
#define FT_MACINTOSH 1
#elif defined( __SC__ ) || defined( __MRC__ )
/* Classic MacOS compilers */

View File

@ -987,7 +987,7 @@
return error;
/* let it fall through to normal loader (.ttf, .otf, etc.) */
return FT_Open_Face( library, &args, face_index, aface );
return FT_Open_Face( library, args, face_index, aface );
}

View File

@ -2221,7 +2221,6 @@
FT_Error error;
FT_UNUSED( args );
error = IsMacBinary( library, stream, face_index, aface );
if ( FT_ERR_EQ( error, Unknown_File_Format ) )
{
@ -2258,6 +2257,7 @@
/* documentation is in freetype.h */
#ifndef FT_MACINTOSH
FT_EXPORT_DEF( FT_Error )
FT_New_Face( FT_Library library,
const FT_Open_Args* args,
@ -2266,6 +2266,7 @@
{
return FT_Open_Face( library, args, face_index, aface );
}
#endif
FT_EXPORT_DEF( FT_Error )
FT_Open_Face( FT_Library library,