* builds/unix/configure.ac: Fix compiler flags for

`--with-old-mac-fonts'.
* builds/unix/configure: Regenerated.

* src/base/ftmac.c: s/TARGET_API_MAC_CARBON/!TARGET_API_MAC_OS8/.
(FT_New_Face_From_Resource): New function.
(FT_New_Face): Use FT_New_Face_From_Resource.
(FT_New_Face_From_FSSpec): Use FT_New_Face_From_Resource.
[__MWERKS__]: Don't include FSp_fopen.h.
This commit is contained in:
Werner Lemberg 2004-02-28 19:12:01 +00:00
parent a5e9f1d994
commit 62d8db05fa
4 changed files with 73 additions and 60 deletions

View File

@ -1,3 +1,15 @@
2004-02-27 Garrick Meeker <garrick@digitalanarchy.com>
* builds/unix/configure.ac: Fix compiler flags for
`--with-old-mac-fonts'.
* builds/unix/configure: Regenerated.
* src/base/ftmac.c: s/TARGET_API_MAC_CARBON/!TARGET_API_MAC_OS8/.
(FT_New_Face_From_Resource): New function.
(FT_New_Face): Use FT_New_Face_From_Resource.
(FT_New_Face_From_FSSpec): Use FT_New_Face_From_Resource.
[__MWERKS__]: Don't include FSp_fopen.h.
2004-02-26 Werner Lemberg <wl@gnu.org>
* src/pshinter/pshglob.c (psh_globals_new): Fix value of

View File

@ -5232,7 +5232,7 @@ if test "${with_old_mac_fonts+set}" = set; then
fi;
if test x$with_old_mac_fonts = xyes; then
CFLAGS="$CFLAGS -DTARGET_API_MAC_CARBON"
XX_ANSICFLAGS="-pedantic"
LDFLAGS="$LDFLAGS -Xlinker -framework -Xlinker CoreServices \
-Xlinker -framework -Xlinker ApplicationServices"
else

View File

@ -131,7 +131,7 @@ AC_ARG_WITH([old-mac-fonts],
AS_HELP_STRING([--with-old-mac-fonts],
[allow Mac resource-based fonts to be used]))
if test x$with_old_mac_fonts = xyes; then
CFLAGS="$CFLAGS -DTARGET_API_MAC_CARBON"
XX_ANSICFLAGS="-pedantic"
LDFLAGS="$LDFLAGS -Xlinker -framework -Xlinker CoreServices \
-Xlinker -framework -Xlinker ApplicationServices"
else

View File

@ -133,7 +133,7 @@
FSSpec* spec )
{
#if TARGET_API_MAC_CARBON && \
#if !TARGET_API_MAC_OS8 && \
!( defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO )
OSErr e;
@ -625,7 +625,7 @@
{
FT_Error error;
#if TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_OS8
FSRef hostContainerRef;
@ -643,7 +643,7 @@
if ( error != noErr )
#endif /* TARGET_API_MAC_CARBON */
#endif /* !TARGET_API_MAC_OS8 */
{
*p_res_ref = FSpOpenResFile( spec, fsRdPerm );
@ -883,7 +883,7 @@
the_font = font;
}
else
++(*face_index);
++(*face_index);
}
}
@ -902,6 +902,48 @@
return FT_Err_Unknown_File_Format;
}
/* Common function to load a new FT_Face from a resource file. */
static FT_Error
FT_New_Face_From_Resource( FT_Library library,
const FSSpec *spec,
FT_Long face_index,
FT_Face *aface )
{
OSType file_type;
short res_ref;
FT_Error error;
if ( OpenFileAsResource( spec, &res_ref ) == FT_Err_Ok )
{
/* LWFN is a (very) specific file format, check for it explicitly */
file_type = get_file_type( spec );
if ( file_type == 'LWFN' )
return FT_New_Face_From_LWFN( library, spec, face_index, aface );
/* Otherwise the file type doesn't matter (there are more than */
/* `FFIL' and `tfil'). Just try opening it as a font suitcase; */
/* if it works, fine. */
error = FT_New_Face_From_Suitcase( library, res_ref,
face_index, aface );
if ( error == 0 )
return error;
/* else forget about the resource fork and fall through to */
/* data fork formats */
CloseResFile( res_ref );
}
/* let it fall through to normal loader (.ttf, .otf, etc.); */
/* we signal this by returning no error and no FT_Face */
*aface = NULL;
return 0;
}
/*************************************************************************/
/* */
@ -922,9 +964,7 @@
{
FT_Open_Args args;
FSSpec spec;
OSType file_type;
short res_ref;
FT_Error result;
FT_Error error;
/* test for valid `library' and `aface' delayed to FT_Open_Face() */
@ -934,28 +974,9 @@
if ( file_spec_from_path( pathname, &spec ) )
return FT_Err_Invalid_Argument;
if ( OpenFileAsResource( &spec, &res_ref ) == FT_Err_Ok )
{
/* LWFN is a (very) specific file format, check for it explicitly */
file_type = get_file_type( &spec );
if ( file_type == 'LWFN' )
return FT_New_Face_From_LWFN( library, &spec, face_index, aface );
/* Otherwise the file type doesn't matter (there are more than */
/* `FFIL' and `tfil') -- just try opening it as a font suitcase; */
/* if it works, fine. */
result = FT_New_Face_From_Suitcase( library, res_ref,
face_index, aface );
if ( result == 0 )
return result;
/* else forget about the resource fork and fall through to */
/* data fork formats */
CloseResFile( res_ref );
}
error = FT_New_Face_From_Resource( library, &spec, face_index, aface );
if ( error != 0 || *aface != NULL )
return error;
/* let it fall through to normal loader (.ttf, .otf, etc.) */
args.flags = FT_OPEN_PATHNAME;
@ -974,14 +995,12 @@
/* accepts an FSSpec instead of a path. */
/* */
FT_EXPORT_DEF( FT_Error )
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec *spec,
FT_Long face_index,
FT_Face *aface )
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec *spec,
FT_Long face_index,
FT_Face *aface )
{
FT_Open_Args args;
OSType file_type;
short res_ref;
FT_Error error;
FT_Stream stream;
FILE* file;
@ -992,35 +1011,17 @@
if ( !spec )
return FT_Err_Invalid_Argument;
if ( OpenFileAsResource( spec, &res_ref ) == FT_Err_Ok )
{
/* LWFN is a (very) specific file format, check for it explicitly */
file_type = get_file_type( spec );
if ( file_type == 'LWFN' )
return FT_New_Face_From_LWFN( library, spec, face_index, aface );
/* Otherwise the file type doesn't matter (there are more than */
/* `FFIL' and `tfil') -- just try opening it as a font suitcase; */
/* if it works, fine. */
error = FT_New_Face_From_Suitcase( library, res_ref,
face_index, aface );
if ( error == 0 )
return error;
/* else forget about the resource fork and fall through to */
/* data fork formats */
CloseResFile( res_ref );
}
error = FT_New_Face_From_Resource( library, spec, face_index, aface );
if ( error != 0 || *aface != NULL )
return error;
/* let it fall through to normal loader (.ttf, .otf, etc.) */
#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
/* Codewarrior's C library can open a FILE from a FSSpec */
#include <FSp_fopen.h>
/* but we must compile with FSp_fopen.c in addition to */
/* runtime libraries. */
memory = library->memory;