Hi all,

Finally I post my jumbo patch to fix "deprecated function
XXX is used" issue on MacOS X 10.4, since 25/Aug/2005.

PROBLEM
-------
You will see the warning when you build for Intel-based Mac,
aslike:

$ env \
  CC="i686-apple-darwin8-gcc-4.0.1 -isysroot /Developer/SDKs/MacOSX10.4u.sdk/" \
    ./configure \
      --with-old-mac-fonts \
      --host=i686-apple-darwin8 \
      --build=powerpc-apple-darwin8.3.0
...

$ make
...

In file included from /Users/mps/redhat/BUILD/freetype2/src/base/ftbase.c:35:
/Users/mps/redhat/BUILD/freetype2/src/base/ftmac.c: In function 
'FT_GetFile_From_Mac_Name':
/Users/mps/redhat/BUILD/freetype2/src/base/ftmac.c:150: warning: 
'FMCreateFontFamilyIterator' is deprecated (declared at 
/Developer/SDKs/MacOSX10.4u.sdk//System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Fonts.h:573)
...


SOLUTION
--------

After applying my jumbo patch to latest freetype2 (on CVS)
and recreate builds/unix/configure, it provides several
switches to use or ignore MacOS specific APIs.

  --with-fsspec           use obsolete FSSpec API of MacOS, if available
                          (default=yes)
  --with-fsref            use Carbon FSRef API of MacOS, if available
                          (default=yes)
  --with-quickdraw-toolbox
                          use MacOS QuickDraw in ToolBox, if available
                          (default=yes)
  --with-quickdraw-carbon use MacOS QuickDraw in Carbon, if available
                          (default=yes)
  --with-ats              use AppleTypeService, if available (default=yes)


By default, these switchs check availability automatically,
but you can set them explicitly.

If FSRef API is available (checked automatically), ftmac.c
uses FSRef API instead of deprecated FSSpec API, at maximum,
so "deprecated" warning about FSSpec won't appear.

On the other hand, even if QuickDraw APIs are deprecated,
the switchs detect them automatically, and use them for
FT_GetFile_From_Mac_Name(). To remove "deprecated" warning,
you have to set "--with-quickdraw-toolbox=no" and
"--with-quickdraw-carbon=no" manually. By disabling QuickDraw,
FT_GetFile_From_Mac_Name() is changed to pseudo function
which returns FT_Err_Unimplemented_Feature always.

Apple recommends to migrate from QuickDraw to ATS, but,
as I've ever reported, compatible function is hard to
implement and will be unbelievably slow. As a quick replacement,
I added FT_GetFile_From_Mac_ATS_Name() that returns FSSpec
(oops, it's obsolete!) for given ATS font name.

About the "abscondence" of font in migration from QuickDraw
to ATS, use my "ftoldmac" tool (see previous post in this
list).

By ftoldmac tool, I checked that the number of loadable
font files and loadable font faces are same with original
FreeType, on MacOS X 10.4.


TODO
----

* Tests on real System6 & 7.

  It seems that new QuickDraw APIs in Carbon (e.g.
  FMCreateFontFamilyIterator() etc) are not available
  on ToolBox library (say, System 7 environment)
  I classify 2 groups of QuickDraw FontManager APIs:
  "quickdraw-toolbox" is old API described in ancient
  "Inside Macintosh: Fonts". "quickdraw-carbon" is new
  API described in Carbon reference.

* On MacOS X, giving "--with-fsref=no" disables FreeType2
  to load most data-fork fonts

FreeType2 uses stdio functions to load font files. On
MacOS, there are several incompatible font access APIs:
FSSpec comes from FileManager, not from POSIX, so its
pathname separator is always ":". stdio in MPW's StdCLib
uses such syntax. But, on MacOS X, stdio comes from POSIX,
its pathname separator is "/". FSRef API has support
to work on both syntax, but FSSpec does not have.

Maybe you wish if there's regression test for all combination
of FSSpec|FSRef and QuickDraw|ATS. MacOS X might be best
platform for such automated regression test. Unfortunately
it's impossible, at present.

* Complete cleaning of FSSpec.

Apple recommends to migrate from FSSpec to FSRef, because
FSSpec cannot handle long file name and UTF-16 encoded
file name. But some Carbon functions are left in FSSpec-
dependent because there's no replacements.

* Unification with POSIX resource fork accessor.

Masatake Yamato wrotes resource fork accessor by POSIX
functions, to use resource-fork fonts on real UNIX system
that can access resource fork. To reduce the cost of
maintainance, unification is expected.

Regards,
mpsuzuki

Attachment: freetype2_ftmac_jumbo.patch.bz2
Description: Binary data

_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to