* 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
diff --git a/ChangeLog b/ChangeLog
index b603902..278981c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/builds/unix/configure b/builds/unix/configure
index 1b70857..8224512 100644
--- a/builds/unix/configure
+++ b/builds/unix/configure
@@ -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
diff --git a/builds/unix/configure.ac b/builds/unix/configure.ac
index 5498e57..52bc4c0 100644
--- a/builds/unix/configure.ac
+++ b/builds/unix/configure.ac
@@ -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
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index 7f05f3b..87c277a 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -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;