Mac OS X Carbon tests in configure.raw are improved and builds/mac/ftmac.c is updated to sync to src/base/ftmac.c
This commit is contained in:
parent
05f5c58d13
commit
44b5e57781
|
@ -1,3 +1,10 @@
|
||||||
|
2007-12-06 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||||
|
|
||||||
|
* builds/unix/configure.raw: improve the compile tests to search
|
||||||
|
Carbon functions.
|
||||||
|
* builds/mac/ftmac.c: import fixes for Carbon incompatibilities
|
||||||
|
proposed by Sean McBride from src/base/ftmac.c (see 2007-11-16).
|
||||||
|
|
||||||
2007-12-06 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
2007-12-06 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||||
|
|
||||||
The documents and comments for Mac OS X are improved by Sean
|
The documents and comments for Mac OS X are improved by Sean
|
||||||
|
|
|
@ -74,7 +74,9 @@
|
||||||
#undef OS_INLINE
|
#undef OS_INLINE
|
||||||
#define OS_INLINE static __inline__
|
#define OS_INLINE static __inline__
|
||||||
#endif
|
#endif
|
||||||
#include <Carbon/Carbon.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
#include <sys/syslimits.h> /* PATH_MAX */
|
||||||
#else
|
#else
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <Fonts.h>
|
#include <Fonts.h>
|
||||||
|
@ -84,6 +86,10 @@
|
||||||
#include <TextUtils.h>
|
#include <TextUtils.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX 1024 /* same with Mac OS X's syslimits.h */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
|
#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
|
||||||
#include <FSp_fopen.h>
|
#include <FSp_fopen.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,9 +98,12 @@
|
||||||
|
|
||||||
#include FT_MAC_H
|
#include FT_MAC_H
|
||||||
|
|
||||||
|
/* undefine blocking-macros in ftmac.h */
|
||||||
#undef FT_GetFile_From_Mac_Name
|
#undef FT_GetFile_From_Mac_Name
|
||||||
#undef FT_GetFile_From_Mac_ATS_Name
|
#undef FT_GetFile_From_Mac_ATS_Name
|
||||||
|
#undef FT_New_Face_From_FOND
|
||||||
#undef FT_New_Face_From_FSSpec
|
#undef FT_New_Face_From_FSSpec
|
||||||
|
#undef FT_New_Face_From_FSRef
|
||||||
|
|
||||||
|
|
||||||
/* FSSpec functions are deprecated since Mac OS X 10.4 */
|
/* FSSpec functions are deprecated since Mac OS X 10.4 */
|
||||||
|
@ -115,11 +124,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HFS_MAXPATHLEN
|
|
||||||
#define HFS_MAXPATHLEN 1024
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* QuickDraw is deprecated since Mac OS X 10.4 */
|
/* QuickDraw is deprecated since Mac OS X 10.4 */
|
||||||
#ifndef HAVE_QUICKDRAW_CARBON
|
#ifndef HAVE_QUICKDRAW_CARBON
|
||||||
#if TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
|
||||||
|
@ -133,9 +137,17 @@
|
||||||
#ifndef HAVE_ATS
|
#ifndef HAVE_ATS
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
#define HAVE_ATS 1
|
#define HAVE_ATS 1
|
||||||
|
#ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */
|
||||||
|
#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define HAVE_ATS 0
|
#define HAVE_ATS 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Some portable types are unavailable on legacy SDKs */
|
||||||
|
#ifndef MAC_OS_X_VERSION_10_5
|
||||||
|
typedef short ResourceIndex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
|
/* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
|
||||||
|
@ -253,20 +265,26 @@
|
||||||
|
|
||||||
/* Private function. */
|
/* Private function. */
|
||||||
/* The FSSpec type has been discouraged for a long time, */
|
/* The FSSpec type has been discouraged for a long time, */
|
||||||
/* but for some reason, there is no FSRef version of */
|
/* unfortunately an FSRef replacement API for */
|
||||||
/* ATSFontGetFileSpecification(), so we made our own. */
|
/* ATSFontGetFileSpecification() is only available in */
|
||||||
/* Apple will provide one eventually. */
|
/* Mac OS X 10.5 and later. */
|
||||||
static OSStatus
|
static OSStatus
|
||||||
FT_ATSFontGetFileReference( ATSFontRef ats_font_id,
|
FT_ATSFontGetFileReference( ATSFontRef ats_font_id,
|
||||||
FSRef* ats_font_ref )
|
FSRef* ats_font_ref )
|
||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
|
#if !defined( MAC_OS_X_VERSION_10_5 ) || \
|
||||||
|
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
FSSpec spec;
|
FSSpec spec;
|
||||||
|
|
||||||
|
|
||||||
err = ATSFontGetFileSpecification( ats_font_id, &spec );
|
err = ATSFontGetFileSpecification( ats_font_id, &spec );
|
||||||
if ( noErr == err )
|
if ( noErr == err )
|
||||||
err = FSpMakeFSRef( &spec, ats_font_ref );
|
err = FSpMakeFSRef( &spec, ats_font_ref );
|
||||||
|
#else
|
||||||
|
err = ATSFontGetFileReference( ats_font_id, ats_font_ref );
|
||||||
|
#endif
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -887,7 +905,7 @@
|
||||||
ResID sfnt_id;
|
ResID sfnt_id;
|
||||||
short have_sfnt, have_lwfn;
|
short have_sfnt, have_lwfn;
|
||||||
Str255 lwfn_file_name;
|
Str255 lwfn_file_name;
|
||||||
UInt8 buff[HFS_MAXPATHLEN];
|
UInt8 buff[PATH_MAX];
|
||||||
FT_Error err;
|
FT_Error err;
|
||||||
short num_faces;
|
short num_faces;
|
||||||
|
|
||||||
|
@ -945,7 +963,8 @@
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
post_data = Get1Resource( 'POST', res_id++ );
|
post_data = Get1Resource( FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
|
||||||
|
res_id++ );
|
||||||
if ( post_data == NULL )
|
if ( post_data == NULL )
|
||||||
break; /* we are done */
|
break; /* we are done */
|
||||||
|
|
||||||
|
@ -984,7 +1003,8 @@
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
post_data = Get1Resource( 'POST', res_id++ );
|
post_data = Get1Resource( FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
|
||||||
|
res_id++ );
|
||||||
if ( post_data == NULL )
|
if ( post_data == NULL )
|
||||||
break; /* we are done */
|
break; /* we are done */
|
||||||
|
|
||||||
|
@ -1186,7 +1206,7 @@
|
||||||
int is_cff;
|
int is_cff;
|
||||||
|
|
||||||
|
|
||||||
sfnt = GetResource( 'sfnt', sfnt_id );
|
sfnt = GetResource( FT_MAKE_TAG( 's', 'f', 'n', 't' ), sfnt_id );
|
||||||
if ( ResError() )
|
if ( ResError() )
|
||||||
return FT_Err_Invalid_Handle;
|
return FT_Err_Invalid_Handle;
|
||||||
|
|
||||||
|
@ -1225,7 +1245,7 @@
|
||||||
{
|
{
|
||||||
FT_Error error = FT_Err_Cannot_Open_Resource;
|
FT_Error error = FT_Err_Cannot_Open_Resource;
|
||||||
ResFileRefNum res_ref;
|
ResFileRefNum res_ref;
|
||||||
short res_index;
|
ResourceIndex res_index;
|
||||||
Handle fond;
|
Handle fond;
|
||||||
short num_faces_in_res, num_faces_in_fond;
|
short num_faces_in_res, num_faces_in_fond;
|
||||||
|
|
||||||
|
@ -1240,7 +1260,8 @@
|
||||||
num_faces_in_res = 0;
|
num_faces_in_res = 0;
|
||||||
for ( res_index = 1; ; ++res_index )
|
for ( res_index = 1; ; ++res_index )
|
||||||
{
|
{
|
||||||
fond = Get1IndResource( 'FOND', res_index );
|
fond = Get1IndResource( FT_MAKE_TAG( 'F', 'O', 'N', 'D' ),
|
||||||
|
res_index );
|
||||||
if ( ResError() )
|
if ( ResError() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1273,13 +1294,14 @@
|
||||||
OSType fond_type;
|
OSType fond_type;
|
||||||
Str255 fond_name;
|
Str255 fond_name;
|
||||||
Str255 lwfn_file_name;
|
Str255 lwfn_file_name;
|
||||||
UInt8 path_lwfn[HFS_MAXPATHLEN];
|
UInt8 path_lwfn[PATH_MAX];
|
||||||
OSErr err;
|
OSErr err;
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
GetResInfo( fond, &fond_id, &fond_type, fond_name );
|
GetResInfo( fond, &fond_id, &fond_type, fond_name );
|
||||||
if ( ResError() != noErr || fond_type != 'FOND' )
|
if ( ResError() != noErr ||
|
||||||
|
fond_type != FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) )
|
||||||
return FT_Err_Invalid_File_Format;
|
return FT_Err_Invalid_File_Format;
|
||||||
|
|
||||||
HLock( fond );
|
HLock( fond );
|
||||||
|
@ -1298,7 +1320,7 @@
|
||||||
#if HAVE_FSREF
|
#if HAVE_FSREF
|
||||||
|
|
||||||
{
|
{
|
||||||
UInt8 path_fond[HFS_MAXPATHLEN];
|
UInt8 path_fond[PATH_MAX];
|
||||||
FSRef ref;
|
FSRef ref;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1320,7 +1342,7 @@
|
||||||
#elif HAVE_FSSPEC
|
#elif HAVE_FSSPEC
|
||||||
|
|
||||||
{
|
{
|
||||||
UInt8 path_fond[HFS_MAXPATHLEN];
|
UInt8 path_fond[PATH_MAX];
|
||||||
FCBPBRec pb;
|
FCBPBRec pb;
|
||||||
Str255 fond_file_name;
|
Str255 fond_file_name;
|
||||||
FSSpec spec;
|
FSSpec spec;
|
||||||
|
@ -1389,7 +1411,7 @@
|
||||||
|
|
||||||
/* LWFN is a (very) specific file format, check for it explicitly */
|
/* LWFN is a (very) specific file format, check for it explicitly */
|
||||||
file_type = get_file_type_from_path( pathname );
|
file_type = get_file_type_from_path( pathname );
|
||||||
if ( file_type == 'LWFN' )
|
if ( file_type == FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) )
|
||||||
return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
|
return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
|
||||||
|
|
||||||
/* Otherwise the file type doesn't matter (there are more than */
|
/* Otherwise the file type doesn't matter (there are more than */
|
||||||
|
@ -1457,6 +1479,8 @@
|
||||||
/* FT_New_Face_From_FSRef is identical to FT_New_Face except it */
|
/* FT_New_Face_From_FSRef is identical to FT_New_Face except it */
|
||||||
/* accepts an FSRef instead of a path. */
|
/* accepts an FSRef instead of a path. */
|
||||||
/* */
|
/* */
|
||||||
|
/* This function is deprecated because Carbon data types (FSRef) */
|
||||||
|
/* are not cross-platform, and thus not suitable for the freetype API. */
|
||||||
FT_EXPORT_DEF( FT_Error )
|
FT_EXPORT_DEF( FT_Error )
|
||||||
FT_New_Face_From_FSRef( FT_Library library,
|
FT_New_Face_From_FSRef( FT_Library library,
|
||||||
const FSRef* ref,
|
const FSRef* ref,
|
||||||
|
@ -1478,7 +1502,7 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_Open_Args args;
|
FT_Open_Args args;
|
||||||
OSErr err;
|
OSErr err;
|
||||||
UInt8 pathname[HFS_MAXPATHLEN];
|
UInt8 pathname[PATH_MAX];
|
||||||
|
|
||||||
|
|
||||||
if ( !ref )
|
if ( !ref )
|
||||||
|
@ -1511,6 +1535,8 @@
|
||||||
/* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */
|
/* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */
|
||||||
/* accepts an FSSpec instead of a path. */
|
/* accepts an FSSpec instead of a path. */
|
||||||
/* */
|
/* */
|
||||||
|
/* This function is deprecated because Carbon data types (FSSpec) */
|
||||||
|
/* are not cross-platform, and thus not suitable for the freetype API. */
|
||||||
FT_EXPORT_DEF( FT_Error )
|
FT_EXPORT_DEF( FT_Error )
|
||||||
FT_New_Face_From_FSSpec( FT_Library library,
|
FT_New_Face_From_FSSpec( FT_Library library,
|
||||||
const FSSpec* spec,
|
const FSSpec* spec,
|
||||||
|
@ -1533,7 +1559,7 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_Open_Args args;
|
FT_Open_Args args;
|
||||||
OSErr err;
|
OSErr err;
|
||||||
UInt8 pathname[HFS_MAXPATHLEN];
|
UInt8 pathname[PATH_MAX];
|
||||||
|
|
||||||
|
|
||||||
if ( !spec )
|
if ( !spec )
|
||||||
|
|
|
@ -316,11 +316,9 @@ elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
||||||
FCBPBPtr paramBlock;
|
|
||||||
short vRefNum;
|
short vRefNum;
|
||||||
long dirID;
|
long dirID;
|
||||||
ConstStr255Param fileName;
|
ConstStr255Param fileName;
|
||||||
FSSpec* spec;
|
|
||||||
|
|
||||||
Boolean* isDirectory;
|
Boolean* isDirectory;
|
||||||
UInt8* path;
|
UInt8* path;
|
||||||
|
@ -334,16 +332,21 @@ elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
|
||||||
FSForkInfo* forkInfo;
|
FSForkInfo* forkInfo;
|
||||||
FSRef* ref;
|
FSRef* ref;
|
||||||
|
|
||||||
|
#if HAVE_FSSPEC
|
||||||
|
FSSpec* spec;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FSRef functions: no need to check? */
|
/* FSRef functions: no need to check? */
|
||||||
FSGetForkCBInfo( desiredRefNum, volume, iterator,
|
FSGetForkCBInfo( desiredRefNum, volume, iterator,
|
||||||
actualRefNum, forkInfo, ref,
|
actualRefNum, forkInfo, ref,
|
||||||
outForkName );
|
outForkName );
|
||||||
|
FSPathMakeRef( path, ref, isDirectory );
|
||||||
|
|
||||||
|
#if HAVE_FSSPEC
|
||||||
FSpMakeFSRef ( spec, ref );
|
FSpMakeFSRef ( spec, ref );
|
||||||
FSGetCatalogInfo( ref, whichInfo, catalogInfo,
|
FSGetCatalogInfo( ref, whichInfo, catalogInfo,
|
||||||
outForkName, spec, ref );
|
outForkName, spec, ref );
|
||||||
FSPathMakeRef( path, ref, isDirectory );
|
#endif
|
||||||
|
|
||||||
],
|
],
|
||||||
[AC_MSG_RESULT([ok])
|
[AC_MSG_RESULT([ok])
|
||||||
CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
|
CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
|
||||||
|
@ -465,7 +468,9 @@ elif test x$with_old_mac_fonts = xyes -a x$with_ats != x ; then
|
||||||
|
|
||||||
|
|
||||||
ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
|
ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
|
||||||
|
#if HAVE_FSSPEC
|
||||||
ATSFontGetFileSpecification( 0, pathSpec );
|
ATSFontGetFileSpecification( 0, pathSpec );
|
||||||
|
#endif
|
||||||
|
|
||||||
],
|
],
|
||||||
[AC_MSG_RESULT([ok])
|
[AC_MSG_RESULT([ok])
|
||||||
|
|
Loading…
Reference in New Issue