* Fix 'deprecated' warnings in building for MacOS

This commit is contained in:
Suzuki, Toshiya (鈴木俊哉) 2006-01-11 09:28:38 +00:00
parent 6cdab92b59
commit f8d16cc540
10 changed files with 1074 additions and 348 deletions

View File

@ -1,3 +1,27 @@
2006-01-11 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Jumbo patch to fix "deprecated" warning to cross-build for
Tiger on Intel, the issue is reported by Sean McBride
<sean@rogue-research.com> on 2005-08-24.
* src/base/ftmac.c: Heavy change to build without deprecated
Carbon functions on Tiger.
* builds/unix/configure.ac: Add options and autochecks for
Carbon functions availabilities, for MacOS X.
* builds/mac/ascii2mpw.py: Add convertor for character "\305".
* builds/mac/FreeType.m68k_{far|cfm}.make.txt: Add conditional
macros to avoid unavailable functions. And ftmac.c must be
compiled without "-strict ansi", because it disables cpp macro
to use ToolBox system call.
* builds/mac/FreeType.ppc_{classic|carbon}.make.txt: Add
conditional macros to avoid unavailable functions.
* builds/mac/README: Detailed notes on function availabilities.
* docs/CHANGES: Notes about (possible) incompatibilities.
2006-01-08 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.

View File

@ -15,7 +15,13 @@ Includes = \xB6
Sym-68K = -sym off
COptions = {Includes} {Sym-68K} -model cfmseg
COptions = \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
{Includes} {Sym-68K} -model cfmseg
### Source Files ###
@ -119,6 +125,9 @@ LibFiles-68K =
### Build Rules ###
"{ObjDir}ftmac.c.o" \xC4\xC4 :src:base:ftmac.c
{C} :src:base:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
FreeType.m68k_cfm \xC4\xC4 FreeType.m68k_cfm.o
FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
@ -142,7 +151,7 @@ FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
"{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}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

View File

@ -8,14 +8,19 @@ MAKEFILE = FreeType.m68k_far.make
ObjDir = :objs:
Includes = \xB6
-ansi strict \xB6
-includes unix \xB6
-i :include: \xB6
-i :src:
Sym-68K = -sym off
COptions = {Includes} {Sym-68K} -model far
COptions = \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
{Includes} {Sym-68K} -model far
### Source Files ###
@ -114,10 +119,14 @@ LibFiles-68K =
### Default Rules ###
.c.o \xC4 .c {\xA5MondoBuild\xA5}
{C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions}
{C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} \xB6
-ansi strict
### Build Rules ###
"{ObjDir}ftmac.c.o" \xC4\xC4 :src:base:ftmac.c
{C} :src:base:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
FreeType.m68k_far \xC4\xC4 FreeType.m68k_far.o
FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
@ -141,7 +150,7 @@ FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
"{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}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

View File

@ -15,7 +15,13 @@ Includes = \xB6
Sym-PPC = -sym off
PPCCOptions = {Includes} {Sym-PPC} -d TARGET_API_MAC_CARBON=1
PPCCOptions = \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=1 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=1 \xB6
-d HAVE_ATS=0 \xB6
{Includes} {Sym-PPC} -d TARGET_API_MAC_CARBON=1
### Source Files ###

View File

@ -15,7 +15,13 @@ Includes = \xB6
Sym-PPC = -sym off
PPCCOptions = {Includes} {Sym-PPC}
PPCCOptions = \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
{Includes} {Sym-PPC}
### Source Files ###

View File

@ -18,6 +18,9 @@ Mac OS X, build as the system is UNIX.
However, Mac OS X is most useful to manipulate files in
vanilla FreeType to fit classic MacOS.
The information about MacOS specific API is written in
appendix of this document.
2. Requirement
--------------
@ -205,8 +208,191 @@ environment by Metrowerks. GCC for MPW and Symantec
to MPW. To update classic MacOS support easily,
building by Jam is expected on MPW.
APPENDIX I
----------
A-1. Framework dependencies
---------------------------
src/base/ftmac.c adds two Mac-specific features to
FreeType. These features are based on MacOS libraries.
* accessing resource-fork font
The fonts for classic MacOS store their graphical data
in resource forks which cannot be accessed via ANSI C
functions. FreeType2 provides functions to handle such
resource fork fonts, they are based on File Manager
framework of MacOS. In addition, HFS and HFS+ file
system driver of Linux is supported. Following
functions are for this purpose.
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
FT_New_Face_From_FSRef()
* resolving font name to font file
The font menu of MacOS application prefers font name
written in FOND resource than sfnt resoure. FreeType2
provides functions to find font file by name in MacOS
application, they are based on QuickDraw Font Manager
and Apple Type Service framework of MacOS.
FT_GetFile_From_Mac_Name()
FT_GetFile_From_Mac_ATS_Name()
Working functions for each MacOS are summarized as
following.
upto MacOS 6:
not tested (you have to obtain MPW 2.x)
MacOS 7.x, 8.x, 9.x (without CarbonLib):
FT_GetFile_From_Mac_Name()
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
MacOS 9.x (with CarbonLib):
FT_GetFile_From_Mac_Name()
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
FT_New_Face_From_FSRef()
Mac OS X upto 10.4.x:
FT_GetFile_From_Mac_Name() deprecated
FT_New_Face_From_FSSpec() deprecated
FT_GetFile_From_Mac_ATS_Name() deprecated?
FT_New_Face_From_FSRef()
A-2. Deprecated Functions
-------------------------
A-2-1. FileManager
------------------
For convenience to write MacOS application, ftmac.c
provides functions to specify a file by FSSpec and FSRef,
because the file identification pathname had ever been
unrecommended method in MacOS programming.
Toward to MacOS X 10.4 & 5, Carbon functions using FSSpec
datatype is noticed as deprecated, and recommended to
migrate to FSRef datatype. The big differences of FSRef
against FSSpec are explained in Apple TechNotes 2078.
http://developer.apple.com/technotes/tn2002/tn2078.html
- filename length: the max length of file
name of FSRef is 255 chars (it is limit of HFS+),
that of FSSpec is 31 chars (it is limit of HFS).
- filename encoding: FSSpec is localized by
legacy encoding for each language system,
FSRef is Unicode enabled.
A-2-2. FontManager
------------------
Following functions receive QuickDraw fontname:
FT_GetFile_From_Mac_Name()
QuickDraw is deprecated and replaced by Quartz
since Mac OS X 10.4. They are still kept for
backward compatibility. By undefinition of
HAVE_QUICKDRAW in building, you can change these
functions to return FT_Err_Unimplemented always.
Replacement functions are added for migration.
FT_GetFile_From_Mac_ATS_Name()
They are usable on Mac OS X only. On older systems,
these functions return FT_Err_Unimplemented always.
The detailed incompatibilities and possibility
of FontManager emulation without QuickDraw is
explained in
http://www.gyve.org/~mpsuzuki/ats_benchmark.html
A-3. Framework Availabilities
-----------------------------
The framework of MacOS are often revised, especially
when new format of binary executable is introduced.
Following table is the minimum version of frameworks
to use functions used in FreeType2. The table is
extracted from MPW header files for assembly language.
*** NOTE ***
The conditional definition of available data type
in MPW compiler is insufficient. You can compile
program using FSRef data type for older systems
(MacOS 7, 8) that don't know FSRef data type.
+-------------------+-----------------------------+
CPU | mc680x0 | PowerPC |
+---------+---------+---------+---------+---------+
Binary Executable Format | Classic | 68K-CFM | CFM | CFM | Mach-O |
+---------+---------+---------+---------+---------+
Framework API | Toolbox | Toolbox | Toolbox | Carbon | Carbon |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| ?(*) |Interface|Interface|CarbonLib|Mac OS X |
| |Lib |Lib | | |
* Files.h +---------+---------+---------+---------+---------+
PBGetFCBInfoSync() | o | 7.1- | 7.1- | 1.0- | o |
FSMakeFSSpec() | o | 7.1- | 7.1- | 1.0- | o |
FSGetForkCBInfo() | o | (**) | 9.0- | 1.0- | o |
FSpMakeFSRef() | o | (**) | 9.0- | 1.0- | o |
FSGetCatalogInfo() | o | (**) | 9.0- | 1.0- | -10.3 |
FSPathMakeRef() | x | x | x | 1.1- | -10.3 |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| ?(*) |Font |Font |CarbonLib|Mac OS X |
| |Manager |Manager | | |
* Fonts.h +---------+---------+---------+---------+---------+
FMCreateFontFamilyIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMDisposeFontFamilyIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMGetNextFontFamily() | x | x | 9.0- | 1.0- | -10.3 |
FMGetFontFamilyName() | x | x | 9.0- | 1.0- | -10.3 |
FMCreateFontFamilyInstanceIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMDisposeFontFamilyInstanceIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMGetNextFontFamilyInstance() | x | x | 9.0- | 1.0- | -10.3 |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| - | - | - |CarbonLib|Mac OS X |
* ATSFont.h (***) +---------+---------+---------+---------+---------+
ATSFontFindFromName() | x | x | x | x | o |
ATSFontGetFileSpecification() | x | x | x | x | o |
+---------+---------+---------+---------+---------+
(*)
In the "Classic": the original binary executable
format, these framework functions are directly
transformed to MacOS system call. Therefore, the
exact availabilitly should be checked by running
system.
(**)
InterfaceLib is bundled to MacOS and its version
is usually equal to MacOS. There's no separate
update for InterfaceLib. It is supposed that
there's no InterfaceLib 9.x for m68k platforms.
In fact, these functions are FSRef dependent.
(***)
ATSUI framework is available on ATSUnicode 8.5 on
ppc Toolbox CFM, CarbonLib 1.0 too. But its base:
ATS font manager is not published in these versions.
------------------------------------------------------------
Last update: 2005/10/28, by suzuki toshiya
Last update: 2006/01/10, by suzuki toshiya
Currently maintained by
suzuki toshiya, <mpsuzuki@hiroshima-u.ac.jp>

View File

@ -7,6 +7,7 @@ if len( sys.argv ) == 1 :
mpw_line = string.replace(asc_line, "\\xA5", "\245")
mpw_line = string.replace(mpw_line, "\\xB6", "\266")
mpw_line = string.replace(mpw_line, "\\xC4", "\304")
mpw_line = string.replace(mpw_line, "\\xC5", "\305")
mpw_line = string.replace(mpw_line, "\\xFF", "\377")
mpw_line = string.replace(mpw_line, "\n", "\r")
mpw_line = string.replace(mpw_line, "\\n", "\n")
@ -18,5 +19,6 @@ elif sys.argv[1] == "-r" :
asc_line = string.replace(asc_line, "\245", "\\xA5")
asc_line = string.replace(asc_line, "\266", "\\xB6")
asc_line = string.replace(asc_line, "\304", "\\xC4")
asc_line = string.replace(asc_line, "\305", "\\xC5")
asc_line = string.replace(asc_line, "\377", "\\xFF")
sys.stdout.write(asc_line)

View File

@ -147,6 +147,215 @@ else
fi
# Whether to use FileManager which is deprecated since Mac OS X 10.4
AC_ARG_WITH([fsspec],
AS_HELP_STRING([--with-fsspec],
[use obsolete FSSpec API of MacOS, if available (default=yes)]))
if test x$with_fsspec = xno; then
CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
elif test x$with_old_mac_fonts = xyes; then
AC_MSG_CHECKING([FSSpec-based FileManager])
AC_TRY_LINK([
#if defined(__GNUC__) && defined(__APPLE_CC__)
# include <Carbon/Carbon.h>
# include <ApplicationServices/ApplicationServices.h>
#else
# include <ConditionalMacros.h>
# include <Files.h>
#endif
], [
FCBPBPtr paramBlock;
short vRefNum;
long dirID;
ConstStr255Param fileName;
FSSpec* spec;
/* FSSpec functions: deprecated sicne Mac OS X 10.4 */
PBGetFCBInfoSync( paramBlock );
FSMakeFSSpec( vRefNum, dirID, fileName, spec );
], [
AC_MSG_RESULT([ok])
CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"
], [
AC_MSG_RESULT([not found])
CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
])
fi
# Whether to use FileManager in Carbon since MacOS 9.x
AC_ARG_WITH([fsref],
AS_HELP_STRING([--with-fsref],
[use Carbon FSRef API of MacOS, if available (default=yes)]))
if test x$with_fsref = xno; then
AC_MSG_WARN([
*** WARNING
FreeType2 built without FSRef API cannot load
data-fork fonts on MacOS, except of XXX.dfont.
])
CFLAGS="$CFLAGS -DHAVE_FSREF=0"
elif test x$with_old_mac_fonts = xyes; then
AC_MSG_CHECKING([FSRef-based FileManager])
AC_TRY_LINK([
#if defined(__GNUC__) && defined(__APPLE_CC__)
# include <Carbon/Carbon.h>
# include <ApplicationServices/ApplicationServices.h>
#else
# include <ConditionalMacros.h>
# include <Files.h>
#endif
], [
FCBPBPtr paramBlock;
short vRefNum;
long dirID;
ConstStr255Param fileName;
FSSpec* spec;
Boolean* isDirectory;
UInt8* path;
SInt16 desiredRefNum;
SInt16* iterator;
SInt16* actualRefNum;
HFSUniStr255* outForkName;
FSVolumeRefNum volume;
FSCatalogInfoBitmap whichInfo;
FSCatalogInfo* catalogInfo;
FSForkInfo* forkInfo;
FSRef* ref;
/* FSRef functions: no need to check? */
FSGetForkCBInfo( desiredRefNum, volume, iterator,
actualRefNum, forkInfo, ref,
outForkName );
FSpMakeFSRef ( spec, ref );
FSGetCatalogInfo( ref, whichInfo, catalogInfo,
outForkName, spec, ref );
FSPathMakeRef( path, ref, isDirectory );
], [
AC_MSG_RESULT([ok])
CFLAGS="$CFLAGS -DHAVE_FSREF=1"
], [
AC_MSG_RESULT([not found])
CFLAGS="$CFLAGS -DHAVE_FSREF=0"
])
fi
# Whether to use QuickDraw API in ToolBox which is deprecated since Mac OS X 10.4
AC_ARG_WITH([quickdraw-toolbox],
AS_HELP_STRING([--with-quickdraw-toolbox],
[use MacOS QuickDraw in ToolBox, if available (default=yes)]))
if test x$with_quickdraw_toolbox = xno; then
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
elif test x$with_old_mac_fonts = xyes; then
AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
AC_TRY_LINK([
#if defined(__GNUC__) && defined(__APPLE_CC__)
# include <Carbon/Carbon.h>
# include <ApplicationServices/ApplicationServices.h>
#else
# include <ConditionalMacros.h>
# include <Fonts.h>
#endif
], [
Str255 familyName;
SInt16 familyID = 0;
FMInput* fmIn = NULL;
FMOutput* fmOut = NULL;
GetFontName( familyID, familyName );
GetFNum( familyName, &familyID );
fmOut = FMSwapFont( fmIn );
], [
AC_MSG_RESULT([ok])
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"
], [
AC_MSG_RESULT([not found])
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
])
fi
# Whether to use QuickDraw API in Carbon which is deprecated since Mac OS X 10.4
AC_ARG_WITH([quickdraw-carbon],
AS_HELP_STRING([--with-quickdraw-carbon],
[use MacOS QuickDraw in Carbon, if available (default=yes)]))
if test x$with_quickdraw_carbon = xno; then
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
elif test x$with_old_mac_fonts = xyes; then
AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
AC_TRY_LINK([
#if defined(__GNUC__) && defined(__APPLE_CC__)
# include <Carbon/Carbon.h>
# include <ApplicationServices/ApplicationServices.h>
#else
# include <ConditionalMacros.h>
# include <Fonts.h>
#endif
], [
FMFontFamilyIterator famIter;
FMFontFamily family;
Str255 famNameStr;
FMFontFamilyInstanceIterator instIter;
FMFontStyle style;
FMFontSize size;
FMFont font;
FSSpec* pathSpec;
FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption, &famIter );
FMGetNextFontFamily( &famIter, &family );
FMGetFontFamilyName( family, famNameStr );
FMCreateFontFamilyInstanceIterator( family, &instIter );
FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
FMDisposeFontFamilyInstanceIterator( &instIter );
FMDisposeFontFamilyIterator( &famIter );
FMGetFontContainer( font, pathSpec );
], [
AC_MSG_RESULT([ok])
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"
], [
AC_MSG_RESULT([not found])
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
])
fi
# Whether to use AppleTypeService since Mac OS X
AC_ARG_WITH([ats],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-ats],
[use AppleTypeService, if available (default=yes)]))
if test x$with_ats = xno; then
CFLAGS="$CFLAGS -DHAVE_ATS=0"
elif test x$with_old_mac_fonts = xyes; then
AC_MSG_CHECKING([AppleTypeService functions])
AC_TRY_LINK([
#include <Carbon/Carbon.h>
], [
FSSpec* pathSpec;
ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
ATSFontGetFileSpecification( 0, pathSpec );
], [
AC_MSG_RESULT([ok])
CFLAGS="$CFLAGS -DHAVE_ATS=1"
], [
AC_MSG_RESULT([not found])
CFLAGS="$CFLAGS -DHAVE_ATS=0"
])
fi
AC_SUBST([LIBZ])
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])

View File

@ -45,6 +45,12 @@ LATEST CHANGES BETWEEN 2.2.0 and 2.1.10
Note that this doesn't affect binary backwards compatibility.
- On MacOS, new APIs are added as replacements for legacy APIs:
`FT_New_Face_From_FSRef' for FT_New_Face_From_FSSpec, and
`FT_GetFile_From_Mac_ATS_Name' for FT_GetFile_From_Mac_Name.
Legacy APIs are still available, if FreeType is built without
disabling them.
III. MISCELLANEOUS
- The documentation for FT_LOAD_TARGET_XXX and FT_RENDER_MODE_XXX
@ -57,6 +63,15 @@ LATEST CHANGES BETWEEN 2.2.0 and 2.1.10
returns the number of available faces via face->num_faces.
Unsupported bitmap faces (fbit, NFNT) are ignored.
- builds/unix/configure is improved for MacOS X. It automatically
checks available functions in Carbon library, and prepare to use
newest functions by default. Also options to specify dependency
of each Carbon APIs (FSSpec, FSRef, old/new QuickDraw, ATS) are
available. By manual disabling of all QuickDraw, FreeType can be
built without "deprecated function" warning on MacOS 10.4.x, but
FT_GetFile_Mac_Name in ftmac.c is changed to dummy function, and
returns unimplemented error. For detail, see builds/mac/README.
- SFNT cmap handling has been improved, mainly to run faster.
- A new face flag `FT_FACE_FLAG_HINTER' has been added which is

File diff suppressed because it is too large Load Diff