ref: 9e2b9900dc5d764c31f8c9ae998a0f94f5c4d3b5
parent: 35ae574a51363f2e5a6d1cda1ff168e1b2bd9fc0
author: Suzuki, Toshiya (鈴木俊哉) <[email protected]>
date: Fri Oct 3 07:52:22 EDT 2008
* Remove duplicated functions from builds/mac/ftmac.c. Now MPW builds builds/mac/ftmac.c as a part of ftbase.c
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2008-10-03 suzuki toshiya <[email protected]>
+
+ * include/freetype/config/ftconfig.h: Define FT_MACINTOSH when
+ SC or MrC compiler of MPW is used. These compilers do not
+ define the macro __APPLE__ by themselves.
+ * builds/unix/ftconfig.in: Ditto.
+ * builds/vms/ftconfig.h: Ditto.
+ * src/base/ftbase.c: Use FT_MACINTOSH instead of __APPLE__,
+ to include ftmac.c when FreeType2 is built by MPW.
+ * src/base/ftobjs.c: Use FT_MACINTOSH instead of __APPLE__,
+ to enable shared functions for ftmac.c when FreeType2 is
+ built by MPW.
+
+ * builds/mac/ftmac.c: Include ftbase.h.
+ (memory_stream_close): Removed.
+ (new_memory_stream): Ditto.
+ (open_face_from_buffer): Removed. Use the implementation in
+ ftobjs.c.
+ (ft_lookup_PS_in_sfnt): Ditto.
+
+ * builds/mac/FreeType.m68k_far.make.txt: Build ftmac.c as an
+ included part of ftbase.c, to share the functions in ftobjs.c.
+ The rule compiling ftmac.c separately is removed and the rule
+ copying ftbase.c from src/base/ftbase.c to builds/mac/ftbase.c
+ is added.
+ * builds/mac/FreeType.m68k_cfm.make.txt: Ditto.
+ * builds/mac/FreeType.ppc_classic.make.txt: Ditto.
+ * builds/mac/FreeType.ppc_carbon.make.txt: Ditto.
+
2008-10-02 Bram Tassyns <[email protected]>
* src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0. This
--- a/builds/mac/FreeType.m68k_cfm.make.txt
+++ b/builds/mac/FreeType.m68k_cfm.make.txt
@@ -31,9 +31,8 @@
### Source Files ###
SrcFiles = \xB6
- :builds:mac:ftmac.c \xB6
:src:autofit:autofit.c \xB6
- :src:base:ftbase.c \xB6
+ :builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
@@ -75,7 +74,6 @@
### Object Files ###
ObjFiles-68K = \xB6
- "{ObjDir}ftmac.c.o" \xB6
"{ObjDir}autofit.c.o" \xB6
"{ObjDir}ftbase.c.o" \xB6
"{ObjDir}ftbbox.c.o" \xB6
@@ -129,9 +127,15 @@
### Build Rules ###
-"{ObjDir}ftmac.c.o" \xC4\xC4 :builds:mac:ftmac.c
- {C} :builds:mac:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+ Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
+ {C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
+ -i :builds:mac: \xB6
+ -i :src:base: \xB6
+ {COptions}
+
FreeType.m68k_cfm \xC4\xC4 FreeType.m68k_cfm.o
FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
@@ -147,7 +151,7 @@
### Required Dependencies ###
"{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
"{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
@@ -155,7 +159,6 @@
"{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
-# "{ObjDir}ftmac.c.o" \xC4 :builds:mac:ftmac.c
"{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
--- a/builds/mac/FreeType.m68k_far.make.txt
+++ b/builds/mac/FreeType.m68k_far.make.txt
@@ -30,9 +30,8 @@
### Source Files ###
SrcFiles = \xB6
- :builds:mac:ftmac.c \xB6
:src:autofit:autofit.c \xB6
- :src:base:ftbase.c \xB6
+ :builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
@@ -83,7 +82,6 @@
"{ObjDir}ftglyph.c.o" \xB6
"{ObjDir}ftgxval.c.o" \xB6
"{ObjDir}ftinit.c.o" \xB6
- "{ObjDir}ftmac.c.o" \xB6
"{ObjDir}ftmm.c.o" \xB6
"{ObjDir}ftotval.c.o" \xB6
"{ObjDir}ftpfr.c.o" \xB6
@@ -128,9 +126,15 @@
### Build Rules ###
-"{ObjDir}ftmac.c.o" \xC4\xC4 :builds:mac:ftmac.c
- {C} :builds:mac:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+ Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
+ {C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
+ -i :builds:mac: \xB6
+ -i :src:base: \xB6
+ {COptions}
+
FreeType.m68k_far \xC4\xC4 FreeType.m68k_far.o
FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
@@ -146,7 +150,7 @@
### Required Dependencies ###
"{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
"{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
@@ -154,7 +158,6 @@
"{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
-# "{ObjDir}ftmac.c.o" \xC4 :src:base:ftmac.c
"{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
--- a/builds/mac/FreeType.ppc_carbon.make.txt
+++ b/builds/mac/FreeType.ppc_carbon.make.txt
@@ -31,9 +31,8 @@
### Source Files ###
SrcFiles = \xB6
- :builds:mac:ftmac.c \xB6
:src:autofit:autofit.c \xB6
- :src:base:ftbase.c \xB6
+ :builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
@@ -84,7 +83,6 @@
"{ObjDir}ftglyph.c.x" \xB6
"{ObjDir}ftgxval.c.x" \xB6
"{ObjDir}ftinit.c.x" \xB6
- "{ObjDir}ftmac.c.x" \xB6
"{ObjDir}ftmm.c.x" \xB6
"{ObjDir}ftotval.c.x" \xB6
"{ObjDir}ftpfr.c.x" \xB6
@@ -129,6 +127,15 @@
### Build Rules ###
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+ Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.x" \xC4\xC4 :builds:mac:ftbase.c
+ {PPCC} :builds:mac:ftbase.c -o {ObjDir}ftbase.c.x \xB6
+ -i :builds:mac: \xB6
+ -i :src:base: \xB6
+ {PPCCOptions}
+
FreeType.ppc_carbon \xC4\xC4 FreeType.ppc_carbon.o
FreeType.ppc_carbon.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
@@ -146,9 +153,8 @@
### Required Dependencies ###
-"{ObjDir}ftmac.c.x" \xC4 :builds:mac:ftmac.c
"{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.x" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
"{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
--- a/builds/mac/FreeType.ppc_classic.make.txt
+++ b/builds/mac/FreeType.ppc_classic.make.txt
@@ -31,9 +31,8 @@
### Source Files ###
SrcFiles = \xB6
- :builds:mac:ftmac.c \xB6
:src:autofit:autofit.c \xB6
- :src:base:ftbase.c \xB6
+ :builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
@@ -84,7 +83,6 @@
"{ObjDir}ftglyph.c.x" \xB6
"{ObjDir}ftgxval.c.x" \xB6
"{ObjDir}ftinit.c.x" \xB6
- "{ObjDir}ftmac.c.x" \xB6
"{ObjDir}ftmm.c.x" \xB6
"{ObjDir}ftotval.c.x" \xB6
"{ObjDir}ftpfr.c.x" \xB6
@@ -129,6 +127,15 @@
### Build Rules ###
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+ Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.x" \xC4\xC4 :builds:mac:ftbase.c
+ {PPCC} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.x" \xB6
+ -i :builds:mac: \xB6
+ -i :src:base: \xB6
+ {PPCCOptions}
+
FreeType.ppc_classic \xC4\xC4 FreeType.ppc_classic.o
FreeType.ppc_classic.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
@@ -146,9 +153,8 @@
### Required Dependencies ###
-"{ObjDir}ftmac.c.x" \xC4 :builds:mac:ftmac.c
"{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.x" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
"{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -65,6 +65,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_STREAM_H
+#include "ftbase.h"
#if defined( __GNUC__ ) || defined( __IBMC__ )
/* This is for Mac OS X. Without redefinition, OS_INLINE */
@@ -1073,109 +1074,6 @@
}
- /* Finalizer for a memory stream; gets called by FT_Done_Face().
- It frees the memory it uses. */
- static void
- memory_stream_close( FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
-
-
- FT_FREE( stream->base );
-
- stream->size = 0;
- stream->base = 0;
- stream->close = 0;
- }
-
-
- /* Create a new memory stream from a buffer and a size. */
- static FT_Error
- new_memory_stream( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Stream_CloseFunc close,
- FT_Stream* astream )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Stream stream;
-
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- if ( !base )
- return FT_Err_Invalid_Argument;
-
- *astream = 0;
- memory = library->memory;
- if ( FT_NEW( stream ) )
- goto Exit;
-
- FT_Stream_OpenMemory( stream, base, size );
-
- stream->close = close;
-
- *astream = stream;
-
- Exit:
- return error;
- }
-
-
- /* Create a new FT_Face given a buffer and a driver name. */
- static FT_Error
- open_face_from_buffer( FT_Library library,
- FT_Byte* base,
- FT_ULong size,
- FT_Long face_index,
- char* driver_name,
- FT_Face* aface )
- {
- FT_Open_Args args;
- FT_Error error;
- FT_Stream stream;
- FT_Memory memory = library->memory;
-
-
- error = new_memory_stream( library,
- base,
- size,
- memory_stream_close,
- &stream );
- if ( error )
- {
- FT_FREE( base );
- return error;
- }
-
- args.flags = FT_OPEN_STREAM;
- args.stream = stream;
- if ( driver_name )
- {
- args.flags = args.flags | FT_OPEN_DRIVER;
- args.driver = FT_Get_Module( library, driver_name );
- }
-
- /* At this point, face_index has served its purpose; */
- /* whoever calls this function has already used it to */
- /* locate the correct font data. We should not propagate */
- /* this index to FT_Open_Face() (unless it is negative). */
-
- if ( face_index > 0 )
- face_index = 0;
-
- error = FT_Open_Face( library, &args, face_index, aface );
- if ( error == FT_Err_Ok )
- (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
- else
- FT_Stream_Free( stream, 0 );
-
- return error;
- }
-
-
/* Create a new FT_Face from a file spec to an LWFN file. */
static FT_Error
FT_New_Face_From_LWFN( FT_Library library,
@@ -1205,59 +1103,6 @@
face_index,
"type1",
aface );
- }
-
-
- /* Look up `TYP1' or `CID ' table from sfnt table directory. */
- /* offset & length must exclude the binary header in tables. */
-
- /* For proper support, PS Type1 and CID-keyed font drivers */
- /* should recognize sfnt-wrapped format. Here, yet TrueType */
- /* font driver is not loaded, we must parse by ourselves. */
- /* We only care the name of table and offset. */
-
- static FT_Error
- ft_lookup_PS_in_sfnt( FT_Byte* sfnt,
- FT_ULong* offset,
- FT_ULong* length,
- FT_Bool* is_sfnt_cid )
- {
- FT_Byte* p = sfnt + 4; /* skip version `typ1' */
- FT_UShort numTables = FT_NEXT_USHORT( p );
-
-
- p += ( 2 * 3 ); /* skip binary search header */
- for ( ; numTables > 0 ; numTables -- )
- {
- FT_ULong tag = FT_NEXT_ULONG( p );
-
-
- p += 4; /* skip checkSum */
- *offset = FT_NEXT_ULONG( p );
- *length = FT_NEXT_ULONG( p );
-
- /* see Adobe TN# 5180 for binary header in CID table */
- if ( tag == FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) )
- {
- *offset += 22;
- *length -= 22;
- *is_sfnt_cid = TRUE;
- return FT_Err_Ok;
- }
-
- /* see Apple "The Type 1 GX Font Format" */
- if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) )
- {
- *offset += 24;
- *length -= 24;
- *is_sfnt_cid = FALSE;
- return FT_Err_Ok;
- }
- }
-
- *offset = 0;
- *length = 0;
- return FT_Err_Invalid_Table;
}
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -156,6 +156,14 @@
#else
#define FT_MACINTOSH 1
#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+ /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
#endif
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -109,6 +109,14 @@
#else
#define FT_MACINTOSH 1
#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+ /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
#endif
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -135,6 +135,14 @@
#else
#define FT_MACINTOSH 1
#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+ /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
#endif
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -32,7 +32,7 @@
#include "fttrigon.c"
#include "ftutil.c"
-#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
#include "ftmac.c"
#endif
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1119,7 +1119,7 @@
/* there's a Mac-specific extended implementation of FT_New_Face() */
/* in src/base/ftmac.c */
-#if !defined( __APPLE__ ) || defined( DARWIN_NO_CARBON )
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
/* documentation is in freetype.h */
@@ -1142,7 +1142,7 @@
return FT_Open_Face( library, &args, face_index, aface );
}
-#endif /* defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) */
+#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
/* documentation is in freetype.h */