Commit in reactos/lib/freetype on MAIN
ChangeLog+2239-1331.5 -> 1.6
Jamfile+5-31.5 -> 1.6
README+4-41.5 -> 1.6
README.ROS+2-21.4 -> 1.5
configure+8-41.2 -> 1.3
freetype.def+68-401.5 -> 1.6
Jamfile.in-1351.3 removed
install-21.1 removed
builds/freetype.mk+5-31.4 -> 1.5
      /toplevel.mk+11.4 -> 1.5
builds/atari/ATARI.H+161.2 -> 1.3
            /FNames.SIC+371.2 -> 1.3
            /FREETYPE.PRJ+331.2 -> 1.3
            /README.TXT+511.2 -> 1.3
builds/unix/.cvsignore+11.3 -> 1.4
           /aclocal.m4+5064-28071.5 -> 1.6
           /config.guess+117-671.4 -> 1.5
           /config.sub+102-261.4 -> 1.5
           /configure+16258-38531.5 -> 1.6
           /configure.ac+114-641.5 -> 1.6
           /detect.mk+4-41.2 -> 1.3
           /freetype-config.in+58-281.3 -> 1.4
           /freetype2.m4+151-1161.3 -> 1.4
           /ft-munmap.m4+17-251.3 -> 1.4
           /ft2unix.h+12-111.3 -> 1.4
           /ftconfig.in+93-201.3 -> 1.4
           /ftsystem.c+71-81.1 -> 1.2
           /install-sh+181-1341.4 -> 1.5
           /install.mk+21.4 -> 1.5
           /ltmain.sh+2198-8511.5 -> 1.6
           /mkinstalldirs+54-151.4 -> 1.5
           /unix-cc.in+4-11.5 -> 1.6
           /unix-def.in+1-31.3 -> 1.4
           /unix.mk+8-41.1 -> 1.2
builds/vms/ftconfig.h+124-311.3 -> 1.4
builds/win32/visualc/freetype.sln+33added 1.1
                    /freetype.vcproj+1717added 1.1
                    /freetype.dsp+10-61.2 -> 1.3
                    /index.html+25-141.4 -> 1.5
devel/ft2build.h+3-31.4 -> 1.5
     /ftoption.h+44-71.4 -> 1.5
docs/raster.txt+6241.2 -> 1.3
    /CHANGES+891-6101.5 -> 1.6
    /CUSTOMIZE+5-51.4 -> 1.5
    /INSTALL+2-11.3 -> 1.4
    /INSTALL.GNU+2-11.2 -> 1.3
    /INSTALL.UNX+2-11.2 -> 1.3
    /VERSION.DLL+16-111.5 -> 1.6
    /license.txt+17-141.5 -> 1.6
    /release+16-21.3 -> 1.4
include/freetype/ftlzw.h+99added 1.1
                /ftmodapi.h+3191.2 -> 1.3
                /freetype.h+84-461.5 -> 1.6
                /ftbbox.h+7-11.3 -> 1.4
                /ftbdf.h+61.5 -> 1.6
                /ftcache.h+455-451.4 -> 1.5
                /fterrdef.h+3-11.1 -> 1.2
                /ftglyph.h+9-31.5 -> 1.6
                /ftgzip.h+71.5 -> 1.6
                /ftimage.h+4-41.4 -> 1.5
                /ftincrem.h+61.5 -> 1.6
                /ftlist.h+7-11.3 -> 1.4
                /ftmac.h+39-51.1 -> 1.2
                /ftmm.h-151.3 -> 1.4
                /ftmoderr.h+16-151.2 -> 1.3
                /ftoutln.h+73-11.4 -> 1.5
                /ftpfr.h+61.4 -> 1.5
                /ftsizes.h+10-21.3 -> 1.4
                /ftsnames.h+7-11.3 -> 1.4
                /ftstroke.h+582-561.3 -> 1.4
                /ftsynth.h+7-11.3 -> 1.4
                /fttrigon.h+61.4 -> 1.5
                /ftwinfnt.h+129-11.4 -> 1.5
                /ftxf86.h+9-21.3 -> 1.4
                /t1tables.h+10-21.4 -> 1.5
                /ttnameid.h+11.5 -> 1.6
                /tttables.h+27-51.5 -> 1.6
                /tttags.h+61.3 -> 1.4
                /ttunpat.h+61.3 -> 1.4
                /ftmodule.h-3141.2 removed
include/freetype/cache/ftcmru.h+2461.2 -> 1.3
                      /ftccache.h+150-1821.3 -> 1.4
                      /ftcglyph.h+198-961.4 -> 1.5
                      /ftcimage.h+48-2571.4 -> 1.5
                      /ftcmanag.h+34-1031.3 -> 1.4
                      /ftcsbits.h+50-2291.3 -> 1.4
                      /ftlru.h-2021.1 removed
include/freetype/config/ftconfig.h+35-171.4 -> 1.5
                       /ftheader.h+44-171.5 -> 1.6
                       /ftoption.h+44-101.7 -> 1.8
                       /ftstdlib.h+15-121.4 -> 1.5
include/freetype/internal/ftrfork.h+184added 1.1
                         /ftserv.h+2601.2 -> 1.3
                         /ftcalc.h+36-21.3 -> 1.4
                         /ftdebug.h+49-11.1 -> 1.2
                         /ftdriver.h+9-51.4 -> 1.5
                         /ftgloadr.h+4-41.4 -> 1.5
                         /ftmemory.h+7-11.4 -> 1.5
                         /ftobjs.h+63-521.5 -> 1.6
                         /ftstream.h+12-11.1 -> 1.2
                         /fttrace.h+9-81.1 -> 1.2
                         /internal.h+3-111.3 -> 1.4
                         /psaux.h+9-61.4 -> 1.5
                         /sfnt.h+90-871.5 -> 1.6
                         /t1types.h+11-191.4 -> 1.5
                         /tttypes.h+15-3151.4 -> 1.5
                         /bdftypes.h-581.2 removed
                         /cfftypes.h-2561.2 removed
                         /fnttypes.h-1041.3 removed
                         /ftcore.h-1851.1 removed
                         /ftexcept.h-821.1 removed
                         /fthash.h-5021.1 removed
                         /ftobject.h-5331.1 removed
                         /pfr.h-601.2 removed
                         /psnames.h-2411.1 removed
                         /t42types.h-551.1 removed
include/freetype/internal/services/svbdf.h+571.2 -> 1.3
                                  /svgldict.h+601.2 -> 1.3
                                  /svmm.h+681.2 -> 1.3
                                  /svpfr.h+651.2 -> 1.3
                                  /svpostnm.h+581.2 -> 1.3
                                  /svpscmap.h+1131.2 -> 1.3
                                  /svpsinfo.h+551.2 -> 1.3
                                  /svsfnt.h+691.2 -> 1.3
                                  /svttcmap.h+771.2 -> 1.3
                                  /svwinfnt.h+501.2 -> 1.3
                                  /svxf86nm.h+551.2 -> 1.3
src/autofit/Jamfile+181.2 -> 1.3
           /afangles.c+2141.2 -> 1.3
           /afdummy.c+35added 1.1
           /afdummy.h+18added 1.1
           /afglobal.c+2361.2 -> 1.3
           /afglobal.h+411.2 -> 1.3
           /afhints.c+9861.2 -> 1.3
           /afhints.h+2461.2 -> 1.3
           /aflatin.c+17891.2 -> 1.3
           /aflatin.h+1681.2 -> 1.3
           /afloader.c+4411.2 -> 1.3
           /afloader.h+501.2 -> 1.3
           /afmodule.c+701.2 -> 1.3
           /afmodule.h+161.2 -> 1.3
           /aftypes.h+2681.2 -> 1.3
           /autofit.c+91.2 -> 1.3
src/autohint/ahglobal.c+3-31.5 -> 1.6
            /ahglyph.c+9-91.5 -> 1.6
            /ahhint.c+59-511.5 -> 1.6
            /ahtypes.h+3-21.3 -> 1.4
src/base/ftrfork.c+717added 1.1
        /Jamfile+3-41.3 -> 1.4
        /descrip.mms+2-21.3 -> 1.4
        /ftbase.c+2-11.2 -> 1.3
        /ftbdf.c+14-361.5 -> 1.6
        /ftcalc.c+83-201.4 -> 1.5
        /ftdbgmem.c+3-31.5 -> 1.6
        /ftdebug.c+56-111.1 -> 1.2
        /ftgloadr.c+13-121.3 -> 1.4
        /ftglyph.c+13-121.5 -> 1.6
        /ftmac.c+315-1481.2 -> 1.3
        /ftmm.c+47-421.3 -> 1.4
        /ftobjs.c+356-3151.5 -> 1.6
        /ftoutln.c+144-71.3 -> 1.4
        /ftpfr.c+49-341.4 -> 1.5
        /ftstream.c+4-41.1 -> 1.2
        /ftstroke.c+260-211.3 -> 1.4
        /ftsynth.c+3-21.4 -> 1.5
        /fttrigon.c+3-21.5 -> 1.6
        /fttype1.c+18-351.3 -> 1.4
        /ftwinfnt.c+8-161.4 -> 1.5
        /ftxf86.c+4-471.4 -> 1.5
        /rules.mk+15-141.3 -> 1.4
src/bdf/bdfdrivr.c+202-771.5 -> 1.6
       /bdfdrivr.h+1-11.4 -> 1.5
       /bdflib.c+10-101.4 -> 1.5
src/cache/ftcbasic.c+4251.2 -> 1.3
         /ftccback.h+82added 1.1
         /ftcmru.c+3551.2 -> 1.3
         /Jamfile+10-21.3 -> 1.4
         /descrip.mms+2-31.3 -> 1.4
         /ftcache.c+4-41.3 -> 1.4
         /ftccache.c+321-5261.5 -> 1.6
         /ftccmap.c+118-2911.5 -> 1.6
         /ftcglyph.c+102-391.3 -> 1.4
         /ftcimage.c+52-3061.3 -> 1.4
         /ftcmanag.c+267-3851.3 -> 1.4
         /ftcsbits.c+185-4061.5 -> 1.6
         /rules.mk+7-41.4 -> 1.5
         /ftccache.i-1571.1 removed
         /ftlru.c-3901.3 removed
src/cff/cfftypes.h+2551.2 -> 1.3
       /Jamfile+1-11.3 -> 1.4
       /cff.c+1-11.3 -> 1.4
       /cffcmap.c+25-231.4 -> 1.5
       /cffdrivr.c+121-631.4 -> 1.5
       /cffgload.c+167-851.5 -> 1.6
       /cffload.c+106-561.5 -> 1.6
       /cffload.h+7-71.3 -> 1.4
       /cffobjs.c+241-641.4 -> 1.5
       /cffobjs.h+15-131.3 -> 1.4
       /cffparse.c+2-21.2 -> 1.3
       /cffparse.h+2-21.3 -> 1.4
       /cfftoken.h+2-21.4 -> 1.5
       /rules.mk+11.4 -> 1.5
src/cid/cidgload.c+11-111.5 -> 1.6
       /cidload.c+175-341.4 -> 1.5
       /cidload.h+3-21.4 -> 1.5
       /cidobjs.c+15-201.4 -> 1.5
       /cidparse.c+52-91.3 -> 1.4
       /cidparse.h+10-31.3 -> 1.4
       /cidriver.c+50-51.4 -> 1.5
src/gzip/adler32.c+1-11.5 -> 1.6
        /ftgzip.c+16-161.3 -> 1.4
        /infblock.c+2-11.4 -> 1.5
        /inffixed.h+4-41.3 -> 1.4
        /inftrees.c+5-51.5 -> 1.6
        /inftrees.h+2-21.3 -> 1.4
        /infutil.c+1-11.4 -> 1.5
        /zconf.h+1-11.5 -> 1.6
        /zutil.c+1-11.5 -> 1.6
        /zutil.h+1-11.5 -> 1.6
src/lzw/Jamfile+9added 1.1
       /ftlzw.c+463added 1.1
       /rules.mk+70added 1.1
       /zopen.c+396added 1.1
       /zopen.h+114added 1.1
src/pcf/pcfdrivr.c+78-171.3 -> 1.4
       /pcfread.c+157-711.5 -> 1.6
       /pcfutil.c+5-881.1 -> 1.2
       /pcfutil.h+4-111.1 -> 1.2
src/pfr/pfrdrivr.c+63-321.4 -> 1.5
       /pfrgload.c+3-31.3 -> 1.4
       /pfrload.c+149-891.5 -> 1.6
       /pfrobjs.c+18-591.5 -> 1.6
       /pfrsbit.c+7-61.5 -> 1.6
       /pfrtypes.h+8-41.5 -> 1.6
src/psaux/psauxmod.c+1-11.4 -> 1.5
         /psobjs.c+509-2471.5 -> 1.6
         /psobjs.h+9-11.4 -> 1.5
         /t1cmap.c+13-131.4 -> 1.5
         /t1cmap.h+9-101.3 -> 1.4
         /t1decode.c+7-271.4 -> 1.5
         /t1decode.h+1-21.3 -> 1.4
src/pshinter/Jamfile+1-11.4 -> 1.5
            /pshalgo.c+284-1931.3 -> 1.4
            /pshglob.c+24-211.4 -> 1.5
            /pshrec.c+9-101.4 -> 1.5
            /pshrec.h+1-11.4 -> 1.5
src/psnames/psmodule.c+39-251.4 -> 1.5
src/raster/ftrend1.c+7-71.4 -> 1.5
src/sfnt/Jamfile+2-21.3 -> 1.4
        /rules.mk-11.4 -> 1.5
        /sfdriver.c+82-211.5 -> 1.6
        /sfnt.c+1-21.3 -> 1.4
        /sfobjs.c+11-161.4 -> 1.5
        /ttcmap0.c+127-141.4 -> 1.5
        /ttcmap0.h+8-21.3 -> 1.4
        /ttload.c+23-171.5 -> 1.6
        /ttpost.c+5-51.3 -> 1.4
        /ttsbit.c+23-231.5 -> 1.6
        /ttsbit.h+16-31.3 -> 1.4
        /ttcmap.c-11101.1 removed
        /ttcmap.h-451.1 removed
src/smooth/ftsmooth.c+9-61.4 -> 1.5
src/tools/docmaker/docbeauty.py+1091.2 -> 1.3
                  /content.py+44-61.3 -> 1.4
                  /docmaker.py+5-471.3 -> 1.4
                  /formatter.py+91.3 -> 1.4
                  /sources.py+3-31.4 -> 1.5
                  /utils.py+42-11.3 -> 1.4
src/truetype/ttdriver.c+32-211.5 -> 1.6
            /ttgload.c+171-401.5 -> 1.6
            /ttgload.h+2-21.2 -> 1.3
            /ttinterp.c+140-511.5 -> 1.6
            /ttinterp.h+2-11.3 -> 1.4
            /ttobjs.c+12-111.5 -> 1.6
            /ttobjs.h+3-21.3 -> 1.4
src/type1/t1driver.c+89-651.4 -> 1.5
         /t1gload.c+17-141.5 -> 1.6
         /t1load.c+517-3751.5 -> 1.6
         /t1objs.c+16-191.4 -> 1.5
         /t1parse.c+94-1111.3 -> 1.4
         /t1parse.h+6-61.3 -> 1.4
         /t1tokens.h+3-11.2 -> 1.3
src/type42/t42types.h+541.2 -> 1.3
          /t42drivr.c+88-241.4 -> 1.5
          /t42objs.c+22-241.5 -> 1.6
          /t42objs.h+4-41.3 -> 1.4
          /t42parse.c+480-3251.4 -> 1.5
          /t42parse.h+4-31.4 -> 1.5
src/winfonts/winfnt.c+111-301.5 -> 1.6
            /winfnt.h+69-11.3 -> 1.4
tests/gview.c+2-21.2 -> 1.3
+49967-20588
13 added + 18 removed + 260 modified, total 291 files
Update to FreeType 2.1.8

reactos/lib/freetype
ChangeLog 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ChangeLog	15 Feb 2004 21:45:27 -0000	1.5
+++ ChangeLog	10 May 2004 17:48:21 -0000	1.6
@@ -1,13 +1,2119 @@
+2004-04-21  David Turner    <david@freetype.org>
+
+        * src/cff/cffobjs.c (cff_face_init): fixed a small memory leak
+
+        * src/autofit/afloader.c, src/autofit/afmodule.c, src/base/ftdebug.c:
+        removed compiler warnings
+
+        * src/autofit/aftypes.h, src/lzw/zopen.c, src/pcf/pcfdrivr.c,
+        src/pcf/pcfread.c, src/psaux/psobjs.c, src/type42/t42drivr.c:
+        changed data arrays to "const" to avoid populating the ".data"
+        segment
+
+2004-04-20  Werner Lemberg  <wl@gnu.org>
+
+	* src/psaux/psobjs.c (T1Radix): Renamed to...
+	(ps_radix): This.
+	Update current cursor position.
+
+	* docs/CHANGES: Updated.
+
+2004-04-18  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph),
+	src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to
+	FT_UInt.  From Lex Warners.
+
+2004-04-17  Chisato Yamauchi  <cyamauch@a.phys.nagoya-u.ac.jp>
+
+	* src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change
+	from 2004-03-19.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'.
+
+	* src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with
+	`static.'.
+	Remove unused function `RepadBitmap'.
+	* src/pcf/pcfdrivr.c: Don't include pcfutil.h.
+
+2004-04-16  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/freetype-config.in (usage): Fix and improve usage
+	information.
+
+2004-04-15  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/ftconfig.in, builds/vms/ftconfig.h: Define
+	FT_CHAR_BIT.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Don't apply autohinting if
+	glyph is vertically distorted or mirrored.
+
+	* src/cff/cffgload.c (cff_slot_load): Handle zero `size' properly
+	for embedded bitmaps.
+
+	* docs/CHANGES: Updated.
+
+2004-04-15  bytesoftware  <bytesoftware@btinternet.com>
+
+	* include/freetype/config/ftconfig.h, src/base/ftstream.c
+	(FT_Stream_ReadFields): More fixes using FT_CHAR_BIT.
+
+2004-04-14  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/config/ftconfig.h (FT_CHAR_BIT): New macro.
+
+2004-04-14  Alex Strelnikov  <ptktyrf@mail.ru>
+
+	* src/cache/ftcsbits.c (ftc_snode_load): Initialize `*asize' in case
+	of error.
+
+2004-04-14  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftmac.c [__GNUC__]: Define OS_INLINE.
+	* builds/unix/configure.ac: Don't try to remove `-ansi' compilation
+	switch on the Mac.
+
+	* builds/unix/ltmain.sh: Regenerated with `libtoolize --force
+	--copy' from libtool 1.5.6.
+	* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
+	automake 1.8a.
+	* builds/unix/configure: Regenerated with autoconf 2.59a.
+
+2004-04-13  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/config/ftconfig.h: Use CHAR_BIT to define
+	size of FT_SIZEOF_xxx.
+
+2004-04-12  Chisato Yamauchi  <cyamauch@a.phys.nagoya-u.ac.jp>
+
+	* include/freetype/internal/sfnt.h (TT_Find_SBit_Image_Func,
+	TT_Load_SBit_Metrics_Func): New typedefs.
+	(SFNT_Interface): Add find_sbit_image and load_sbit_metrics.
+
+	* src/sfnt/sfdriver.c (sfnt_interface): Updated.
+	* src/sfnt/ttsbit.h (tt_find_sbit_image, tt_load_sbit_metrics): New
+	declarations.
+	* src/sfnt/ttsbit.c (find_sbit_image): Renamed to...
+	(tt_find_sbit_image): This.
+	Updated all callers.
+	(load_sbit_metrics): Renamed to...
+	(tt_load_sbit_metrics): This.
+	Updated all callers.
+
+2004-04-12  Werner Lemberg  <wl@gnu.org>
+
+	* configure: Accept makepp also.
+
+	* builds/unix/detect.mk: Use proper path to unix-def.mk.
+	* builds/unix/unix-def.in (BUILD_DIR, PLATFORM): Remove.
+	* builds/unix/unix.mk (BUILD_DIR, PLATFORM): Define.
+	Use BUILD_DIR.
+
+	* docs/INSTALL, docs/INSTALL.GNU, docs/INSTALL.UNX: Update
+	documentation on makepp.
+
+2004-04-11  Werner Lemberg  <wl@gnu.org>
+
+	* src/lzw/zopen.c: Don't include sys/param.h and sys/stat.h.
+
+2004-04-10  Werner Lemberg  <wl@gnu.org>
+
+	* src/lzw/ftlzw.c: Include zopen.h dependent on
+	FT_CONFIG_OPTION_USE_LZW.
+
+	* src/base/ftdebug.c: s/index/idx/ to avoid compiler warnings.
+
+2004-04-02  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/ltmain.sh: Regenerated with `libtoolize --force
+	--copy' from libtool 1.5.2.
+	* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
+	automake 1.8a.
+	* builds/unix/configure: Regenerated with autoconf 2.59a.
+
+2004-04-01  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/ft-munmap.m4 (FT_MUNMAP_PARAM): Fix arguments of
+	AC_COMPILE_IFELSE.
+	* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
+	automake 1.8a.
+	* builds/unix/configure: Regenerated with autoconf 2.59a.
+	* builds/unix/config.guess, builds/unix/config.sub: Updated from
+	`config' CVS module at subversions.gnu.org
+	* builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
+	`texinfo' CVS module at subversions.gnu.org.
+	* builds/freetype.mk (refdoc): Updated.
+
+2004-03-31  Werner Lemberg  <wl@gnu.org>
+
+	Handle broken FNT files which don't have a trailing NULL byte
+	in the face name string.
+
+	* src/winfnt/winfnt.h (FNT_FontRec): New member `family_name'.
+	* src/winfnt/winfnt.c (fnt_font_done): Free font->family_name.
+	(FNT_Face_Init): Append a final zero byte to the font face name.
+
+2004-03-30  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/ttload.c (tt_face_load_sfnt_header): Fix change from
+	2004-03-19.
+
+2004-03-27  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/descrip.mms (OBJS): Add ftbbox.obj.
+
+2004-03-26  George Williams  <gww@silcom.com>
+
+	Add vertical phantom points.
+
+	* include/freetype/internal/tttypes.h (TT_LoaderRec): Add
+	`top_bearing', `vadvance', `pp3, and `pp4'.
+
+	* src/autofit/afloader.c (af_loader_load_g): Handle two more points.
+
+	* src/autohint/ahhint.c (ah_hinter_load): Handle two more points.
+	* src/truetype/ttgload.c (Get_VMetrics): New function.
+	(TT_Load_Simple_Glyph, TT_Process_Simple_Glyph): Handle two more
+	points.
+	(load_truetype_glyph): Use Get_VMetrics.
+	Handle two more points.
+	(compute_glyph_metrics): Thanks to vertical phantom points we now
+	can always compute `advance_height' and `top_bearing'.
+	* src/truetype/ttobjs.h (TT_SubglyphRec): Add vertical phantom
+	points.
+
+
+	* src/autohint/ahglyph.c (ah_outline_load): Fix allocation of
+	`news'.
+
+2004-03-21  Werner Lemberg  <wl@gnu.org>
+
+	* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Fix left side bearing.
+
+2004-03-20  Steve Hartwell  <shspamsink@comcast.net>
+
+	* src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Handle a NULL
+	value for `selection' as `select all'.
+
+2004-03-19  Steve Hartwell  <shspamsink@comcast.net>
+
+	* src/sfnt/ttload.c (tt_face_load_sfnt_header): Reject face_index
+	values > 0 if loading non-TTC fonts.
+
+	* src/base/ftmac.c (open_face_from_buffer): Set positive face_index
+	to zero before calling FT_Open_Face.
+
+	* docs/CHANGES: Updated.
+
+2004-03-04  Werner Lemberg  <wl@gnu.org>
+
+	* Jamfile, vms_make.com, builds/win32/visualc/freetype.dsp,
+	builds/win32/visualc/freetype/vcproj, include/freetype/ftmoderr.h:
+	Add LZW module.
+
+	* Jamfile.in: Removed.
+
+	* docs/CHANGES: Updated.
+
+	* include/freetype/internal/ftobjs.h: s/MIN/FT_MIN/, s/MAX/FT_MAX/,
+	s/ABS/FT_ABS/.  Updated all callers.
+
+	* src/type1/t1load.c (parse_dict), src/pcf/pcfdrivr.c
+	(PCF_Face_Init): Use FT_ERROR_BASE.
+
+2004-03-04  Albert Chin  <china@thewrittenword.com>
+
+	Add support for PCF fonts compressed with LZW (extension .pcf.Z,
+	created with `compress').
+
+	* include/freetype/config/ftoption.h, devel/ftoption.h
+	(FT_CONFIG_OPTION_USE_LZW): New macro.
+
+	* include/freetype/ftlzw.h: New file.
+	* include/freetype/config/ftheader.h (FT_LZW_H): New macro for
+	ftlzw.h.
+
+	* src/lzw/*: New files.
+
+	* src/pcf/pcfdrivr.c: Include FT_LZW_H.
+	(PCF_Face_Init): Try LZW also.
+
+	* src/gzip/ftgzip.c: s/0/Gzip_Err_Ok/ where appropriate.
+	Beautify.
+
+2004-03-03  Werner Lemberg  <wl@gnu.org>
+
+	* src/pshinter/pshalgo.c (psh_hint_table_init): Simplify code.
+
+2004-03-02  Werner Lemberg  <wl@gnu.org>
+
+	Add embedded bitmap support to CFF driver.
+
+	* src/cff/cffobjs.h (CFF_SizeRec): New structure.
+
+	* src/cff/cffgload.c (cff_builder_init): Updated.
+	(cff_slot_load): Updated.
+	[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Load sbit.
+
+	* src/cff/cffobjs.c (sbit_size_reset)
+	[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New function.
+	(cff_size_get_globals_funcs, cff_size_done, cff_size_init): Updated.
+	(cff_size_reset): Updated.
+	[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Call sbit_size_reset.
+
+	* src/cff/cffdrivr.c (Load_Glyph): Updated.
+	(cff_driver_class): Use CFF_SizeRec.
+
+	* docs/CHANGES: Updated.
+
+2004-03-01  Werner Lemberg  <wl@gnu.org>
+
+	* src/pshinter/pshglob.c (psh_globals_scale_widths): Don't use
+	FT_RoundFix but FT_PIX_ROUND.
+	(psh_blues_snap_stem): Don't use blue_shift but blue_threshold.
+
+	* src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro.
+	(psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM.
+	(psh_glyph_find_blue_points): New function.  Needed for fonts like
+	p052003l.pfb (URW Palladio L Roman) which have flex curves at the
+	base line within blue zones, but the flex curves aren't covered by
+	hints.
+	(ps_hints_apply): Use psh_glyph_find_blue_points.
+
+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
+	`dim->stdw.count'.
+	Don't assign default values to blue scale and blue shift.
+
+2004-02-25  Werner Lemberg  <wl@gnu.org>
+
+	* docs/CHANGES: Updated.
+
+2004-02-25  Garrick Meeker  <garrick@digitalanarchy.com>
+	    Steve Hartwell  <shspamsink@comcast.net>
+
+	Improve MacOS fond support.  Provide a new API
+	`FT_New_Face_From_FSSpec' similar to `FT_New_Face'.
+
+	* src/base/ftmac.c [__MWERKS__]: Include FSp_fpopen.h.
+	STREAM_FILE [__MWERKS__]: New macro.
+	(ft_FSp_stream_close, ft_FSp_stream_io) [__MWERKS__]: New functions.
+	(file_spec_from_path) [__MWERKS__]: Updated #if statement.
+	(get_file_type, make_lwfn_spec): Use `const' for argument.
+	(is_dfont) [TARGET_API_MAC_CARBON]: Removed.
+	(count_face_sfnt, count_faces): New functions.
+	(parse_fond): Do some range checking.
+	(read_lwfn): Change type of second argument.
+	No longer call FSpOpenResFile.
+	(OpenFileAsResource): New function.
+	(FT_New_Face_From_LWFN): Use `const' for second argument.
+	Use OpenFileAsResource.
+	(FT_New_Face_From_Suitcase): Change type of second argument.
+	No longer call FSpOpenResFile.
+	Loop over all resource indices.
+	(FT_New_Face_From_dfont) [TARGET_API_MAC_CARBON]: Removed.
+	(FT_GetFile_From_Mac_Name): Use `const' for first argument.
+	(ResourceForkSize): Removed.
+	(FT_New_Face): Updated to use new functions.
+	(FT_New_Face_From_FSSpec): New function.
+
+	* include/freetype/ftmac.h: Updated.
+
+2004-02-24  Malcolm Taylor  <mtaylor@clear.net.nz>
+
+	* src/autohint/ahhint.c (ah_hinter_load) <FT_GLYPH_FORMAT_OUTLINE>:
+	Handle case where outline->num_vedges is zero while computing hinted
+	metrics.
+
+2004-02-24  Gordon Childs  <gchilds@quickcut.com.au>
+
+	* src/cff/cffcmap.c (cff_cmap_unicode_init): Provide correct value
+	for `count'.
+
+2004-02-24  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/t1tables.h (PS_PrivateRec): Add
+	`expansion_factor'.
+
+	* src/pshinter/pshglob (psh_blues_scale_zones): Fix computation
+	of blues->no_overshoots -- `blues_scale' is stored with a
+	magnification of 1000, and `scale' returns fractional pixels.
+
+	* src/type1/t1load.c (T1_Open_Face): Initialize `blue_shift',
+	`blue_fuzz', `expansion_factor', and `blue_scale' according to the
+	Type 1 specification.
+
+	* src/type1/t1tokens.h: Handle `ExpansionFactor'.
+
+	* docs/CHANGES: Updated.
+
+2004-02-24  Masatake YAMATO  <jet@gyve.org>
+
+	Provide generic access to MacOS resource forks.
+
+	* src/base/ftrfork.c, include/freetype/internal/ftrfork.h: New
+	files.
+
+	* src/base/ftobjs.c: Include FT_INTERNAL_RFORK_H.
+	(Mac_Read_POST_Resource, Mac_Read_sfnt_Resource): Remove arguments
+	`resource_listoffset' and `resource_data' and adapt code
+	accordingly.  These values are calculated outside of the function
+	now.
+	Add new argument `offsets'.
+	(IsMacResource): Use `FT_Raccess_Get_HeaderInfo' and
+	`FT_Raccess_Get_DataOffsets'.
+	(load_face_in_embedded_rfork): New function.
+	(load_mac_face): Use load_face_in_embedded_rfork.
+	(ft_input_stream_new): Renamed to...
+	(FT_Stream_New): This.  Use FT_BASE_DEF.  Updated all callers.
+	(ft_input_stream_free): Renamed to...
+	(FT_Stream_Free): This.  Use FT_BASE_DEF.  Updated all callers.
+
+	* src/base/ftbase.c: Include ftrfork.c.
+
+	* src/base/rules.mk (BASE_SRC), src/base/Jamfile: Updated.
+
+	* include/freetype/internal/internal.h (FT_INTERNAL_RFORK_H):
+	New macro.
+
+	* include/freetype/internal/fttrace.h: Added `rfork' as a new
+	trace definition.
+
+	* include/freetype/internal/ftstream.h: Declare FT_Stream_New and
+	FT_Stream_Free.
+
+	* include/freetype/config/ftoption.h, devel/ftoption.h
+	(FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK): New option.
+
+	* include/freetype/config/ftstdlib.h (ft_strrchr): New macro.
+
+2004-02-23  Werner Lemberg  <wl@gnu.org>
+
+	* docs/CHANGES: Updated.
+
+	* include/freetype/internal/ftdebug.h: Include FT_FREETYPE_H.
+
+2004-02-23  Masatake YAMATO  <jet@gyve.org>
+
+	Provide a simple API to control FreeType's tracing levels.
+
+	* include/freetype/internal/ftdebug.h (FT_Trace_Get_Count,
+	FT_Trace_Get_Name): New declarations.
+
+	* src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name): New
+	functions.
+
+2004-02-23  David Turner  <david@freetype.org>
+
+	* src/autofit/afhints.c, src/autofit/afhints.h,
+	src/autofit/aflatin.c, src/autofit/afloader.c, src/types.h: Grave
+	bugs have been fixed.  The auto-fitter works, doesn't crash, but
+	still produces unexpected results...
+
+2004-02-21  Werner Lemberg  <wl@gnu.org>
+
+	* src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD): Changed to hold
+	the accepted shift for strong points in fractional pixels (which
+	is a heuristic value).
+	(psh_glyph_find_strong_points): Compute threshold for
+	psh_hint_table_find_strong_points.
+	(psh_hint_table_find_strong_point): Add parameter to pass threshold.
+
+2004-02-20  Werner Lemberg  <wl@gnu.org>
+
+	* src/pshinter/pshrec.c (ps_mask_table_set_bits): Don't call
+	ps_mask_table_alloc but ps_mask_table_last.
+	(ps_hints_t2mask): Use correct position and number for vertical
+	and horizontal hinter mask bits.
+
+	* docs/CHANGES: Updated.
+
+2004-02-19  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftstroke.c (FT_Glyph_StrokeBorder): Fix enum handling.
+	* src/cff/cffdrivr.c (cff_get_cmap_info): Remove compiler warning.
+
+2004-02-18  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/freetype.h: Document FT_LOAD_TARGET_XXX properly.
+
+	* src/base/ftglyph.c (ft_bitmap_glyph_class,
+	ft_outline_glyph_class): Tag with FT_CALLBACK_TABLE_DEF.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render): Handle
+	FT_RENDER_MODE_LIGHT.
+
+2004-02-17  Werner Lemberg  <wl@gnu.org>
+
+	Fix callback functions in cache module.
+
+	* src/cache/ftccback.h: New file for callback declarations.
+
+	* src/cache/ftcbasic.c (ftc_basic_family_compare,
+	ftc_basic_family_init, ftc_basic_family_get_count,
+	ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
+	ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
+	(ftc_basic_image_family_class, ftc_basic_image_cache_class,
+	ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
+	Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
+
+	* src/cache/ftccache.c: Include ftccback.h.
+	(ftc_cache_init, ftc_cache_done): New wrapper functions which use
+	FT_LOCAL_DEF.
+
+	* src/cache/ftccmap.c: Include ftccback.h.
+	(ftc_cmap_cache_class): Use local wrapper functions.
+
+	* src/cache/ftcglyph.c: Include ftccback.h.
+	(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
+	functions which use FT_LOCAL_DEF.
+
+	* src/cache/ftcimage.c: Include ftccback.h.
+	(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
+	functions which use FT_LOCAL_DEF.
+
+	* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
+	Use FT_CALLBACK_TABLE_DEF.
+
+	* src/cache;/ftcsbits.c: Include ftccback.h.
+	(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
+	ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
+
+	* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
+
+2004-02-17  Masatake YAMATO  <jet@gyve.org>
+
+	* include/freetype/ftmac.h (FT_GetFile_From_Mac_Name): Fix a typo
+	(FT_EXPORT_DEF -> FT_EXPORT).
+
+	* include/freetype/ftxf86.h (FT_Get_X11_Font_Format): Ditto.
+
+2004-02-15  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftobjs.c (FT_Set_Char_Size): Fix typo.
+
+2004-02-14  Masatake YAMATO  <jet@gyve.org>
+
+	* builds/unix/ftsystem.c: Include errno.h.
+	(ft_close_stream): Renamed to...
+	(ft_close_stream_by_munmap): This.
+	(ft_close_stream_by_free): New function.
+	(FT_Stream_Open): Use fallback method if mmap fails.
+	Use proper function for closing the stream.
+
+2004-02-14  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1load.c (parse_dict): Initialize `start_binary'.
+
+2004-02-13  Robert Etheridge  <roberte@stcc.cc.tx.us>
+
+	* src/type42/t42objs.c (T42_Face_Init), src/type1/t1objs.c
+	(T1_Face_Init), src/cid/cidobjs.c (cid_face_init): Fix computation
+	of underline_position and underline_thickness.
+
+2004-02-12  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftobjs.c (FT_Set_Char_Size): Return immediately if
+	ppem values don't change.  Suggested by Graham Asher.
+
+2004-02-11  Werner Lemberg  <wl@gnu.org>
+
+	* src/cid/cidload.c (cid_face_open): Always allocate
+	face->cid_stream so that we can deallocate it safely.
+
+2004-02-10  Werner Lemberg  <wl@gnu.org>
+
+	Make the PS parser more tolerant w.r.t. non-standard font data.  In
+	general, an error is only reported in case of a syntax error; a
+	wrong type is now simply ignored (if possible).  To be independent
+	of the order of various MM-specific keywords, the parse_shared_dict
+	routine has been removed -- the PS parser is now capable to skip
+	this data.  It no longer fails on parsing e.g.
+
+	  dup /WeightVector exch def
+
+	Since the token following /WeightVector isn't `[' (starting an
+	array) it is simply ignored.
+
+	* include/freetype/fterrdef.h: Define `FT_Err_Ignore' (0xA2) as a
+	new internal error value.
+
+	* src/type1/t1load.c (parse_blend_axis_types,
+	parse_blend_design_positions, parse_blend_design_map): Return
+	T1_Err_Ignore if no proper array is following the keyword.
+	(parse_weight_vector): Use T1_ToTokenArray, initializing `blend'
+	structure, if necessary.
+	Return T1_Err_Ignore if no proper array is following the keyword.
+	(parse_shared_dict): Removed.
+	(parse_encoding): Set parser->root.error to return T1_Err_Ignore
+	if no result can be obtained.
+	Check for errors before accessing `elements' array.
+	(t1_keywords): Remove /shareddict.
+	(parse_dict): Reset error if t1_load_keyword returns T1_Err_Ignore.
+	Set keyword_flag only in case of success.
+	Check error code if skipping an unrecognized token.
+	(T1_Open_Face) [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: Call T1_Done_Blend
+	if blend commands haven't set up a proper MM font.
+
+	* src/psaux/psobjs.c (ps_parser_load_field_table): Remove special
+	code for synthetic fonts.
+	Return PSaux_Err_Ignore if no proper value has been found.
+
+2004-02-09  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings)
+	<cff_op_endchar>: Preserve glyph width before calling
+	cff_operator_seac.
+
+2004-02-09  Martin Muskens  <mmuskens@aurelon.com>
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings): Handle special
+	first argument for `hintmask' and `cntrmask' operators also.
+
+2004-02-08  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/configure.in: Call AC_SUBST for `enable_shared',
+	`hardcode_libdir_flag_spec', and `wl'.
+	* builds/unix/configure: Regenerated.
+
+	* builds/unix/freetype-config.in: Make --prefix and --exec-prefix
+	actually work.
+	Report a proper --rpath (or -R) value for --libs argument if a
+	shared library has been built.
+
+	* docs/CHANGES: Updated.
+
+2004-02-07  Keith Packard  <keithp@keithp.com>
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init, BDF_Set_Pixel_Size): Fix
+	computation of various vertical and horizontal metric values.
+
+	* src/pcfdrivr.c (PCF_Set_Pixel_Size), src/pcfread (pcf_load_font):
+	Ditto.
+
+2004-02-07  Werner Lemberg  <wl@gnu.org>
+
+	* builds/win32/visualc/index.html,
+	builds/win32/visualc/freetype.dsp,
+	builds/win32/visualc/freetype.dsw, docs/CHANGES: Updated.
+
+2004-02-07  Vitaliy Pasternak  <v_a_pasternak@mail.ru>
+
+	* builds/win32/visualc/freetype.sln,
+	builds/win32/visualc/freetype.vcproj: New files for VS.NET 2003.
+
+2004-02-03  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP):
+	Initialize `node'.
+	* src/type1/t1load.c (parse_dict): Initialize `have_integer'.
+
+2004-02-02  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1load.c (parse_dict): Handle `RD' and `-|' commands
+	outside of /Subrs or /CharStrings.  This can happen if there is
+	additional code manipulating those two arrays so that FreeType
+	doesn't recognize them properly.
+	(T1_Open_Face): Improve an error message.
+
+2004-02-01  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1load.c (parse_charstrings): Exit immediately if
+	there are no elements in /CharStrings.  This is needed for fonts
+	like Optima-Oblique which not only define /CharStrings but access it
+	also.
+
+2004-02-01  David Turner  <david@freetype.org>
+
+	* src/sfnt/Jamfile: Removing `ttcmap' from the list of sources.
+
+	* include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP)
+	<FTC_INLINE>: Provide macro version which doesn't use inline code.
+	* include/freetype/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP)
+	<FTC_INLINE>: Ditto.
+	Use FTC_MRULIST_LOOKUP_CMP.
+	* include/freetype/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): New
+	macro.
+	(FTC_MRULIST_LOOKUP): Use it.
+
+	* src/cache/Jamfile (_sources), src/cache/descrip.mms: Updated.
+	* src/cache/ftcbasic.c: Fix compiler warnings.
+	* src/cache/ftcmanag.c (FTC_Manager_LookupSize,
+	FTC_Manager_LookupFace) <FTC_INLINE>: Use FTC_MRULIST_LOOKUP_CMP.
+	* src/cache/ftcmru.c (FTC_MruList_Find): Fix a bug (found after
+	heavy testing).
+
+	* Jamfile: Updating `refdoc' target, and adding `autohint' to the
+	list of modules to build.  Both the autohinter and autofitter will
+	be built by default.  But which one will be used is determined by
+	the content of `ftmodule.h'.
+
+	* src/autofit/*: Many updates, but the code is still buggy...
+
+2004-01-31  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffgload.c (cff_operator_seac): Fix magnitude of
+	accent offset.
+	Update code similarly to the seac support for Type 1 fonts.
+	(cff_decoder_parse_charstrings) <cff_op_endchar>: Fix magnitude
+	of accent offset.
+	Don't hint glyphs twice if seac is emulated.
+	<cff_op_flex>: Assign correct point tags.
+	* docs/CHANGES: Updated.
+
+2004-01-30  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1parse.c (T1_Get_Private_Dict): Use FT_MEM_MOVE, not
+	FT_MEM_COPY, for copying the private dict.
+
+	* src/type1/t1load.c (parse_subrs): Assign number of subrs only
+	in first run.
+	(parse_charstrings): Parse /CharStrings in second run without
+	assigning values.
+	(parse_dict): Skip all /CharStrings arrays but the first.  We need
+	this for non-standard fonts like `Optima' which have different
+	outlines depending on the resolution.  Note that there is no
+	guarantee that we get fitting /Subrs and /CharStrings arrays; this
+	can only be done by a real PS interpreter.
+
+2004-01-29  Antoine Leca  <Antoine-Freetype@Leca-Marti.org>
+
+	* builds/win32/visualc/index.html: New file, giving detailed
+	explanations about forcing CR+LF line endings for the VC++ project
+	files.
+
+2004-01-22  Garrick Meeker  <garrick@digitalanarchy.com>
+
+	* src/cff/cffload.c (cff_subfont_load): Initialize `dict'.
+
+2004-01-22  Werner Lemberg  <wl@gnu.org>
+
+	Add support for the hexadicimal representation of binary data
+	started with `StartData' in CID-keyed Type 1 fonts.
+
+	* include/freetype/internal/t1types.h (CID_FaceRec): Add new
+	members `binary_data' and `cid_stream'.
+
+	* src/cid/cidload.c (cid_read_subrs): Use `face->cid_stream'.
+	(cid_hex_to_binary): New auxiliary function.
+	(cid_face_open): Add new argument `face_index' to return quickly
+	if less than zero.  Updated all callers.
+	Call `cid_hex_to_binary', then open and assign memory stream to
+	`face->cid_stream' if `parser->binary_length' is non-zero.
+	* src/cid/cidload.h: Updated.
+
+	* src/cid/cidobjs.c (cid_face_done): Free `binary_data' and
+	`cid_stream'.
+
+	* src/cid/cidparse.c (cid_parser_new): Check arguments to
+	`StartData' and set parser->binary_length accordingly.
+	* src/cid/cidparse.h (CID_Parser): New member `binary_length'.
+
+	* src/cid/cidgload.c (cid_load_glyph): Use `face->cid_stream'.
+
+	* docs/CHANGES: Updated.
+
+2004-01-21  Werner Lemberg  <wl@gnu.org>
+
+	include/freetype/config/ftstdlib.h (ft_atoi): Replaced with...
+	(ft_atol): This.
+	* src/base/ftdbgmem.c: s/atol/ft_atol/.
+	* src/type42/t42drivr.c: s/ft_atoi/ft_atol/.
+
+2004-01-20  Masatake YAMATO  <jet@gyve.org>
+
+	* include/freetype/ftcache.h: Delete duplicated definition of
+	FTC_FaceID.
+
+	* src/cff/cffdrivr.c (cff_get_cmap_info): Call sfnt module's TT CMap
+	Info service function if the cmap comes from sfnt.  Return 0 if the
+	cmap is sythesized in cff module.
+
+2004-01-20  David Turner  <david@freetype.org>
+
+	* src/cache/ftcmanag.c (ftc_size_node_compare): Call
+	FT_Activate_Size.
+
+2004-01-20  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1parse.c (T1_Get_Private_Dict): Skip exactly one
+	CR, LF, or CR/LF after `eexec'.
+
+2004-01-18  David Turner  <david@freetype.org>
+
+	* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Remove compiler
+	warning.
+
+	* src/tools/docmaker/*: Updating beautifier tool.
+
+2004-01-15  David Turner  <david@freetype.org>
+
+	* src/base/ftoutln.c (ft_orientation_extremum_compute): Fix
+	infinite loop bug.
+
+	* include/freetype/ftstroke.h: Include FT_GLYPH_H.
+	(FT_Stroker_Rewind, FT_Glyph_Stroke, FT_Glyph_StrokeBorder): New
+	declarations.
+
+	* src/base/ftstroke.c: Include FT_INTERNAL_OBJECTS_H.
+	(FT_Outline_GetOutsideBorder): Inverse result.
+	(FT_Stroker_Rewind, FT_Glyph_Stroke, FT_GlyphStrokeBorder): New
+	functions.
+	(FT_Stroker_EndSubPath): Close path if needed.
+	(FT_Stroker_Set, FT_Stroker_ParseOutline): Use FT_Stroker_Rewind.
+
+	* include/freetype/cache/ftcmanag.h (FTC_ScalerRec,
+	FTC_Manager_LookupSize): Moved to...
+	* include/freetype/ftcache.h (FTC_ScalerRec,
+	FTC_Manager_LookupSize): Here.
+
+	* src/tools/docmaker/docbeauty.py: New file to beautify the
+	documentation comments (e.g., to convert them to single block border
+	mode).
+	* src/tools/docmaker/docmaker.py (file_exists, make_file_list):
+	Moved to...
+	* src/tools/docmaker/utils.py (file_exists, make_file_list): Here.
+
+2004-01-14  David Turner  <david@freetype.org>
+
+	* include/freetype/internal/ftmemory.h (FT_ARRAY_COPY,
+	FT_ARRAY_MOVE): New macros to make copying arrays easier.
+	Updated all relevant code to use them.
+
+2004-01-14  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffload.c (cff_font_load): Load charstrings_index earlier.
+	Use number of charstrings as argument to CFF_Load_FD_Select (as
+	documented in the CFF specs).
+
+2004-01-13  Graham Asher  <graham.asher@btinternet.com>
+
+	* src/pshinter/pshalgo.c (psh_glyph_init): Move assignment of
+	`glyph->memory' up to free arrays properly in case of failure.
+
+2004-01-10  Masatake YAMATO  <jet@gyve.org>
+
+	Make `FT_Get_CMap_Language_ID' work with CFF.  Bug reported by
+	Steve Hartwell <shspamsink@comcast.net>.
+
+	* src/cff/cffdrivr.c: Include FT_SERVICE_TT_CMAP_H.
+	(cff_services): Added an entry for FT_SERVICE_ID_TT_CMAP.
+	(cff_get_cmap_info): New function.
+	(cff_service_get_cmap_info) New entry for cff_services.
+
+	* src/sfnt/ttcmap0.c: Exit loop after a format match has been found.
+	Suggested by Steve Hartwell <shspamsink@comcast.net>.
+
+2004-01-03  Masatake YAMATO  <jet@gyve.org>
+
+	* src/base/ftobjs.c (destroy_charmaps): New function.
+	(destroy_face, open_face): Use `destroy_charmaps'.
+
+2004-01-01  Werner Lemberg  <wl@gnu.org>
+
+	* docs/CHANGES: Updated.
+
+2004-01-01  Michael Jansson  <mjan@em2-solutions.com>
+
+	* src/winfonts/winfnt.c (FNT_Size_Set_Pixels): Fix sign of
+	size->metrics.descender.
+
+2003-12-31  Wolfgang Domr�se  <porthos.domroese@harz.de>
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings)
+	[FT_DEBUG_LEVEL_TRACE]: Use `%ld' in FT_TRACE4.
+	<cff_op_flex1>: Change type of dx and dy to FT_Pos and remove
+	cast for accessing arguments.
+
+2003-12-31  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Revert previous
+	change.  It's not necessary.
+
+2003-12-29  Smith Charles  <smith.charles@free.fr>
+
+	* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle `repeated
+	flags set' correctly.
+
+2003-12-29  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffobjs.c (cff_face_init): Fix memory leak by deallocating
+	`full' and `weight' properly.
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings)
+	<cff_op_hintmask> [FT_DEBUG_LEVEL_TRACE]: Use `0x' as prefix for
+	tracing output.
+
+2003-12-26  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/internal/sfnt.h (TT_Set_SBit_Strike_Func):
+	Use FT_UInt for ppem values.
+	* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use FT_UInt for
+	ppem values.
+	* src/sfnt/ttsbit.h: Updated.
+
+	* src/base/ftobjs.c (FT_Set_Pixel_Sizes): Don't allow ppem values
+	larger than -0FFFF.
+
+2003-12-25  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/fttrigon.c, src/base/ftgloadr.c: Inlude
+	FT_INTERNAL_OBJECTS_H.
+
+	* src/base/ftstroke.c (FT_Outline_GetInsideBorder,
+	FT_Outline_GetOutsideBorder): s/or/o/ to make it compile with
+	C++ compilers.
+
+	* src/cache/ftcmru.c, include/freetype/cache/ftcmru.h:
+	s/select/selection/ to avoid compiler warning.
+	* src/cff/cffload.h: s/select/ftselect/ to avoid potential
+	compiler warning.
+
+2003-12-24  Werner Lemberg  <wl@gnu.org>
+
+	* src/cache/ftcsbits.c (FTC_SNode_Weight):
+	s/FTC_SBIT_ITEM_PER_NODE/FTC_SBIT_ITEMS_PER_NODE/.
+
+2003-12-24  David Turner  <david@freetype.org>
+
+	* Fixed compilation problems in the cache sub-system.
+
+	* Partial updates to src/autofit.
+
+	* Jamfile (FT2_COMPONENTS): Add autofit module.
+
+2003-12-23  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffgload.c (cff_lookup_glyph_by_stdcharcode): Handle
+	CID-keyed fonts.
+
+2003-12-23  David Turner  <david@freetype.org>
+
+	* include/freetype/internal/ftobjs.h (FT_PAD_FLOOR, FT_PAD_ROUND,
+	FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_CEIL): New macros.  They
+	are used to avoid compiler warnings with very pedantic compilers.
+	Note that `(x) & -64' causes a warning if (x) is not signed.  Use
+	`(x) & ~63' instead!
+	Updated all related code.
+
+	Add support for extraction of `inside' and `outside' borders.
+
+	* src/base/ftstroke.c (FT_StrokerBorder): New enumeration.
+	(FT_Outline_GetInsideBorder, FT_Outline_GetOutsideBorder,
+	FT_Stroker_GetBorderCounts, FT_Stroker_ExportBorder): New functions.
+	(FT_StrokeBorderRec): New boolean member `valid'.
+	(ft_stroke_border_get_counts): Updated.
+	* include/freetype/ftstroke.h: Updated.
+
+2003-12-22  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/ftwinfnt.h (FT_WinFNT_ID_*): New definitions
+	to describe the `charset' field in FT_WinFNT_HeaderRec.
+	* src/winfonts/winfnt.c (FNT_Face_Init): Set encoding to
+	FT_ENCODING_NONE except for FT_WinFNT_ID_MAC.
+
+	* include/freetype/freetype.h (FT_Encoding): Improve comment,
+	based on work by Detlef W�rkner <TetiSoft@apg.lahn.de>.
+
+	* docs/CHANGES: Updated.
+
+2003-12-22  David Turner  <david@freetype.org>
+
+	* include/freetype/ftcache.h,
+	include/freetype/cache/ftcmanag.h,
+	include/freetype/cache/ftccache.h,
+	include/freetype/cache/ftcmanag.h,
+	include/freetype/cache/ftcmru.h (added),
+	include/freetype/cache/ftlru.h (removed),
+	include/freetype/cache/ftcsbits.h,
+	include/freetype/cache/ftcimage.h,
+	include/freetype/cache/ftcglyph.h,
+	src/cache/ftcmru.c,
+	src/cache/ftcmanag.c,
+	src/cache/ftccache.c,
+	src/cache/ftcglyph.c,
+	src/cache/ftcimage.c,
+	src/cache/ftcsbits.c,
+	src/cache/ftccmap.c,
+	src/cache/ftcbasic.c (added),
+	src/cache/ftclru.c (removed):
+
+	  *Complete* rewrite of the cache sub-system to `solve' the
+	  following points:
+
+	    - all public APIs have been moved to FT_CACHE_H, everything
+	      under `include/freetype/cache' is only needed by client
+	      applications that want to implement their own caches
+
+	    - a new function named FTC_Manager_RemoveFaceID to deal
+	      with the uninstallation of FaceIDs
+
+	    - the image and sbit cache are now abstract classes, that
+	      can be extended much more easily by client applications
+
+	    - better performance in certain areas. Further optimizations
+	      to come shortly anyway...
+
+	    - the FTC_CMapCache_Lookup function has changed its signature,
+	      charmaps can now only be retrieved by index
+
+	    - FTC_Manager_Lookup_Face => FTC_Manager_LookupFace
+	      FTC_Manager_Lookup_Size => FTC_Manager_LookupSize (still in
+	      private header for the moment)
+
+2003-12-21  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1load.c (parse_dict): Stop parsing if `eexec' keyword
+	is encountered.
+
+2003-12-19  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 32.  For
+	example, the Japanese Hiragino font already contains 15 subfonts.
+
+	* src/cff/cffload.c (cff_font_load): Deallocate `sids' array for
+	CID-keyed fonts.
+
+	* devel/ftoption.h: Define FT_DEBUG_MEMORY.
+
+2003-12-18  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/ttnameid.h (TT_ADOBE_ID_LATIN_1): New macro.
+	* src/type1/t1objs.c (T1_Face_Init): Use TT_ADOBE_ID* values.
+
[truncated at 1000 lines; 2026 more skipped]

reactos/lib/freetype
Jamfile 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Jamfile	15 Feb 2004 21:45:28 -0000	1.5
+++ Jamfile	10 May 2004 17:48:21 -0000	1.6
@@ -1,4 +1,4 @@
-# FreeType 2 top Jamfile (c) 2001, 2002, 2003 David Turner
+# FreeType 2 top Jamfile (c) 2001, 2002, 2003, 2004 David Turner
 #
 
 # The HDRMACRO is already defined in FTJam and is used to add
@@ -61,13 +61,15 @@
 # IMPORTANT: You'll need to change the content of "ftmodule.h" as well
 #            if you modify this list or provide your own.
 #
-FT2_COMPONENTS ?= gzip       # support for gzip-compressed files
+FT2_COMPONENTS ?= autofit    # auto-fitter
                   autohint   # auto-hinter
                   base       # base component (public APIs)
                   bdf        # BDF font driver
                   cache      # cache sub-system
                   cff        # CFF/CEF font driver
                   cid        # PostScript CID-keyed font driver
+                  gzip       # support for gzip-compressed files
+                  lzw        # support for LZW-compressed files
                   pcf        # PCF font driver
                   pfr        # PFR/TrueDoc font driver
                   psaux      # common PostScript routines module
@@ -146,7 +148,7 @@
 
 actions RefDoc
 {
-  python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.5 --output=$(DOC_DIR)  $(FT2_INCLUDE)/freetype/*.h  $(FT2_INCLUDE)/freetype/config/*.h  $(FT2_INCLUDE)/freetype/cache/*.h
+  python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.8 --output=$(DOC_DIR)  $(FT2_INCLUDE)/freetype/*.h  $(FT2_INCLUDE)/freetype/config/*.h  $(FT2_INCLUDE)/freetype/cache/*.h
 }
 
 RefDoc  refdoc ;

reactos/lib/freetype
README 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- README	15 Feb 2004 21:45:28 -0000	1.5
+++ README	10 May 2004 17:48:22 -0000	1.6
@@ -9,7 +9,7 @@
   is called `libttf'.  They are *not* compatible!
 
 
-  FreeType 2.1.5
+  FreeType 2.1.8
   ==============
 
   Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION.
@@ -19,9 +19,9 @@
   Note  that  the FreeType  2  documentation  is  now available  as  a
   separate package from our sites.  See:
 
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.5.tar.bz2
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.5.tar.gz
-    ftp://ftp.freetype.org/pub/freetype2/ftdoc215.zip
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.bz2
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.gz
+    ftp://ftp.freetype.org/pub/freetype2/ftdoc218.zip
 
 
   Bugs

reactos/lib/freetype
README.ROS 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- README.ROS	21 Jan 2004 19:23:45 -0000	1.4
+++ README.ROS	10 May 2004 17:48:22 -0000	1.5
@@ -1,7 +1,7 @@
 CREDITS
 
 The code in this tree is based (it is actually an exact copy with some
-ReactOS specific extra files) on the FreeType library, version 2.1.5.
+ReactOS specific extra files) on the FreeType library, version 2.1.8.
 It was written and is being maintained by the FreeType team. The projects
 website is http://www.freetype.org.
 
@@ -66,4 +66,4 @@
 After testing, you can commit the new/changed files to CVS. ALthough files
 config.mk and freetype.def are generated, they should be included in CVS.
 
-$Id: README.ROS,v 1.4 2004/01/21 19:23:45 gvg Exp $
+$Id: README.ROS,v 1.5 2004/05/10 17:48:22 gvg Exp $

reactos/lib/freetype
configure 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- configure	21 Jan 2004 19:23:45 -0000	1.2
+++ configure	10 May 2004 17:48:22 -0000	1.3
@@ -5,7 +5,6 @@
 # This should re-generate the following files:
 #
 #   config.mk
-#   Jamfile
 #   install
 #
 
@@ -14,9 +13,14 @@
 fi
 
 if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then
-  echo "Sorry, GNU make is required to build FreeType2." >&2
-  echo "Please try \`GNUMAKE=<GNU make command name> $0'." >&2
-  exit 1
+  if test -z "`$GNUMAKE -v 2>/dev/null | grep makepp`"; then
+    echo "GNU make (>= 3.79.1) or makepp (>= 1.19) is required to build FreeType2." >&2
+    echo "Please try" >&2
+    echo "  \`GNUMAKE=<GNU make command name> $0'." >&2
+    echo "or >&2"
+    echo "  \`GNUMAKE=\"makepp --norc-substitution\" $0'." >&2
+    exit 1
+  fi
 fi
 
 # Uh, oh.  This is taken from autoconf.  They know what they are doing...

reactos/lib/freetype
freetype.def 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- freetype.def	15 Feb 2004 21:45:28 -0000	1.5
+++ freetype.def	10 May 2004 17:48:22 -0000	1.6
@@ -4,6 +4,8 @@
 FT_New_Memory
 FT_Stream_Open
 ft_debug_init
+FT_Trace_Get_Count
+FT_Trace_Get_Name
 FT_Add_Default_Modules
 FT_Done_FreeType
 FT_Init_FreeType
@@ -29,6 +31,7 @@
 FT_FloorFix
 FT_Free
 FT_Get_Char_Index
+FT_Get_CMap_Language_ID
 FT_Get_First_Char
 FT_Get_Glyph_Name
 FT_Get_Kerning
@@ -66,6 +69,7 @@
 FT_Load_Glyph
 FT_Load_Sfnt_Table
 FT_Lookup_Renderer
+ft_module_get_service
 FT_MulDiv
 FT_MulFix
 FT_MulTo64
@@ -82,18 +86,23 @@
 FT_Outline_Done_Internal
 FT_Outline_Get_Bitmap
 FT_Outline_Get_CBox
+FT_Outline_Get_Orientation
 FT_Outline_New
 FT_Outline_New_Internal
 FT_Outline_Render
 FT_Outline_Reverse
 FT_Outline_Transform
 FT_Outline_Translate
+FT_Raccess_Get_DataOffsets
+FT_Raccess_Get_HeaderInfo
+FT_Raccess_Guess
 FT_Realloc
 FT_Remove_Module
 FT_Render_Glyph
 FT_Render_Glyph_Internal
 FT_RoundFix
 FT_Select_Charmap
+ft_service_list_lookup
 FT_Set_Char_Size
 FT_Set_Charmap
 FT_Set_Debug_Hook
@@ -107,12 +116,14 @@
 FT_Stream_EnterFrame
 FT_Stream_ExitFrame
 FT_Stream_ExtractFrame
+FT_Stream_Free
 FT_Stream_GetChar
 FT_Stream_GetLong
 FT_Stream_GetLongLE
 FT_Stream_GetOffset
 FT_Stream_GetShort
 FT_Stream_GetShortLE
+FT_Stream_New
 FT_Stream_OpenMemory
 FT_Stream_Pos
 FT_Stream_Read
@@ -137,6 +148,9 @@
 FT_Vector_Rotate
 FT_Vector_Transform
 FT_Vector_Unit
+FT_Outline_Get_BBox
+FT_Get_BDF_Charset_ID
+FT_Get_BDF_Property
 ft_bitmap_glyph_class
 FT_Done_Glyph
 FT_Get_Glyph
@@ -150,90 +164,104 @@
 FT_Get_Multi_Master
 FT_Set_MM_Blend_Coordinates
 FT_Set_MM_Design_Coordinates
-FT_Get_BDF_Charset_ID
-FT_Get_BDF_Property
-FT_Get_PS_Font_Info
-FT_Has_PS_Glyph_Names
-FT_Get_X11_Font_Format
 FT_Get_PFR_Advance
 FT_Get_PFR_Kerning
 FT_Get_PFR_Metrics
+FT_Glyph_Stroke
+FT_Glyph_StrokeBorder
+FT_Outline_GetInsideBorder
+FT_Outline_GetOutsideBorder
 FT_Stroker_BeginSubPath
 FT_Stroker_ConicTo
 FT_Stroker_CubicTo
 FT_Stroker_Done
 FT_Stroker_EndSubPath
 FT_Stroker_Export
+FT_Stroker_ExportBorder
+FT_Stroker_GetBorderCounts
 FT_Stroker_GetCounts
 FT_Stroker_LineTo
 FT_Stroker_New
 FT_Stroker_ParseOutline
+FT_Stroker_Rewind
 FT_Stroker_Set
+FT_Get_PS_Font_Info
+FT_Has_PS_Glyph_Names
 FT_Get_WinFNT_Header
-FT_Outline_Get_BBox
+FT_Get_X11_Font_Format
 ah_arctan
 autohint_module_class
 ft_autohinter_service
 bdf_cmap_class
 bdf_driver_class
-FT_LruList_Destroy
-FT_LruList_Lookup
-FT_LruList_New
-FT_LruList_Remove
-FT_LruList_Remove_Selection
-FT_LruList_Reset
-ftc_cache_clear
-ftc_cache_done
-ftc_cache_init
-ftc_cache_lookup
+ftc_basic_image_cache_class
+ftc_basic_image_family_class
+ftc_basic_sbit_cache_class
+ftc_basic_sbit_family_class
+FTC_Cache_Clear
+FTC_Cache_Done
+FTC_Cache_Init
+FTC_Cache_Lookup
+FTC_Cache_NewNode
+FTC_Cache_RemoveFaceID
 ftc_cmap_cache_class
 FTC_CMapCache_Lookup
 FTC_CMapCache_New
 ftc_face_list_class
-ftc_family_done
-ftc_family_init
-ftc_family_table_alloc
-ftc_family_table_free
-ftc_glyph_family_done
-ftc_glyph_family_init
-ftc_glyph_node_compare
-ftc_glyph_node_done
-ftc_glyph_node_init
-ftc_image_cache_class
-FTC_Image_Cache_Lookup
-FTC_Image_Cache_New
+FTC_Family_Init
+FTC_GCache_Done
+FTC_GCache_Init
+FTC_GCache_Lookup
+FTC_GCache_New
+FTC_GNode_Compare
+FTC_GNode_Done
+FTC_GNode_Init
+FTC_GNode_UnselectFamily
 FTC_ImageCache_Lookup
 FTC_ImageCache_New
+FTC_INode_Free
+FTC_INode_New
+FTC_INode_Weight
 FTC_Manager_Compress
 FTC_Manager_Done
-FTC_Manager_Lookup_Face
-FTC_Manager_Lookup_Size
+FTC_Manager_FlushN
+FTC_Manager_LookupFace
+FTC_Manager_LookupSize
 FTC_Manager_New
-FTC_Manager_Register_Cache
+FTC_Manager_RegisterCache
+FTC_Manager_RemoveFaceID
 FTC_Manager_Reset
+FTC_MruList_Done
+FTC_MruList_Find
+FTC_MruList_Init
+FTC_MruList_Lookup
+FTC_MruList_New
+FTC_MruList_Remove
+FTC_MruList_RemoveSelection
+FTC_MruList_Reset
+FTC_MruNode_Prepend
+FTC_MruNode_Remove
+FTC_MruNode_Up
 ftc_node_destroy
-ftc_node_done
 FTC_Node_Unref
-ftc_sbit_cache_class
-FTC_SBit_Cache_Lookup
-FTC_SBit_Cache_New
 FTC_SBitCache_Lookup
 FTC_SBitCache_New
 ftc_size_list_class
+FTC_SNode_Compare
+FTC_SNode_Free
+FTC_SNode_New
+FTC_SNode_Weight
 cff_cmap_encoding_class_rec
 cff_cmap_unicode_class_rec
 cff_driver_class
 t1cid_driver_class
 FT_Stream_OpenGzip
-BitOrderInvert
-FourByteSwap
+FT_Stream_OpenLZW
 pcf_cmap_class
 pcf_driver_class
-RepadBitmap
-TwoByteSwap
 pfr_cmap_class_rec
 pfr_driver_class
-pfr_service_rec
+pfr_metrics_service_rec
 ps_parser_funcs
 ps_table_funcs
 psaux_module_class

reactos/lib/freetype
Jamfile.in removed after 1.3
diff -N Jamfile.in
--- Jamfile.in	21 Jan 2004 19:23:44 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,135 +0,0 @@
-# FreeType 2 top Jamfile (c) 2001, 2002, 2003 David Turner
-#
-
-# The HDRMACRO is already defined in FTJam and is used to add
-# the content of certain macros to the list of included header
-# files.
-#
-# We can compile FreeType 2 with classic Jam however thanks to
-# the following code
-#
-if ! $(JAM_TOOLSET)
-{
-  rule HDRMACRO
-  {
-    # nothing
-  }
-}
-
-
-# We need to invoke a SubDir rule if the FT2 source directory top is not the
-# current directory.  This allows us to build FreeType 2 as part of a larger
-# project easily.
-#
-if $(FT2_TOP) != $(DOT)
-{
-  SubDir  FT2_TOP ;
-}
-
-
-# The following macros define the include directory, the source directory,
-# and the final library name (without library extensions).  They can be
-# replaced by other definitions when the library is compiled as part of
-# a larger project.
-#
-
-# Name of FreeType include directory during compilation.
-# This is relative to FT2_TOP.
-#
-FT2_INCLUDE_DIR ?= include ;
-
-# Name of FreeType source directory during compilation.
-# This is relative to FT2_TOP.
-#
-FT2_SRC_DIR ?= src ;
-
-# Name of final library, without extension.
-#
-FT2_LIB ?= $(LIBPREFIX)freetype ;
-
-
-# Define FT2_BUILD_INCLUDE to point to your build-specific directory.
-# This is prepended to FT2_INCLUDE_DIR.  It can be used to specify
-# the location of a custom <ft2build.h> which will point to custom
-# versions of "ftmodule.h" and "ftoption.h", for example.
-#
-FT2_BUILD_INCLUDE ?= ;
-
-# The list of modules to compile on any given build of the library.
-# By default, this will contain _all_ modules defined in FT2_SRC_DIR.
-#
-# IMPORTANT: You'll need to change the content of "ftmodule.h" as well
-#            if you modify this list or provide your own.
-#
-FT2_COMPONENTS ?= gzip       # support for gzip-compressed files
-                  autohint   # auto-hinter
-                  base       # base component (public APIs)
-                  bdf        # BDF font driver
-                  cache      # cache sub-system
-                  cff        # CFF/CEF font driver
-                  cid        # PostScript CID-keyed font driver
-                  pcf        # PCF font driver
-                  pfr        # PFR/TrueDoc font driver
-                  psaux      # common PostScript routines module
-                  pshinter   # PostScript hinter module
-                  psnames    # PostScript names handling
-                  raster     # monochrome rasterizer
-                  smooth     # anti-aliased rasterizer
-                  sfnt       # SFNT-based format support routines
-                  truetype   # TrueType font driver
-                  type1      # PostScript Type 1 font driver
-                  type42     # PostScript Type 42 (embedded TrueType) driver
-                  winfonts   # Windows FON/FNT font driver
-                  ;
-
-
-# Don't touch.
-#
-FT2_INCLUDE  = $(FT2_BUILD_INCLUDE)
-               [ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
-
-FT2_SRC      = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
-
-# Only used by FreeType developers.
-#
-if $(DEBUG_HINTER)
-{
-  CCFLAGS += -DDEBUG_HINTER ;
-}
-
-
-# We need "freetype2/include" in the current include path in order to
-# compile any part of FreeType 2.
-#
-HDRS += $(FT2_INCLUDE) ;
-
-
-# Uncomment the following line if you want to build individual source files
-# for each FreeType 2 module.  This is only useful during development, and
-# is better defined as an environment variable anyway!
-#
-# FT2_MULTI = true ;
-
-
-# The file <freetype/config/ftheader.h> is used to define macros that are
-# later used in #include statements.  It needs to be parsed in order to
-# record these definitions.
-#
-HDRMACRO  [ FT2_SubDir  include freetype config ftheader.h ] ;
-HDRMACRO  [ FT2_SubDir  include freetype internal internal.h ] ;
-
-
-# Now include the Jamfile in "freetype2/src", used to drive the compilation
-# of each FreeType 2 component and/or module.
-#
-SubInclude  FT2_TOP $(FT2_SRC_DIR) ;
-
-
-# Test files (hinter debugging).  Only used by FreeType developers.
-#
-if $(DEBUG_HINTER)
-{
-  SubInclude FT2_TOP tests ;
-}
-
-# end of top Jamfile

reactos/lib/freetype
install removed after 1.1
diff -N install
--- install	1 Apr 2003 08:38:28 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-#! /bin/sh
-make install

reactos/lib/freetype/builds
freetype.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- freetype.mk	15 Feb 2004 21:45:28 -0000	1.4
+++ freetype.mk	10 May 2004 17:48:22 -0000	1.5
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2001, 2002, 2003 by
+# Copyright 1996-2000, 2001, 2002, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -97,6 +97,7 @@
 #
 PUBLIC_DIR   := $(TOP_DIR)/include/freetype
 INTERNAL_DIR := $(PUBLIC_DIR)/internal
+SERVICES_DIR := $(INTERNAL_DIR)/services
 CONFIG_DIR   := $(PUBLIC_DIR)/config
 CACHE_DIR    := $(PUBLIC_DIR)/cache
 
@@ -155,7 +156,8 @@
 # changes, the whole library is recompiled.
 #
 PUBLIC_H   := $(wildcard $(PUBLIC_DIR)/*.h)
-BASE_H     := $(wildcard $(INTERNAL_DIR)/*.h)
+BASE_H     := $(wildcard $(INTERNAL_DIR)/*.h) \
+              $(wildcard $(SERVICES_DIR)/*.h)
 CONFIG_H   := $(wildcard $(CONFIG_DIR)/*.h) \
               $(wildcard $(BUILD_DIR)/freetype/config/*.h)
 CACHE_H    := $(wildcard $(CACHE_DIR)/*.h)
@@ -252,7 +254,7 @@
 refdoc:
 	python $(SRC_DIR)/tools/docmaker/docmaker.py \
                --prefix=ft2                          \
-               --title=FreeType-2.1.5                \
+               --title=FreeType-2.1.8                \
                --output=$(DOC_DIR)                   \
                $(PUBLIC_DIR)/*.h                     \
                $(PUBLIC_DIR)/config/*.h              \

reactos/lib/freetype/builds
toplevel.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- toplevel.mk	15 Feb 2004 21:45:28 -0000	1.4
+++ toplevel.mk	10 May 2004 17:48:22 -0000	1.5
@@ -110,6 +110,7 @@
 	  $(RM) builds/unix/config.status
 	  $(RM) builds/unix/unix-def.mk
 	  $(RM) builds/unix/unix-cc.mk
+	  $(RM) builds/unix/freetype2.pc
 	  $(RM) nul
 
   endif # test is_unix

reactos/lib/freetype/builds/atari
ATARI.H 1.2 -> 1.3
diff -N ATARI.H
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ATARI.H	10 May 2004 17:48:23 -0000	1.3
@@ -0,0 +1,16 @@
+#ifndef ATARI_H
+#define ATARI_H
+
+#pragma warn -stu
+
+/* PureC doesn't like 32bit enumerations */
+
+#ifndef FT_IMAGE_TAG
+#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value 
+#endif /* FT_IMAGE_TAG */ 
+
+#ifndef FT_ENC_TAG
+#define FT_ENC_TAG( value, a, b, c, d ) value
+#endif /* FT_ENC_TAG */
+
+#endif /* ATARI_H */

reactos/lib/freetype/builds/atari
FNames.SIC 1.2 -> 1.3
diff -N FNames.SIC
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FNames.SIC	10 May 2004 17:48:23 -0000	1.3
@@ -0,0 +1,37 @@
+/* the following changes file names for PureC projects */
+
+if (argc > 0)
+{
+	ordner = argv[0];
+	if (basename(ordner) == "") /* ist Ordner */
+	{
+		ChangeFilenames(ordner);
+	}
+}
+
+proc ChangeFilenames(folder)
+local i,entries,directory,file;
+{
+	entries = filelist(directory,folder);
+	for (i = 0; i < entries; ++i)
+	{
+		file = directory[i,0];
+		if ((directory[i,3]&16) > 0) /* subdirectory */
+		{
+			ChangeFilenames(folder+file+"\\");
+		}
+		else
+		{
+			if ((stricmp(suffix(file),".h")==0)|(stricmp(suffix(file),".c")==0))
+			ChangeFilename(folder,file);
+		}
+	}
+}
+
+proc ChangeFilename(path,datei)
+local newfile,err;
+{
+	newfile=datei;
+	newfile[0]=(newfile[0] | 32) ^ 32;
+	err=files.rename("-q",path+datei,newfile);
+}

reactos/lib/freetype/builds/atari
FREETYPE.PRJ 1.2 -> 1.3
diff -N FREETYPE.PRJ
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FREETYPE.PRJ	10 May 2004 17:48:23 -0000	1.3
@@ -0,0 +1,33 @@
+;FreeType project file
+
+FREETYPE.LIB
+
+.C [-K -P -R -A]
+.L [-J -V]
+.S
+
+=
+
+..\..\src\base\ftsystem.c
+..\..\src\base\ftdebug.c
+
+..\..\src\base\ftinit.c
+..\..\src\base\ftglyph.c
+..\..\src\base\ftmm
+..\..\src\base\ftbbox
+
+..\..\src\base\ftbase.c
+..\..\src\autohint\autohint.c
+;..\..\src\cache\ftcache.c
+..\..\src\cff\cff.c
+..\..\src\cid\type1cid.c
+..\..\src\psaux\psaux.c
+..\..\src\pshinter\pshinter.c
+..\..\src\psnames\psnames.c
+..\..\src\raster\raster.c
+..\..\src\sfnt\sfnt.c
+..\..\src\smooth\smooth.c
+..\..\src\truetype\truetype.c
+..\..\src\type1\type1.c
+..\..\src\type42\type42.c
+

reactos/lib/freetype/builds/atari
README.TXT 1.2 -> 1.3
diff -N README.TXT
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ README.TXT	10 May 2004 17:48:23 -0000	1.3
@@ -0,0 +1,51 @@
+Compiling FreeType 2 with PureC compiler
+========================================
+
+[See below for a German version.]
+
+To compile FreeType 2 as a library the following changes must be applied:
+
+- All *.c files must start with an uppercase letter.
+  (In case GEMSCRIPT is available:
+  Simply drag the whole FreeType 2 directory to the file `FNames.SIC'.)
+
+- You have to change the INCLUDE directory in PureC's compiler options
+  to contain both the `INCLUDE' and `freetype2\include' directory.
+  Example:
+
+    INCLUDE;E:\freetype2\include
+
+- The file `freetype2/include/Ft2build.h' must be patched as follows to
+  include ATARI.H:
+
+    #ifndef __FT2_BUILD_GENERIC_H__
+    #define __FT2_BUILD_GENERIC_H__
+
+    #include "ATARI.H"
+
+
+
+Compilieren von FreeType 2 mit PureC
+====================================
+
+Um FreeType 2 als eine Bibliothek (library) zu compilieren, muss folgendes
+ge�ndert werden:
+
+- Alle *.c-files m�ssen mit einem GROSSBUCHSTABEN beginnen.
+  (Falls GEMSCRIPT zur Verf�gung steht:
+  Den kompletten Ordner freetype2 auf die Datei `FNames.SIC' draggen.)
+
+- In den Compiler-Optionen von PureC muss das INCLUDE directory auf INCLUDE
+  und freetype2\include verweisen. Z.B.:
+
+    INCLUDE;E:\freetype2\include
+
+- In der Datei freetype2/include/Ft2build.h muss zu Beginn
+  ein #include "ATARI.H" wie folgt eingef�gt werden:
+
+    #ifndef __FT2_BUILD_GENERIC_H__
+    #define __FT2_BUILD_GENERIC_H__
+
+    #include "ATARI.H"
+
+--- end of README.TXT ---

reactos/lib/freetype/builds/unix
.cvsignore 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- .cvsignore	15 Feb 2004 21:45:28 -0000	1.3
+++ .cvsignore	10 May 2004 17:48:23 -0000	1.4
@@ -6,3 +6,4 @@
 libtool
 ftconfig.h
 freetype-config
+freetype2.pc

reactos/lib/freetype/builds/unix
aclocal.m4 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- aclocal.m4	15 Feb 2004 21:45:28 -0000	1.5
+++ aclocal.m4	10 May 2004 17:48:23 -0000	1.6
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.7.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.8a -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 # Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -11,43 +11,63 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 
-# serial 1 FT_MUNMAP_DECL
+# serial 47 AC_PROG_LIBTOOL
 
-AC_DEFUN(FT_MUNMAP_DECL,
-[AC_MSG_CHECKING([whether munmap must be declared])
-AC_CACHE_VAL(ft_cv_munmap_decl,
-[AC_TRY_COMPILE([
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/mman.h>],
-[char *(*pfn) = (char *(*))munmap],
-ft_cv_munmap_decl=no,
-ft_cv_munmap_decl=yes)])
-AC_MSG_RESULT($ft_cv_munmap_decl)
-if test $ft_cv_munmap_decl = yes; then
-  AC_DEFINE(NEED_MUNMAP_DECL,,
-  [Define to 1 if munmap() is not defined in <sys/mman.h>])
-fi])
-
-AC_DEFUN(FT_MUNMAP_PARAM,
-[AC_MSG_CHECKING([for munmap's first parameter type])
-AC_TRY_COMPILE([
-#include <unistd.h>
-#include <sys/mman.h>
-int munmap(void *, size_t);],,
-  AC_MSG_RESULT([void *]);AC_DEFINE(MUNMAP_USES_VOIDP,,
-    [Define to 1 if the first argument of munmap is of type void *]),
-  AC_MSG_RESULT([char *]))
-])
 
-# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+	         [m4_ifdef([AC_PROVIDE_$1],
+		           [$2], [$3])])])
 
-# serial 46 AC_PROG_LIBTOOL
 
+# AC_PROG_LIBTOOL
+# ---------------
 AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	[AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+	     [define([LT_AC_PROG_GCJ],
+		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
 
 # This can be used to rebuild libtool when needed
 LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
@@ -58,10 +78,13 @@
 
 # Prevent multiple expansion
 define([AC_PROG_LIBTOOL], [])
-])
+])# _AC_PROG_LIBTOOL
+
 
+# AC_LIBTOOL_SETUP
+# ----------------
 AC_DEFUN([AC_LIBTOOL_SETUP],
-[AC_PREREQ(2.13)dnl
+[AC_PREREQ(2.50)dnl
 AC_REQUIRE([AC_ENABLE_SHARED])dnl
 AC_REQUIRE([AC_ENABLE_STATIC])dnl
 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
@@ -71,382 +94,221 @@
 AC_REQUIRE([AC_PROG_LD])dnl
 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([LT_AC_PROG_SED])dnl
 
 AC_REQUIRE([AC_PROG_LN_S])dnl
 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
 AC_REQUIRE([AC_OBJEXT])dnl
 AC_REQUIRE([AC_EXEEXT])dnl
 dnl
 
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
 _LT_AC_PROG_ECHO_BACKSLASH
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    AC_PATH_MAGIC
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
   fi
   ;;
 esac
 
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-AC_CHECK_TOOL(STRIP, strip, :)
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
 
-ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-enable_win32_dll=yes, enable_win32_dll=no)
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
 
-AC_ARG_ENABLE(libtool-lock,
-  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
 
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
 
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_SAVE
-     AC_LANG_C
-     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_RESTORE])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
+# Constants:
+rm="rm -f"
 
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
 
-  # recent cygwin and mingw systems supply a stub DllMain which the user
-  # can override, but on older systems we have to supply one
-  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
-    [AC_TRY_LINK([],
-      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
-      DllMain (0, 0, 0);],
-      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
-
-  case $host/$CC in
-  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
-    # old mingw systems require "-dll" to link a DLL, while more recent ones
-    # require "-mdll"
-    SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -mdll"
-    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
-      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
-    CFLAGS="$SAVE_CFLAGS" ;;
-  *-*-cygwin* | *-*-pw32*)
-    # cygwin systems need to pass --dll to the linker, and not link
-    # crt.o which will require a WinMain@16 definition.
-    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
   esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
   ;;
-  ])
 esac
 
-_LT_AC_LTCONFIG_HACK
-
-])
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
 
-# AC_LIBTOOL_HEADER_ASSERT
-# ------------------------
-AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
-[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
-    [lt_cv_func_assert_works],
-    [case $host in
-    *-*-solaris*)
-      if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
-        case `$CC --version 2>/dev/null` in
-        [[12]].*) lt_cv_func_assert_works=no ;;
-        *)        lt_cv_func_assert_works=yes ;;
-        esac
-      fi
-      ;;
-    esac])
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
-if test "x$lt_cv_func_assert_works" = xyes; then
-  AC_CHECK_HEADERS(assert.h)
-fi
-])# AC_LIBTOOL_HEADER_ASSERT
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
 
-# _LT_AC_CHECK_DLFCN
-# --------------------
-AC_DEFUN([_LT_AC_CHECK_DLFCN],
-[AC_CHECK_HEADERS(dlfcn.h)
-])# _LT_AC_CHECK_DLFCN
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
 
-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-# ---------------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_NM])
-AC_REQUIRE([AC_OBJEXT])
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
 
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
 
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
 
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
 
-# Transform an extracted symbol line into a proper C declaration
-lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
 
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
 
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*) # Its linker distinguishes data from code symbols
-  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris* | sysv5*)
-  symcode='[[BDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
 
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $host_os in
-mingw*)
-  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
   ;;
 esac
 
-# If we're using GNU nm, then use its standard symbol codes.
-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
-  symcode='[[ABCDGISTW]]'
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
 fi
 
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Write the raw and C identifiers.
-lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-  rm -f conftest*
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
 EOF
+  exit 0
+fi
 
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
-
-	  cat <<EOF >> conftest.$ac_ext
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr address;
-}
-lt_preloaded_symbols[[]] =
-{
-EOF
-	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
-	  cat <<\EOF >> conftest.$ac_ext
-  {0, (lt_ptr) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  save_LIBS="$LIBS"
-	  save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$save_LIBS"
-	  CFLAGS="$save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
-    fi
-  else
-    echo "$progname: failed program was:" >&AC_FD_CC
-    cat conftest.$ac_ext >&5
-  fi
-  rm -f conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  global_symbol_to_cdecl=
-  global_symbol_to_c_name_address=
-else
-  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
-  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
-fi
-if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
-then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-
-# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
-# ---------------------------------
-AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
-[# Find the correct PATH separator.  Usually this is `:', but
-# DJGPP uses `;' like DOS.
-if test "X${PATH_SEPARATOR+set}" != Xset; then
-  UNAME=${UNAME-`uname 2>/dev/null`}
-  case X$UNAME in
-    *-DOS) lt_cv_sys_path_separator=';' ;;
-    *)     lt_cv_sys_path_separator=':' ;;
-  esac
-  PATH_SEPARATOR=$lt_cv_sys_path_separator
-fi
-])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
-
-# _LT_AC_PROG_ECHO_BACKSLASH
-# --------------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
-[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-			      [AC_DIVERT_PUSH(NOTICE)])
-_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-echo=${ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
 
 if test -z "$ECHO"; then
 if test "X${echo_test_string+set}" != Xset; then
@@ -473,8 +335,9 @@
   #
   # So, first we look for a working echo in the user's PATH.
 
-  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
   for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
     if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
        test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
        echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
@@ -483,7 +346,7 @@
       break
     fi
   done
-  IFS="$save_ifs"
+  IFS="$lt_save_ifs"
 
   if test "X$echo" = Xecho; then
     # We didn't find a better echo, so look for alternatives.
@@ -556,17 +419,298 @@
 fi
 
 AC_SUBST(ECHO)
-AC_DIVERT_POP
-])# _LT_AC_PROG_ECHO_BACKSLASH
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+	[avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test ! -s conftest.err; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+ *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+	       = "XX$teststring") >/dev/null 2>&1 &&
+	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
+	    lt_cv_sys_max_cmd_len=$new_result &&
+	    test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
 
 # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
 #                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
 # ------------------------------------------------------------------
 AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
-[if test "$cross_compiling" = yes; then :
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
   [$4]
 else
-  AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
[truncated at 1000 lines; 7433 more skipped]

reactos/lib/freetype/builds/unix
config.guess 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- config.guess	15 Feb 2004 21:45:28 -0000	1.4
+++ config.guess	10 May 2004 17:48:23 -0000	1.5
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-01-10'
+timestamp='2004-03-12'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,6 +106,7 @@
 : ${TMPDIR=/tmp} ;
  { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
 dummy=$tmp/dummy ;
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
@@ -196,12 +197,18 @@
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit 0 ;;
+    amd64:OpenBSD:*:*)
+	echo x86_64-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     amiga:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
     arc:OpenBSD:*:*)
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    cats:OpenBSD:*:*)
+	echo arm-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     hp300:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -220,6 +227,9 @@
     mvmeppc:OpenBSD:*:*)
 	echo powerpc-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    pegasos:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     pmax:OpenBSD:*:*)
 	echo mipsel-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -235,73 +245,70 @@
     *:OpenBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    *:MicroBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit 0 ;;
     alpha:OSF1:*:*)
-	if test $UNAME_RELEASE = "V4.0"; then
+	case $UNAME_RELEASE in
+	*4.0)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-	fi
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	eval $set_cc_for_build
-	cat <<EOF >$dummy.s
-	.data
-\$Lformat:
-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
-
-	.text
-	.globl main
-	.align 4
-	.ent main
-main:
-	.frame \$30,16,\$26,0
-	ldgp \$29,0(\$27)
-	.prologue 1
-	.long 0x47e03d80 # implver \$0
-	lda \$2,-1
-	.long 0x47e20c21 # amask \$2,\$1
-	lda \$16,\$Lformat
-	mov \$0,\$17
-	not \$1,\$18
-	jsr \$26,printf
-	ldgp \$29,0(\$26)
-	mov 0,\$16
-	jsr \$26,exit
-	.end main
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
-	if test "$?" = 0 ; then
-		case `$dummy` in
-			0-0)
-				UNAME_MACHINE="alpha"
-				;;
-			1-0)
-				UNAME_MACHINE="alphaev5"
-				;;
-			1-1)
-				UNAME_MACHINE="alphaev56"
-				;;
-			1-101)
-				UNAME_MACHINE="alphapca56"
-				;;
-			2-303)
-				UNAME_MACHINE="alphaev6"
-				;;
-			2-307)
-				UNAME_MACHINE="alphaev67"
-				;;
-			2-1307)
-				UNAME_MACHINE="alphaev68"
-				;;
-			3-1307)
-				UNAME_MACHINE="alphaev7"
-				;;
-		esac
-	fi
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+	echo alpha-hp-vms
 	exit 0 ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
@@ -324,6 +331,9 @@
     *:OS/390:*:*)
 	echo i370-ibm-openedition
 	exit 0 ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit 0;;
@@ -341,6 +351,9 @@
     NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit 0 ;;
     DRS?6000:UNIX_SV:4.2*:7*)
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7 && exit 0 ;;
@@ -413,6 +426,9 @@
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
         exit 0 ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
@@ -748,7 +764,7 @@
 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     *:UNICOS/mp:*:*)
-	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
+	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@@ -756,6 +772,11 @@
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
         exit 0 ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit 0 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
@@ -777,7 +798,10 @@
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
+	# FreeBSD's kernel, but not the complete OS.
+	case ${LIBC} in gnu) kernel_only='k' ;; esac
+	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
 	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -788,8 +812,8 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit 0 ;;
-    x86:Interix*:3*)
-	echo i586-pc-interix3
+    x86:Interix*:[34]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
 	exit 0 ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -810,17 +834,28 @@
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
     *:GNU:*:*)
+	# the GNU system
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit 0 ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit 0 ;;
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit 0 ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
@@ -896,6 +931,9 @@
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit 0 ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
@@ -953,6 +991,9 @@
 	LIBC=gnuaout
 	#endif
 	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
 	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
@@ -983,6 +1024,9 @@
     i*86:atheos:*:*)
 	echo ${UNAME_MACHINE}-unknown-atheos
 	exit 0 ;;
+	i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit 0 ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
@@ -1054,7 +1098,7 @@
 	exit 0 ;;
     M68*:*:R3V[567]*:*)
 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1169,7 +1213,7 @@
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+    NSR-?:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     *:NonStop-UX:*:*)
@@ -1210,6 +1254,12 @@
     *:ITS:*:*)
 	echo pdp10-unknown-its
 	exit 0 ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit 0 ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2

reactos/lib/freetype/builds/unix
config.sub 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- config.sub	15 Feb 2004 21:45:28 -0000	1.4
+++ config.sub	10 May 2004 17:48:23 -0000	1.5
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-01-03'
+timestamp='2004-03-12'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -118,7 +118,8 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -228,14 +229,15 @@
 	| a29k \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| clipper \
+	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
-	| ip2k \
-	| m32r | m68000 | m68k | m88k | mcore \
+	| ip2k | iq2000 \
+	| m32r | m32rle | m68000 | m68k | m88k | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -247,6 +249,7 @@
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
@@ -257,11 +260,11 @@
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
 	| strongarm \
-	| tahoe | thumb | tic80 | tron \
+	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xscale | xstormy16 | xtensa \
@@ -296,7 +299,7 @@
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* \
 	| bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
@@ -304,8 +307,8 @@
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* \
-	| m32r-* \
+	| ip2k-* | iq2000-* \
+	| m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -319,6 +322,7 @@
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
@@ -329,11 +333,13 @@
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
-	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -357,6 +363,9 @@
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
 	adobe68k)
 		basic_machine=m68010-adobe
 		os=-scout
@@ -371,6 +380,12 @@
 		basic_machine=a29k-none
 		os=-bsd
 		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	amdahl)
 		basic_machine=580-amdahl
 		os=-sysv
@@ -430,12 +445,20 @@
 		basic_machine=j90-cray
 		os=-unicos
 		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
@@ -735,6 +758,10 @@
 		basic_machine=or32-unknown
 		os=-coff
 		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
@@ -766,18 +793,24 @@
 	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
-	pentiumii | pentium2)
+	pentiumii | pentium2 | pentiumiii | pentium3)
 		basic_machine=i686-pc
 		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumii-* | pentium2-*)
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pn)
 		basic_machine=pn-gould
 		;;
@@ -836,6 +869,10 @@
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -843,6 +880,9 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
 	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
@@ -917,14 +957,18 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-        tic4x | c4x*)
-		basic_machine=tic4x-unknown
-		os=-coff
-		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
 		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -938,6 +982,10 @@
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
 	udi29k)
 		basic_machine=a29k-amd
 		os=-udi
@@ -1027,13 +1075,13 @@
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
-	sparc | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1106,19 +1154,20 @@
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -microbsd*)
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1142,6 +1191,9 @@
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -1154,6 +1206,9 @@
 	-opened*)
 		os=-openedition
 		;;
+        -os400*)
+		os=-os400
+		;;
 	-wince*)
 		os=-wince
 		;;
@@ -1175,6 +1230,9 @@
 	-atheos*)
 		os=-atheos
 		;;
+	-syllable*)
+		os=-syllable
+		;;
 	-386bsd)
 		os=-bsd
 		;;
@@ -1197,6 +1255,9 @@
 	-sinix*)
 		os=-sysv4
 		;;
+        -tpf*)
+		os=-tpf
+		;;
 	-triton*)
 		os=-sysv3
 		;;
@@ -1227,6 +1288,12 @@
 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 		os=-mint
 		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
 	-none)
 		;;
 	*)
@@ -1258,6 +1325,9 @@
 	arm*-semi)
 		os=-aout
 		;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
@@ -1436,9 +1506,15 @@
 			-mvs* | -opened*)
 				vendor=ibm
 				;;
+			-os400*)
+				vendor=ibm
+				;;
 			-ptx*)
 				vendor=sequent
 				;;
+			-tpf*)
+				vendor=ibm
+				;;
 			-vxsim* | -vxworks* | -windiss*)
 				vendor=wrs
 				;;

reactos/lib/freetype/builds/unix
configure 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- configure	15 Feb 2004 21:45:28 -0000	1.5
+++ configure	10 May 2004 17:48:23 -0000	1.6
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.54.
+# Generated by GNU Autoconf 2.59a.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -20,15 +20,62 @@
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
 fi
 
 
+# Find who we are.  Look in the path if we contain no path at all
+# relative or not.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
 $as_unset ENV MAIL MAILPATH
 PS1='$ '
@@ -36,9 +83,12 @@
 PS4='+ '
 
 # NLS nuisances.
-for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
     $as_unset $as_var
@@ -72,101 +122,277 @@
   	  s/.*/./; q'`
 
 
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conftest.sh
-  echo  "exit 0"   >>conftest.sh
-  chmod +x conftest.sh
-  if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conftest.sh
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
 fi
 
+  if test $as_have_required = yes && 	 (eval ":
+(func_return () {
+  (exit \$1)
+}
+func_success () {
+  func_return 0
+}
+func_failure () {
+  func_return 1
+}
+func_ret_success () {
+  return 0
+}
+func_ret_failure () {
+  return 1
+}
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+exitcode=0
+if func_success; then
+  :
+else
+  exitcode=1
+  echo func_failure succeeded.
+fi
 
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
+if func_failure; then
+  exitcode=1
+  echo func_success failed.
+fi
+
+if func_ret_success; then
+  :
+else
+  exitcode=1
+  echo func_ret_success failed.
+fi
+
+if func_ret_failure; then
+  exitcode=1
+  echo func_ret_failure succeeded.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  as_lineno_3=\`(expr \$as_lineno_1 + 1) 2>/dev/null\`
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\$as_lineno_3\"  = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells="$SHELL"
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-	 case $as_dir in
+  case $as_dir in
 	 /*)
-	   if ("$as_dir/$as_base" -c '
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done
+       esac
+done
+
+
+      for as_shell in $as_candidate_shells; do
+	 if { $as_shell 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { $as_shell 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(func_return () {
+  (exit $1)
+}
+func_success () {
+  func_return 0
+}
+func_failure () {
+  func_return 1
+}
+func_ret_success () {
+  return 0
+}
+func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if func_success; then
+  :
+else
+  exitcode=1
+  echo func_failure succeeded.
+fi
+
+if func_failure; then
+  exitcode=1
+  echo func_success failed.
+fi
+
+if func_ret_success; then
+  :
+else
+  exitcode=1
+  echo func_ret_success failed.
+fi
+
+if func_ret_failure; then
+  exitcode=1
+  echo func_ret_failure succeeded.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
   as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-	     CONFIG_SHELL=$as_dir/$as_base
-	     export CONFIG_SHELL
-	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-	   fi;;
-	 esac
-       done
-done
-;;
-  esac
+  test "x$as_lineno_3"  = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+        $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "func_return () {
+  (exit \$1)
+}
+func_success () {
+  func_return 0
+}
+func_failure () {
+  func_return 1
+}
+func_ret_success () {
+  return 0
+}
+func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if func_success; then
+  :
+else
+  exitcode=1
+  echo func_failure succeeded.
+fi
+
+if func_failure; then
+  exitcode=1
+  echo func_success failed.
+fi
+
+if func_ret_success; then
+  :
+else
+  exitcode=1
+  echo func_ret_success failed.
+fi
+
+if func_ret_failure; then
+  exitcode=1
+  echo func_ret_failure succeeded.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s,[$]LINENO.*,&-,
+      t lineno
+      b
+      : lineno
       N
-      s,$,-,
       : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      s,[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\),\2\1\2,
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s,-\n.*,,
     ' >$as_me.lineno &&
   chmod +x $as_me.lineno ||
     { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
@@ -215,16 +441,17 @@
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 # IFS
@@ -237,17 +464,6 @@
 $as_unset CDPATH
 
 
-# Find the correct PATH separator.  Usually this is `:', but
-# DJGPP uses `;' like DOS.
-if test "X${PATH_SEPARATOR+set}" != Xset; then
-  UNAME=${UNAME-`uname 2>/dev/null`}
-  case X$UNAME in
-    *-DOS) lt_cv_sys_path_separator=';' ;;
-    *)     lt_cv_sys_path_separator=':' ;;
-  esac
-  PATH_SEPARATOR=$lt_cv_sys_path_separator
-fi
-
 
 # Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
@@ -266,7 +482,7 @@
 elif test "X$1" = X--fallback-echo; then
   # Avoid inline document here, it may be left over
   :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
   # Yippee, $echo works!
   :
 else
@@ -278,7 +494,7 @@
   # used as fallback echo
   shift
   cat <<EOF
-
+$*
 EOF
   exit 0
 fi
@@ -312,8 +528,9 @@
   #
   # So, first we look for a working echo in the user's PATH.
 
-  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
   for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
     if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
        test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
        echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
@@ -322,7 +539,7 @@
       break
     fi
   done
-  IFS="$save_ifs"
+  IFS="$lt_save_ifs"
 
   if test "X$echo" = Xecho; then
     # We didn't find a better echo, so look for alternatives.
@@ -396,6 +613,11 @@
 
 
 
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
@@ -455,16 +677,15 @@
 #endif
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 #if HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS version_info ft_version build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP XX_CFLAGS XX_ANSIFLAGS RMF RMDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP FTSYS_SRC LIBZ SYSTEM_ZLIB LN_S ECHO RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LIBTOOL LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS version_info ft_version build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP XX_CFLAGS XX_ANSIFLAGS RMF RMDIR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA GREP EGREP FTSYS_SRC LIBZ SYSTEM_ZLIB LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL enable_shared hardcode_libdir_flag_spec wl LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -823,7 +1044,7 @@
 
 # Be sure to have absolute paths.
 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-              localstatedir libdir includedir oldincludedir infodir mandir
+	      localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
@@ -863,10 +1084,10 @@
   # Try the directory containing this script, then its parent.
   ac_confdir=`(dirname "$0") 2>/dev/null ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$0" : 'X\(//\)[^/]' \| \
-         X"$0" : 'X\(//\)$' \| \
-         X"$0" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$0" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
   	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -925,6 +1146,26 @@
 ac_env_CPP_value=$CPP
 ac_cv_env_CPP_set=${CPP+set}
 ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
+ac_env_F77_set=${F77+set}
+ac_env_F77_value=$F77
+ac_cv_env_F77_set=${F77+set}
+ac_cv_env_F77_value=$F77
+ac_env_FFLAGS_set=${FFLAGS+set}
+ac_env_FFLAGS_value=$FFLAGS
+ac_cv_env_FFLAGS_set=${FFLAGS+set}
+ac_cv_env_FFLAGS_value=$FFLAGS
 
 #
 # Report the --help message.
@@ -958,9 +1199,9 @@
   cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
+			  [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
+			  [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -1000,18 +1241,24 @@
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-shared=PKGS  build shared libraries default=yes
-  --enable-static=PKGS  build static libraries default=yes
-  --enable-fast-install=PKGS  optimize for fast installation default=yes
+  --enable-shared[=PKGS]
+                          build shared libraries [default=yes]
+  --enable-static[=PKGS]
+                          build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --without-zlib          use internal zlib instead of system-wide
-  --with-old-mac-fonts    allow Mac resource-based fonts to be used
-  --with-gnu-ld           assume the C compiler uses GNU ld default=no
-  --with-pic              try to use only PIC/non-PIC objects default=use both
+    --without-zlib          use internal zlib instead of system-wide
+    --with-old-mac-fonts    allow Mac resource-based fonts to be used
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]
+                          include additional configurations [automatic]
 
 Some influential environment variables:
   CC          C compiler command
@@ -1021,6 +1268,11 @@
   CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
               headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1058,12 +1310,45 @@
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
 
     cd $ac_dir
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -1074,7 +1359,7 @@
       echo
       $SHELL $ac_srcdir/configure  --help=recursive
     elif test -f $ac_srcdir/configure.ac ||
-           test -f $ac_srcdir/configure.in; then
+	   test -f $ac_srcdir/configure.in; then
       echo
       $ac_configure --help
     else
@@ -1088,8 +1373,8 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
+2003, 2004 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1101,7 +1386,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.54.  Invocation command line was
+generated by GNU Autoconf 2.59a.  Invocation command line was
 
   $ $0 $@
 
@@ -1153,24 +1438,54 @@
 
 # Keep a trace of the command line.
 # Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
 # Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
 ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
 ac_sep=
-for ac_arg
+ac_must_keep_next=false
+for ac_pass in 1 2
 do
-  case $ac_arg in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n ) continue ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    continue ;;
-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-  esac
-  ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-  # Get rid of the leading space.
-  ac_sep=" "
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
 done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
 
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
@@ -1194,12 +1509,12 @@
     case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
     *ac_space=\ *)
       sed -n \
-        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
       ;;
     *)
       sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
 }
@@ -1228,7 +1543,7 @@
       for ac_var in $ac_subst_files
       do
 	eval ac_val=$`echo $ac_var`
-        echo "$ac_var='"'"'$ac_val'"'"'"
+	echo "$ac_var='"'"'$ac_val'"'"'"
       done | sort
       echo
     fi
@@ -1247,8 +1562,8 @@
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core core.* *.core &&
-  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+  rm -f core *.core &&
+  rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
      ' 0
 for ac_signal in 1 2 13 15; do
@@ -1257,9 +1572,11 @@
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
+rm -f -r conftest* confdefs.h
 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+# NextStep 3.3 (patch 3) loses unless the first echo outputs at least 14 bytes.
+ac_space=' '
+echo "$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space$ac_space" >confdefs.h
 
 # Predefined preprocessor variables.
 
@@ -1327,7 +1644,7 @@
 # value.
 ac_cache_corrupted=false
 for ac_var in `(set) 2>&1 |
-               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
   eval ac_new_set=\$ac_env_${ac_var}_set
   eval ac_old_val="\$ac_cv_env_${ac_var}_value"
@@ -1344,13 +1661,13 @@
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
-        ac_cache_corrupted=:
+	ac_cache_corrupted=:
       fi;;
   esac
   # Pass precious variables to config.status.
@@ -1400,14 +1717,17 @@
 
 
 
-          ac_config_headers="$ac_config_headers ftconfig.h:ftconfig.in"
 
+# Don't forget to update docs/VERSION.DLL!
 
-version_info='9:4:3'
+version_info='9:6:3'
 
 ft_version=`echo $version_info | tr : .`
 
 
+
+# checks for system type
+
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   if test -f $ac_dir/install-sh; then
@@ -1516,6 +1836,9 @@
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
+
+# checks for programs
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1595,7 +1918,19 @@
 echo "${ECHO_T}no" >&6
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    if test "$build" != "$host"; then
+      { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+    fi
+    CC=$ac_ct_CC
+  fi
 else
   CC="$ac_cv_prog_CC"
 fi
@@ -1675,7 +2010,19 @@
 echo "${ECHO_T}no" >&6
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    if test "$build" != "$host"; then
+      { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+    fi
+    CC=$ac_ct_CC
+  fi
 else
   CC="$ac_cv_prog_CC"
 fi
@@ -1819,14 +2166,28 @@
   test -n "$ac_ct_CC" && break
 done
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    if test "$build" != "$host"; then
+      { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+    fi
+    CC=$ac_ct_CC
+  fi
 fi
 
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
@@ -1850,8 +2211,11 @@
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
[truncated at 1000 lines; 22035 more skipped]

reactos/lib/freetype/builds/unix
configure.ac 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- configure.ac	15 Feb 2004 21:45:28 -0000	1.5
+++ configure.ac	10 May 2004 17:48:23 -0000	1.6
@@ -1,91 +1,121 @@
-dnl This file is part of the FreeType project.
-dnl
-dnl Process this file with autoconf to produce a configure script.
-dnl
+# This file is part of the FreeType project.
+#
+# Process this file with autoconf to produce a configure script.
 
 AC_INIT
 AC_CONFIG_SRCDIR([ftconfig.in])
 
-dnl configuration file -- stay in 8.3 limit
-AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
 
-dnl Don't forget to update VERSION.DLL!
-version_info='9:4:3'
-AC_SUBST(version_info)
+# Don't forget to update docs/VERSION.DLL!
+
+version_info='9:6:3'
+AC_SUBST([version_info])
 ft_version=`echo $version_info | tr : .`
-AC_SUBST(ft_version)
+AC_SUBST([ft_version])
+
+
+# checks for system type
+
+AC_CANONICAL_TARGET
 
-dnl checks for system type
-AC_CANONICAL_TARGET([])
 
-dnl checks for programs
+# checks for programs
+
 AC_PROG_CC
 AC_PROG_CPP
 
-dnl get Compiler flags right.
+
+# get compiler flags right
+
 if test "x$CC" = xgcc; then
   XX_CFLAGS="-Wall"
   XX_ANSIFLAGS="-pedantic -ansi"
 else
   case "$host" in
-    *-dec-osf*)
-      CFLAGS=
-      XX_CFLAGS="-std1 -g3"
-      XX_ANSIFLAGS=
-      ;;
-    *)
-      XX_CFLAGS=
-      XX_ANSIFLAGS=
-      ;;
+  *-dec-osf*)
+    CFLAGS=
+    XX_CFLAGS="-std1 -g3"
+    XX_ANSIFLAGS=
+    ;;
+  *)
+    XX_CFLAGS=
+    XX_ANSIFLAGS=
+    ;;
   esac
 fi
-AC_SUBST(XX_CFLAGS)
-AC_SUBST(XX_ANSIFLAGS)
+AC_SUBST([XX_CFLAGS])
+AC_SUBST([XX_ANSIFLAGS])
+
+
+# auxiliary programs
+
+AC_CHECK_PROG([RMF], [rm], [rm -f])
+AC_CHECK_PROG([RMDIR], [rmdir], [rmdir])
 
-AC_CHECK_PROG(RMF, rm, rm -f)
-AC_CHECK_PROG(RMDIR, rmdir, rmdir)
 
-dnl Since this file will be finally moved to another directory we make
-dnl the path of the install script absolute.  This small code snippet has
-dnl been taken from automake's `ylwrap' script.
+# Since this file will be finally moved to another directory we make
+# the path of the install script absolute.  This small code snippet has
+# been taken from automake's `ylwrap' script.
+
 AC_PROG_INSTALL
 case "$INSTALL" in
-  /*)
-    ;;
-  */*)
-    INSTALL="`pwd`/$INSTALL" ;;
+/*)
+  ;;
+*/*)
+  INSTALL="`pwd`/$INSTALL" ;;
 esac
 
-dnl checks for header files
+
+# checks for header files
+
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h unistd.h)
+AC_CHECK_HEADERS([fcntl.h unistd.h])
+
+
+# checks for typedefs, structures, and compiler characteristics
 
-dnl checks for typedefs, structures, and compiler characteristics
 AC_C_CONST
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF([int])
+AC_CHECK_SIZEOF([long])
+
 
-dnl checks for library functions
+# checks for library functions
+
+# Here we check whether we can use our mmap file component.
 
-dnl Here we check whether we can use our mmap file component.
 AC_FUNC_MMAP
 if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
   FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
 else
   FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
 
-  FT_MUNMAP_DECL
+  AC_CHECK_DECLS([munmap],
+    [],
+    [],
+    [
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/mman.h>
+
+    ])
+
   FT_MUNMAP_PARAM
 fi
-AC_SUBST(FTSYS_SRC)
+AC_SUBST([FTSYS_SRC])
 
-AC_CHECK_FUNCS(memcpy memmove)
+AC_CHECK_FUNCS([memcpy memmove])
 
-dnl Check for system zlib
-AC_ARG_WITH(zlib,
-  [  --without-zlib          use internal zlib instead of system-wide])
+
+# Check for system zlib
+
+AC_ARG_WITH([zlib],
+  dnl don't quote AS_HELP_STRING!
+  AS_HELP_STRING([--without-zlib],
+                 [use internal zlib instead of system-wide]))
 if test x$with_zlib != xno && test -z "$LIBZ"; then
-  AC_CHECK_LIB(z, gzsetparams, [AC_CHECK_HEADER(zlib.h, LIBZ='-lz')])
+  AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
 fi
 if test x$with_zlib != xno && test -n "$LIBZ"; then
   CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
@@ -93,36 +123,56 @@
   SYSTEM_ZLIB=yes
 fi
 
-dnl Whether to use Mac OS resource-based fonts or not
-AC_ARG_WITH(old-mac-fonts,
-  [  --with-old-mac-fonts    allow Mac resource-based fonts to be used])
+
+# Whether to use Mac OS resource-based fonts or not
+
+AC_ARG_WITH([old-mac-fonts],
+  dnl don't quote AS_HELP_STRING!
+  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"
   LDFLAGS="$LDFLAGS -Xlinker -framework -Xlinker CoreServices \
                     -Xlinker -framework -Xlinker ApplicationServices"
 else
   CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
 fi
 
-AC_SUBST(LIBZ)
-AC_SUBST(CFLAGS)
-AC_SUBST(LDFLAGS)
-AC_SUBST(SYSTEM_ZLIB)
 
-AC_PROG_LIBTOOL
+AC_SUBST([LIBZ])
+AC_SUBST([CFLAGS])
+AC_SUBST([LDFLAGS])
+AC_SUBST([SYSTEM_ZLIB])
+
 
-dnl create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
-dnl and 'builds/unix/unix-cc.mk' that will be used by the build system
-dnl
+AC_PROG_LIBTOOL
+# urgh -- these are internal libtool variables...
+AC_SUBST([enable_shared])
+AC_SUBST([hardcode_libdir_flag_spec])
+AC_SUBST([wl])
+
+
+# configuration file -- stay in 8.3 limit
+#
+# since #undef doesn't survive in configuration header files we replace
+# `/undef' with `#undef' after creating the output file
+
+AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
+  [mv ftconfig.h ftconfig.tmp
+   sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
+   rm ftconfig.tmp])
+
+# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
+# and 'builds/unix/unix-cc.mk' that will be used by the build system
+#
 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
                  unix-def.mk:unix-def.in
                  freetype-config
                  freetype2.pc:freetype2.in])
 
-dnl re-generate the Jamfile to use libtool now
-dnl
-dnl AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
+# re-generate the Jamfile to use libtool now
+#
+# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
 
 AC_OUTPUT
 
-dnl end of configure.ac
+# end of configure.ac

reactos/lib/freetype/builds/unix
detect.mk 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- detect.mk	21 Jan 2004 19:23:45 -0000	1.2
+++ detect.mk	10 May 2004 17:48:23 -0000	1.3
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2003 by
+# Copyright 1996-2000, 2002, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -66,7 +66,7 @@
       # platform).
       #
       CONFIG_FILE := unix.mk
-      setup: unix-def.mk
+      setup: $(BUILD_DIR)/unix-def.mk
       unix: setup
       .PHONY: unix
     endif
@@ -77,10 +77,10 @@
   have_mk := $(strip $(wildcard $(OBJ_DIR)/Makefile))
   ifneq ($(have_mk),)
     # we are building FT2 not in the src tree
-    unix-def.mk: $(TOP_DIR)/builds/unix/unix-def.in
+    $(BUILD_DIR)/unix-def.mk: $(TOP_DIR)/builds/unix/unix-def.in
 	    $(TOP_DIR)/builds/unix/configure $(CFG)
   else
-    unix-def.mk: $(TOP_DIR)/builds/unix/unix-def.in
+    $(BUILD_DIR)/unix-def.mk: $(TOP_DIR)/builds/unix/unix-def.in
 	    cd builds/unix; ./configure $(CFG)
   endif
 

reactos/lib/freetype/builds/unix
freetype-config.in 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- freetype-config.in	21 Jan 2004 19:23:45 -0000	1.3
+++ freetype-config.in	10 May 2004 17:48:23 -0000	1.4
@@ -2,18 +2,31 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+exec_prefix_set=no
+includedir=@includedir@
+libdir=@libdir@
+enable_shared=@enable_shared@
+wl=@wl@
+hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@'
 
 usage()
 {
   cat <<EOF
-Usage: freetype-config [OPTIONS] [LIBRARIES]
+Usage: freetype-config [OPTION]...
+Get FreeType compilation and linking information.
+
 Options:
- [--prefix[=DIR]]
- [--exec-prefix[=DIR]]
- [--version]
- [--libs]
- [--libtool]
- [--cflags]
+  --prefix               display \`--prefix' value used for building the
+                         FreeType library
+  --prefix=PREFIX        override \`--prefix' value with PREFIX
+  --exec-prefix          display \`--exec-prefix' value used for building
+                         the FreeType library
+  --exec-prefix=EPREFIX  override \`--exec-prefix' value with EPREFIX
+  --version              display libtool version of the FreeType library
+  --libs                 display flags for linking with the FreeType library
+  --libtool              display library name for linking with libtool
+  --cflags               display flags for compiling with the FreeType
+                         library
 EOF
   exit $1
 }
@@ -24,8 +37,12 @@
 
 while test $# -gt 0 ; do
   case "$1" in
-  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
+  -*=*)
+    optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
+    ;;
+  *)
+    optarg=
+    ;;
   esac
 
   case $1 in
@@ -65,40 +82,53 @@
 done
 
 if test "$local_prefix" = "yes" ; then
-    if test "$exec_prefix_set" != "yes" ; then
-      exec_prefix=$prefix
-    fi
+  if test "$exec_prefix_set" != "yes" ; then
+    exec_prefix=$prefix
+  fi
 fi
 
 if test "$echo_prefix" = "yes" ; then
- echo $prefix
+  echo $prefix
 fi
 
 if test "$echo_exec_prefix" = "yes" ; then
- echo $exec_prefix
+  echo $exec_prefix
+fi
+
+if test "$exec_prefix_set" = "yes" ; then
+  libdir=$exec_prefix/lib
+else
+  if test "$local_prefix" = "yes" ; then
+    includedir=$prefix/include
+    libdir=$prefix/lib
+  fi
 fi
 
 if test "$echo_cflags" = "yes" ; then
- cflags="-I@includedir@/freetype2"
- if test "@includedir@" != "/usr/include" ; then
-  echo $cflags -I@includedir@
- else
-  echo $cflags
- fi
+  cflags="-I$includedir/freetype2"
+  if test "$includedir" != "/usr/include" ; then
+    echo $cflags -I$includedir
+  else
+    echo $cflags
+  fi
 fi
 
 if test "$echo_libs" = "yes" ; then
- libs="-lfreetype @LIBZ@"
- if test "@libdir@" != "/usr/lib" ; then
-  echo -L@libdir@ $libs
- else
-  echo $libs
- fi
+  rpath=
+  if test "$enable_shared" = "yes" ; then
+    eval "rpath=\"$hardcode_libdir_flag_spec\""
+  fi
+  libs="-lfreetype @LIBZ@"
+  if test "$libdir" != "/usr/lib" ; then
+    echo -L$libdir $rpath $libs
+  else
+    echo $libs
+  fi
 fi
 
 if test "$echo_libtool" = "yes" ; then
- convlib="libfreetype.la"
- echo @libdir@/$convlib
+  convlib="libfreetype.la"
+  echo $libdir/$convlib
 fi
 
 # EOF

reactos/lib/freetype/builds/unix
freetype2.m4 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- freetype2.m4	15 Feb 2004 21:45:28 -0000	1.3
+++ freetype2.m4	10 May 2004 17:48:23 -0000	1.4
@@ -1,88 +1,104 @@
 # Configure paths for FreeType2
 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
+#
+# serial 2
+
+# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
+# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
+# FreeType 2.0.4).
+#
+AC_DEFUN([AC_CHECK_FT2],
+  [# Get the cflags and libraries from the freetype-config script
+   #
+   AC_ARG_WITH([ft-prefix],
+     dnl don't quote AS_HELP_STRING!
+     AS_HELP_STRING([--with-ft-prefix=PREFIX],
+                    [Prefix where FreeType is installed (optional)]),
+     [ft_config_prefix="$withval"],
+     [ft_config_prefix=""])
+
+   AC_ARG_WITH([ft-exec-prefix],
+     dnl don't quote AS_HELP_STRING!
+     AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
+                    [Exec prefix where FreeType is installed (optional)]),
+     [ft_config_exec_prefix="$withval"],
+     [ft_config_exec_prefix=""])
+
+   AC_ARG_ENABLE([freetypetest],
+     dnl don't quote AS_HELP_STRING!
+     AS_HELP_STRING([--disable-freetypetest],
+                    [Do not try to compile and run a test FreeType program]),
+     [],
+     [enable_fttest=yes])
+
+   if test x$ft_config_exec_prefix != x ; then
+     ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
+     if test x${FT2_CONFIG+set} != xset ; then
+       FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
+     fi
+   fi
+
+   if test x$ft_config_prefix != x ; then
+     ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
+     if test x${FT2_CONFIG+set} != xset ; then
+       FT2_CONFIG=$ft_config_prefix/bin/freetype-config
+     fi
+   fi
+
+   AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
+
+   min_ft_version=m4_if([$1], [], [7.0.1], [$1])
+   AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
+   no_ft=""
+   if test "$FT2_CONFIG" = "no" ; then
+     no_ft=yes
+   else
+     FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
+     FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
+     ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+     ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+     ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+     ft_min_major_version=`echo $min_ft_version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+     ft_min_minor_version=`echo $min_ft_version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+     ft_min_micro_version=`echo $min_ft_version | \
+       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+     if test x$enable_fttest = xyes ; then
+       ft_config_is_lt=""
+       if test $ft_config_major_version -lt $ft_min_major_version ; then
+         ft_config_is_lt=yes
+       else
+         if test $ft_config_major_version -eq $ft_min_major_version ; then
+           if test $ft_config_minor_version -lt $ft_min_minor_version ; then
+             ft_config_is_lt=yes
+           else
+             if test $ft_config_minor_version -eq $ft_min_minor_version ; then
+               if test $ft_config_micro_version -lt $ft_min_micro_version ; then
+                 ft_config_is_lt=yes
+               fi
+             fi
+           fi
+         fi
+       fi
+       if test x$ft_config_is_lt = xyes ; then
+         no_ft=yes
+       else
+         ac_save_CFLAGS="$CFLAGS"
+         ac_save_LIBS="$LIBS"
+         CFLAGS="$CFLAGS $FT2_CFLAGS"
+         LIBS="$FT2_LIBS $LIBS"
+
+         #
+         # Sanity checks for the results of freetype-config to some extent.
+         #
+         AC_RUN_IFELSE([
+             AC_LANG_SOURCE([[
 
-dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
-dnl
-AC_DEFUN(AC_CHECK_FT2,
-[dnl
-dnl Get the cflags and libraries from the freetype-config script
-dnl
-AC_ARG_WITH(ft-prefix,
-[  --with-ft-prefix=PREFIX
-                          Prefix where FreeType is installed (optional)],
-            ft_config_prefix="$withval", ft_config_prefix="")
-AC_ARG_WITH(ft-exec-prefix,
-[  --with-ft-exec-prefix=PREFIX
-                          Exec prefix where FreeType is installed (optional)],
-            ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
-AC_ARG_ENABLE(freetypetest,
-[  --disable-freetypetest  Do not try to compile and run
-                          a test FreeType program],
-              [], enable_fttest=yes)
-
-if test x$ft_config_exec_prefix != x ; then
-  ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
-  if test x${FT2_CONFIG+set} != xset ; then
-    FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
-  fi
-fi
-if test x$ft_config_prefix != x ; then
-  ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
-  if test x${FT2_CONFIG+set} != xset ; then
-    FT2_CONFIG=$ft_config_prefix/bin/freetype-config
-  fi
-fi
-AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
-
-min_ft_version=ifelse([$1], ,6.1.0,$1)
-AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
-no_ft=""
-if test "$FT2_CONFIG" = "no" ; then
-  no_ft=yes
-else
-  FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
-  FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
-  ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-  ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-  ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-  ft_min_major_version=`echo $min_ft_version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-  ft_min_minor_version=`echo $min_ft_version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-  ft_min_micro_version=`echo $min_ft_version | \
-         sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-  if test x$enable_fttest = xyes ; then
-    ft_config_is_lt=""
-    if test $ft_config_major_version -lt $ft_min_major_version ; then
-      ft_config_is_lt=yes
-    else
-      if test $ft_config_major_version -eq $ft_min_major_version ; then
-        if test $ft_config_minor_version -lt $ft_min_minor_version ; then
-          ft_config_is_lt=yes
-        else
-          if test $ft_config_minor_version -eq $ft_min_minor_version ; then
-            if test $ft_config_micro_version -lt $ft_min_micro_version ; then
-              ft_config_is_lt=yes
-            fi
-          fi
-        fi
-      fi
-    fi
-    if test x$ft_config_is_lt = xyes ; then
-      no_ft=yes
-    else
-      ac_save_CFLAGS="$CFLAGS"
-      ac_save_LIBS="$LIBS"
-      CFLAGS="$CFLAGS $FT2_CFLAGS"
-      LIBS="$FT2_LIBS $LIBS"
-dnl
-dnl Sanity checks for the results of freetype-config to some extent
-dnl
-      AC_TRY_RUN([
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include <stdio.h>
@@ -92,7 +108,7 @@
 main()
 {
   FT_Library library;
-  FT_Error error;
+  FT_Error  error;
 
   error = FT_Init_FreeType(&library);
 
@@ -104,40 +120,59 @@
     return 0;
   }
 }
-],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-      CFLAGS="$ac_save_CFLAGS"
-      LIBS="$ac_save_LIBS"
-    fi             # test $ft_config_version -lt $ft_min_version
-  fi               # test x$enable_fttest = xyes
-fi                 # test "$FT2_CONFIG" = "no"
-if test x$no_ft = x ; then
-   AC_MSG_RESULT(yes)
-   ifelse([$2], , :, [$2])
-else
-   AC_MSG_RESULT(no)
-   if test "$FT2_CONFIG" = "no" ; then
-     echo "*** The freetype-config script installed by FreeType 2 could not be found."
-     echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
-     echo "*** your path, or set the FT2_CONFIG environment variable to the"
-     echo "*** full path to freetype-config."
+
+             ]])
+           ],
+           [],
+           [no_ft=yes],
+           [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
+
+         CFLAGS="$ac_save_CFLAGS"
+         LIBS="$ac_save_LIBS"
+       fi             # test $ft_config_version -lt $ft_min_version
+     fi               # test x$enable_fttest = xyes
+   fi                 # test "$FT2_CONFIG" = "no"
+
+   if test x$no_ft = x ; then
+     AC_MSG_RESULT([yes])
+     m4_if([$2], [], [:], [$2])
    else
-     if test x$ft_config_is_lt = xyes ; then
-       echo "*** Your installed version of the FreeType 2 library is too old."
-       echo "*** If you have different versions of FreeType 2, make sure that"
-       echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix"
-       echo "*** are used, or set the FT2_CONFIG environment variable to the"
-       echo "*** full path to freetype-config."
+     AC_MSG_RESULT([no])
+     if test "$FT2_CONFIG" = "no" ; then
+       AC_MSG_WARN([
+
+  The freetype-config script installed by FreeType 2 could not be found.
+  If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
+  your path, or set the FT2_CONFIG environment variable to the
+  full path to freetype-config.
+       ])
      else
-       echo "*** The FreeType test program failed to run.  If your system uses"
-       echo "*** shared libraries and they are installed outside the normal"
-       echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
-       echo "*** (or whatever is appropiate for your system) is correctly set."
+       if test x$ft_config_is_lt = xyes ; then
+         AC_MSG_WARN([
+
+  Your installed version of the FreeType 2 library is too old.
+  If you have different versions of FreeType 2, make sure that
+  correct values for --with-ft-prefix or --with-ft-exec-prefix
+  are used, or set the FT2_CONFIG environment variable to the
+  full path to freetype-config.
+         ])
+       else
+         AC_MSG_WARN([
+
+  The FreeType test program failed to run.  If your system uses
+  shared libraries and they are installed outside the normal
+  system library path, make sure the variable LD_LIBRARY_PATH
+  (or whatever is appropiate for your system) is correctly set.
+         ])
+       fi
      fi
+
+     FT2_CFLAGS=""
+     FT2_LIBS=""
+     m4_if([$3], [], [:], [$3])
    fi
-   FT2_CFLAGS=""
-   FT2_LIBS=""
-   ifelse([$3], , :, [$3])
-fi
-AC_SUBST(FT2_CFLAGS)
-AC_SUBST(FT2_LIBS)
-])
+
+   AC_SUBST([FT2_CFLAGS])
+   AC_SUBST([FT2_LIBS])])
+
+# end of freetype2.m4

reactos/lib/freetype/builds/unix
ft-munmap.m4 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ft-munmap.m4	15 Feb 2004 21:45:28 -0000	1.3
+++ ft-munmap.m4	10 May 2004 17:48:23 -0000	1.4
@@ -1,31 +1,23 @@
 ## FreeType specific autoconf tests
 
-# serial 1 FT_MUNMAP_DECL
+# serial 2
 
-AC_DEFUN(FT_MUNMAP_DECL,
-[AC_MSG_CHECKING([whether munmap must be declared])
-AC_CACHE_VAL(ft_cv_munmap_decl,
-[AC_TRY_COMPILE([
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/mman.h>],
-[char *(*pfn) = (char *(*))munmap],
-ft_cv_munmap_decl=no,
-ft_cv_munmap_decl=yes)])
-AC_MSG_RESULT($ft_cv_munmap_decl)
-if test $ft_cv_munmap_decl = yes; then
-  AC_DEFINE(NEED_MUNMAP_DECL,,
-  [Define to 1 if munmap() is not defined in <sys/mman.h>])
-fi])
+AC_DEFUN([FT_MUNMAP_PARAM],
+  [AC_MSG_CHECKING([for munmap's first parameter type])
+   AC_COMPILE_IFELSE([
+       AC_LANG_SOURCE([[
 
-AC_DEFUN(FT_MUNMAP_PARAM,
-[AC_MSG_CHECKING([for munmap's first parameter type])
-AC_TRY_COMPILE([
 #include <unistd.h>
 #include <sys/mman.h>
-int munmap(void *, size_t);],,
-  AC_MSG_RESULT([void *]);AC_DEFINE(MUNMAP_USES_VOIDP,,
-    [Define to 1 if the first argument of munmap is of type void *]),
-  AC_MSG_RESULT([char *]))
-])
+int munmap(void *, size_t);
+
+       ]])
+     ],
+     [AC_MSG_RESULT([void *])
+      AC_DEFINE([MUNMAP_USES_VOIDP],
+        [],
+        [Define to 1 if the first argument of munmap is of type void *])],
+     [AC_MSG_RESULT([char *])])
+  ])
+
+# end of ft-munmap.m4

reactos/lib/freetype/builds/unix
ft2unix.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ft2unix.h	15 Feb 2004 21:45:28 -0000	1.3
+++ ft2unix.h	10 May 2004 17:48:23 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Build macros of the FreeType 2 library.                              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,14 +21,15 @@
   /* This is a Unix-specific version of <ft2build.h> that should be used   */
   /* exclusively *after* installation of the library.                      */
   /*                                                                       */
-  /* It assumes that "/usr/local/include/freetype2" (or wathever is        */
-  /* returned by the "freetype-config --cflags" command) is in your        */
-  /* compilation include path.                                             */
+  /* It assumes that "/usr/local/include/freetype2" (or whatever is        */
+  /* returned by the "freetype-config --cflags" or "pkg-config --cflags"   */
+  /* command) is in your compilation include path.                         */
   /*                                                                       */
   /* We don't need to do anything special in this release.  However, for   */
-  /* FreeType 2.1, the following installation changes will be performed:   */
+  /* a future FreeType 2 release, the following installation changes will  */
+  /* be performed:                                                         */
   /*                                                                       */
-  /*   - The contents of "freetype-2.1/include/freetype" will be installed */
+  /*   - The contents of "freetype-2.x/include/freetype" will be installed */
   /*     to "/usr/local/include/freetype2" instead of                      */
   /*     "/usr/local/include/freetype2/freetype".                          */
   /*                                                                       */
@@ -39,11 +40,11 @@
   /*     replace all "<freetype/xxx>" with "<freetype2/xxx>".              */
   /*                                                                       */
   /*   - Adding "/usr/local/include/freetype2" to your compilation include */
-  /*     path will not be necessary anymore.  The command                  */
-  /*     "freetype-config --cflags" will return an empty string.           */
+  /*     path will not be necessary anymore.                               */
   /*                                                                       */
-  /*   - Client applications which adhere to the new inclusion scheme      */
-  /*     WILL NOT NEED TO BE MODIFIED to compile with FT 2.1!              */
+  /* These changes will be transparent to client applications which use    */
+  /* freetype-config (or pkg-config).  No modifications will be necessary  */
+  /* to compile with the new scheme.                                       */
   /*                                                                       */
   /*************************************************************************/
 
@@ -51,7 +52,7 @@
 #ifndef __FT2_BUILD_UNIX_H__
 #define __FT2_BUILD_UNIX_H__
 
-  /* "/usr/local/include/freetype2" must be in your current inclusion path */
+  /* "<prefix>/include/freetype2" must be in your current inclusion path */
 #include <freetype/config/ftheader.h>
 
 #endif /* __FT2_BUILD_UNIX_H__ */

reactos/lib/freetype/builds/unix
ftconfig.in 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftconfig.in	15 Feb 2004 21:45:28 -0000	1.3
+++ ftconfig.in	10 May 2004 17:48:23 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    UNIX-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2000, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -57,15 +57,17 @@
   /*************************************************************************/
 
 
-#define HAVE_UNISTD_H  0
-#define HAVE_FCNTL_H   0
+#undef HAVE_UNISTD_H
+#undef HAVE_FCNTL_H
+
+#undef SIZEOF_INT
+#undef SIZEOF_LONG
 
-#define SIZEOF_INT   2
-#define SIZEOF_LONG  2
 
 #define FT_SIZEOF_INT   SIZEOF_INT
 #define FT_SIZEOF_LONG  SIZEOF_LONG
 
+#define FT_CHAR_BIT  CHAR_BIT
 
   /* Preferred alignment of data */
 #define FT_ALIGNMENT  8
@@ -91,6 +93,19 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* Mac support                                                           */
+  /*                                                                       */
+  /*   This is the only necessary change, so it is defined here instead    */
+  /*   providing a new configuration file.                                 */
+  /*                                                                       */
+#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
+    ( defined( __MWERKS__ ) && defined( macintosh )        )
+#define FT_MACINTOSH 1
+#endif
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* IntN types                                                            */
   /*                                                                       */
   /*   Used to guarantee the size of some specific integers.               */
@@ -112,31 +127,88 @@
 #error "no 32bit type found -- please check your configuration files"
 #endif
 
+
+  /* look up an integer type that is at least 32 bits */
+#if FT_SIZEOF_INT >= 4
+
+  typedef int            FT_Fast;
+  typedef unsigned int   FT_UFast;
+
+#elif FT_SIZEOF_LONG >= 4
+
+  typedef long           FT_Fast;
+  typedef unsigned long  FT_UFast;
+
+#endif
+
+
+  /* determine whether we have a 64-bit int type for platforms without */
+  /* Autoconf                                                          */
 #if FT_SIZEOF_LONG == 8
 
   /* FT_LONG64 must be defined if a 64-bit type is available */
 #define FT_LONG64
-#define FT_INT64   long
+#define FT_INT64  long
+
+#elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */
+
+  /* this compiler provides the __int64 type */
+#define FT_LONG64
+#define FT_INT64  __int64
+
+#elif defined( __BORLANDC__ )  /* Borland C++ */
+
+  /* XXXX: We should probably check the value of __BORLANDC__ in order */
+  /*       to test the compiler version.                               */
+
+  /* this compiler provides the __int64 type */
+#define FT_LONG64
+#define FT_INT64  __int64
+
+#elif defined( __WATCOMC__ )   /* Watcom C++ */
+
+  /* Watcom doesn't provide 64-bit data types */
+
+#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
+
+#define FT_LONG64
+#define FT_INT64  long long int
+
+#elif defined( __GNUC__ )
+
+  /* GCC provides the "long long" type */
+#define FT_LONG64
+#define FT_INT64  long long int
+
+#endif /* FT_SIZEOF_LONG == 8 */
+
+
+#define FT_BEGIN_STMNT  do {
+#define FT_END_STMNT    } while ( 0 )
+#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
 
-#else
 
   /*************************************************************************/
   /*                                                                       */
-  /* Many compilers provide the non-ANSI `long long' 64-bit type.  You can */
-  /* activate it by defining the FTCALC_USE_LONG_LONG macro in             */
-  /* `ftoption.h'.                                                         */
-  /*                                                                       */
-  /* Note that this will produce many -ansi warnings during library        */
-  /* compilation, and that in many cases,  the generated code will be      */
-  /* neither smaller nor faster!                                           */
+  /* A 64-bit data type will create compilation problems if you compile    */
+  /* in strict ANSI mode.  To avoid them, we disable their use if          */
+  /* __STDC__ is defined.  You can however ignore this rule by             */
+  /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro.        */
   /*                                                                       */
-#ifdef FTCALC_USE_LONG_LONG
+#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
 
-#define FT_LONG64
-#define FT_INT64   long long
+#ifdef __STDC__
 
-#endif /* FTCALC_USE_LONG_LONG */
-#endif /* FT_SIZEOF_LONG == 8 */
+  /* Undefine the 64-bit macros in strict ANSI compilation mode.  */
+  /* Since `#undef' doesn't survive in configuration header files */
+  /* we use the postprocessing facility of AC_CONFIG_HEADERS to   */
+  /* replace the leading `/' with `#'.                            */
+/undef FT_LONG64
+/undef FT_INT64
+
+#endif /* __STDC__ */
+
+#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
 
 
 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
@@ -151,7 +223,7 @@
 #define FT_LOCAL_DEF( x )  extern "C"  x
 #else
 #define FT_LOCAL( x )      extern  x
-#define FT_LOCAL_DEF( x )  extern  x
+#define FT_LOCAL_DEF( x )  x
 #endif
 
 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
@@ -255,6 +327,7 @@
 
 FT_END_HEADER
 
+
 #endif /* __FTCONFIG_H__ */
 
 

reactos/lib/freetype/builds/unix
ftsystem.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftsystem.c	1 Apr 2003 08:38:29 -0000	1.1
+++ ftsystem.c	10 May 2004 17:48:23 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Unix-specific FreeType low-level system interface (body).            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -67,6 +67,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 
   /*************************************************************************/
@@ -182,16 +183,16 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    ft_close_stream                                                    */
+  /*    ft_close_stream_by_munmap                                          */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    The function to close a stream.                                    */
+  /*    The function to close a stream which is opened by mmap.            */
   /*                                                                       */
   /* <Input>                                                               */
   /*    stream :: A pointer to the stream object.                          */
   /*                                                                       */
   FT_CALLBACK_DEF( void )
-  ft_close_stream( FT_Stream  stream )
+  ft_close_stream_by_munmap( FT_Stream  stream )
   {
     munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
 
@@ -201,6 +202,28 @@
   }
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    ft_close_stream_by_free                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The function to close a stream which is created by ft_alloc.       */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    stream :: A pointer to the stream object.                          */
+  /*                                                                       */
+  FT_CALLBACK_DEF( void )
+  ft_close_stream_by_free( FT_Stream  stream )
+  {
+    ft_free( NULL, stream->descriptor.pointer );
+
+    stream->descriptor.pointer = NULL;
+    stream->size               = 0;
+    stream->base               = 0;
+  }
+
+
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Error )
@@ -252,11 +275,49 @@
                                           file,
                                           0 );
 
-    if ( (long)stream->base == -1 )
+    if ( (long)stream->base != -1 )
+      stream->close = ft_close_stream_by_munmap;
+    else
     {
+      ssize_t  total_read_count;
+    
+
       FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
-      goto Fail_Map;
+      
+      stream->base = ft_alloc( NULL, stream->size );
+      
+      if ( !stream->base )
+      {
+        FT_ERROR(( "FT_Stream_Open:" ));
+        FT_ERROR(( " could not `alloc' memory\n" ));
+        goto Fail_Map;
+      }
+      
+      total_read_count = 0;
+      do {
+        ssize_t  read_count;
+
+
+        read_count = read( file, 
+                           stream->base + total_read_count, 
+                           stream->size - total_read_count );
+
+        if ( ( read_count == -1 ) )
+        {
+          if ( errno == EINTR )
+            continue;
+
+          FT_ERROR(( "FT_Stream_Open:" ));
+          FT_ERROR(( " error while `read'ing file `%s'\n", filepathname ));
+          goto Fail_Read;
+        }
+
+        total_read_count += read_count;
+
+      } while ( total_read_count != stream->size );
+
+      stream->close = ft_close_stream_by_free;
     }
 
     close( file );
@@ -264,8 +325,7 @@
     stream->descriptor.pointer = stream->base;
     stream->pathname.pointer   = (char*)filepathname;
 
-    stream->close = ft_close_stream;
-    stream->read  = 0;
+    stream->read = 0;
 
     FT_TRACE1(( "FT_Stream_Open:" ));
     FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
@@ -273,6 +333,9 @@
 
     return FT_Err_Ok;
 
+  Fail_Read:
+    ft_free( NULL, stream->base );
+
   Fail_Map:
     close( file );
 

reactos/lib/freetype/builds/unix
install-sh 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- install-sh	15 Feb 2004 21:45:28 -0000	1.4
+++ install-sh	10 May 2004 17:48:23 -0000	1.5
@@ -1,21 +1,38 @@
 #!/bin/sh
 # install - install a program, script, or datafile
-# This originally came from X11R5 (mit/util/scripts/install.sh).
 
-scriptversion=2003-01-17.15
+scriptversion=2004-02-15.20
 
-# Copyright 1991 by the Massachusetts Institute of Technology
-# (FSF changes in the public domain.)
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
 #
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
 # `make' implicit rules from creating a file called install from it
@@ -55,7 +72,8 @@
 dir_arg=
 
 usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
-   or: $0 -d DIR1 DIR2...
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 -d DIRECTORIES...
 
 In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
 In the second, create the directory path DIR.
@@ -117,144 +135,173 @@
 
     --version) echo "$0 $scriptversion"; exit 0;;
 
-    *)  if test -z "$src"; then
-          src=$1
-        else
-          # this colon is to work around a 386BSD /bin/sh bug
-          :
-          dst=$1
-        fi
-        shift
-        continue;;
+    *)  # When -d is used, all remaining arguments are directories to create.
+	test -n "$dir_arg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
   esac
 done
 
-if test -z "$src"; then
-  echo "$0: no input file specified." >&2
-  exit 1
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
 fi
 
-if test -n "$dir_arg"; then
-  dst=$src
-  src=
-
-  if test -d "$dst"; then
-    instcmd=:
-    chmodcmd=
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      instcmd=:
+      chmodcmd=
+    else
+      instcmd=$mkdirprog
+    fi
   else
-    instcmd=$mkdirprog
-  fi
-else
-  # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-  # might cause directories to be created, which would be especially bad
-  # if $src (and thus $dsttmp) contains '*'.
-  if test ! -f "$src" && test ! -d "$src"; then
-    echo "$0: $src does not exist." >&2
-    exit 1
-  fi
+    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
 
-  if test -z "$dst"; then
-    echo "$0: no destination specified." >&2
-    exit 1
-  fi
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
 
-  # If destination is a directory, append the input filename; won't work
-  # if double slashes aren't ignored.
-  if test -d "$dst"; then
-    dst=$dst/`basename "$src"`
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      dst=$dst/`basename "$src"`
+    fi
   fi
-fi
 
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
-# Make sure that the destination directory exists.
-# (this part is taken from Noah Friedman's mkinstalldirs script.)
-
-# Skip lots of stat calls in the usual case.
-if test ! -d "$dstdir"; then
-  defaultIFS='
-	'
-  IFS="${IFS-$defaultIFS}"
-
-  oIFS=$IFS
-  # Some sh's can't handle IFS=/ for some reason.
-  IFS='%'
-  set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-  IFS=$oIFS
-
-  pathcomp=
-
-  while test $# -ne 0 ; do
-    pathcomp=$pathcomp$1
-    shift
-    test -d "$pathcomp" || $mkdirprog "$pathcomp"
-    pathcomp=$pathcomp/
-  done
-fi
+  # Make sure that the destination directory exists.
 
-if test -n "$dir_arg"; then
-  $doit $instcmd "$dst" \
-    && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-    && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-    && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-    && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
-else
-  # If we're going to rename the final executable, determine the name now.
-  if test -z "$transformarg"; then
-    dstfile=`basename "$dst"`
-  else
-    dstfile=`basename "$dst" $transformbasename \
-             | sed $transformarg`$transformbasename
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp" || lasterr=$?
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+      fi
+      pathcomp=$pathcomp/
+    done
   fi
 
-  # don't allow the sed command to completely eliminate the filename.
-  test -z "$dstfile" && dstfile=`basename "$dst"`
+  if test -n "$dir_arg"; then
+    $doit $instcmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
 
-  # Make a couple of temp file names in the proper directory.
-  dsttmp=$dstdir/#inst.$$#
-  rmtmp=$dstdir/#rm.$$#
-
-  # Trap to clean up those temp files at exit.
-  trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Move or copy the file name to the temp name
-  $doit $instcmd "$src" "$dsttmp" &&
-
-  # and set any options; do chmod last to preserve setuid bits.
-  #
-  # If any of these fail, we abort the whole thing.  If we want to
-  # ignore errors from any of these, just make sure not to ignore
-  # errors from the above "$doit $instcmd $src $dsttmp" command.
-  #
-  { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-    && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-    && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-    && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
-  # Now remove or move aside any old file at destination location.  We
-  # try this two ways since rm can't unlink itself on some systems and
-  # the destination file might be busy for other reasons.  In this case,
-  # the final cleanup might fail but the new file should still install
-  # successfully.
-  {
-    if test -f "$dstdir/$dstfile"; then
-      $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-      || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
-      || {
-	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-	  (exit 1); exit
-      }
+  else
+    # If we're going to rename the final executable, determine the name now.
+    if test -z "$transformarg"; then
+      dstfile=`basename "$dst"`
     else
-      :
+      dstfile=`basename "$dst" $transformbasename \
+               | sed $transformarg`$transformbasename
     fi
-  } &&
 
-  # Now rename the file to the real destination.
-  $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-fi &&
+    # don't allow the sed command to completely eliminate the filename.
+    test -z "$dstfile" && dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Move or copy the file name to the temp name
+    $doit $instcmd "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $instcmd $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now remove or move aside any old file at destination location.  We
+    # try this two ways since rm can't unlink itself on some systems and
+    # the destination file might be busy for other reasons.  In this case,
+    # the final cleanup might fail but the new file should still install
+    # successfully.
+    {
+      if test -f "$dstdir/$dstfile"; then
+        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+        || {
+	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+	  (exit 1); exit
+        }
+      else
+        :
+      fi
+    } &&
+
+    # Now rename the file to the real destination.
+    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+  fi || { (exit 1); exit; }
+done
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
 {

reactos/lib/freetype/builds/unix
install.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- install.mk	15 Feb 2004 21:45:28 -0000	1.4
+++ install.mk	10 May 2004 17:48:23 -0000	1.5
@@ -51,6 +51,8 @@
         done
 	$(INSTALL_DATA) $(BUILD_DIR)/ft2unix.h \
           $(DESTDIR)$(includedir)/ft2build.h
+	$(INSTALL_DATA) $(BUILD_DIR)/ftconfig.h \
+          $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h
 	$(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \
           $(DESTDIR)$(bindir)/freetype-config
 	$(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \

reactos/lib/freetype/builds/unix
ltmain.sh 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ltmain.sh	15 Feb 2004 21:45:28 -0000	1.5
+++ ltmain.sh	10 May 2004 17:48:23 -0000	1.6
@@ -1,7 +1,7 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun configure.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
 # Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
@@ -24,6 +24,29 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.6
+TIMESTAMP=" (1.1220.2.94 2004/04/10 16:27:27)"
+
+
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
   # Discard the --no-reexec flag, and continue.
@@ -36,7 +59,7 @@
   :
 else
   # Restart under the correct shell, and then maybe $echo will work.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
 fi
 
 if test "X$1" = X--fallback-echo; then
@@ -45,19 +68,9 @@
   cat <<EOF
 $*
 EOF
-  exit 0
+  exit $EXIT_SUCCESS
 fi
 
-# The name of this program.
-progname=`$echo "$0" | ${SED} 's%^.*/%%'`
-modename="$progname"
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.4.3
-TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
-
 default_mode=
 help="Try \`$progname --help' for more information."
 magic="%%%MAGIC variable%%%"
@@ -69,17 +82,17 @@
 # metacharacters that are still active within double-quoted strings.
 Xsed="${SED}"' -e 1s/^X//'
 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII                                                         
-case `echo A|od -x` in                                                         
- *[Cc]1*) # EBCDIC based system                                                
-  SP2NL="tr '\100' '\n'"                                                       
-  NL2SP="tr '\r\n' '\100\100'"                                                 
-  ;;                                                                           
- *) # Assume ASCII based system                                                
-  SP2NL="tr '\040' '\012'"                                                     
-  NL2SP="tr '\015\012' '\040\040'"                                             
-  ;;                                                                           
-esac                                                                           
+# test EBCDIC or ASCII
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+  SP2NL="tr '\100' '\n'"
+  NL2SP="tr '\r\n' '\100\100'"
+  ;;
+ *) # Assume ASCII based system
+  SP2NL="tr '\040' '\012'"
+  NL2SP="tr '\015\012' '\040\040'"
+  ;;
+esac
 
 # NLS nuisances.
 # Only set LANG and LC_ALL to C if already set.
@@ -94,12 +107,13 @@
 fi
 
 # Make sure IFS has a sensible default
-: ${IFS=" 	"}
+: ${IFS=" 	
+"}
 
 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-  echo "$modename: not configured to build any kind of library" 1>&2
-  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-  exit 1
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
 fi
 
 # Global variables.
@@ -114,8 +128,121 @@
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid () {
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
+      fi
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag () {
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
 # Parse our command line options once, thoroughly.
-while test $# -gt 0
+while test "$#" -gt 0
 do
   arg="$1"
   shift
@@ -131,6 +258,34 @@
     execute_dlfiles)
       execute_dlfiles="$execute_dlfiles $arg"
       ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
     *)
       eval "$prev=\$arg"
       ;;
@@ -148,18 +303,27 @@
     ;;
 
   --version)
-    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
-    exit 0
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $EXIT_SUCCESS
     ;;
 
   --config)
-    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
-    exit 0
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $EXIT_SUCCESS
     ;;
 
   --debug)
-    echo "$progname: enabling shell trace mode"
+    $echo "$progname: enabling shell trace mode"
     set -x
+    preserve_args="$preserve_args $arg"
     ;;
 
   --dry-run | -n)
@@ -167,18 +331,18 @@
     ;;
 
   --features)
-    echo "host: $host"
+    $echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      echo "enable shared libraries"
+      $echo "enable shared libraries"
     else
-      echo "disable shared libraries"
+      $echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      echo "enable static libraries"
+      $echo "enable static libraries"
     else
-      echo "disable static libraries"
+      $echo "disable static libraries"
     fi
-    exit 0
+    exit $EXIT_SUCCESS
     ;;
 
   --finish) mode="finish" ;;
@@ -190,6 +354,15 @@
 
   --quiet | --silent)
     show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag) prevopt="--tag" prev=tag ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
     ;;
 
   -dlopen)
@@ -200,7 +373,7 @@
   -*)
     $echo "$modename: unrecognized option \`$arg'" 1>&2
     $echo "$help" 1>&2
-    exit 1
+    exit $EXIT_FAILURE
     ;;
 
   *)
@@ -213,7 +386,7 @@
 if test -n "$prevopt"; then
   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   $echo "$help" 1>&2
-  exit 1
+  exit $EXIT_FAILURE
 fi
 
 # If this variable is set in any of the actions, the command in it
@@ -225,8 +398,10 @@
 
   # Infer the operation mode.
   if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
     case $nonopt in
-    *cc | *++ | gcc* | *-gcc* | xlc*)
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
       mode=link
       for arg
       do
@@ -267,7 +442,7 @@
   if test -n "$execute_dlfiles" && test "$mode" != execute; then
     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
     $echo "$help" 1>&2
-    exit 1
+    exit $EXIT_FAILURE
   fi
 
   # Change the help message to a mode-specific one.
@@ -281,158 +456,124 @@
     modename="$modename: compile"
     # Get the compilation command and the source file.
     base_compile=
-    prev=
-    lastarg=
-    srcfile="$nonopt"
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
     suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
 
-    user_target=no
     for arg
     do
-      case $prev in
-      "") ;;
-      xcompiler)
-	# Aesthetically quote the previous argument.
-	prev=
-	lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-
-	case $arg in
-	# Double-quote args containing other shell metacharacters.
-	# Many Bourne shells cannot handle close brackets correctly
-	# in scan sets, so we specify it separately.
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-
-	# Add the previous argument to base_compile.
-	if test -z "$base_compile"; then
-	  base_compile="$lastarg"
-	else
-	  base_compile="$base_compile $lastarg"
-	fi
-	continue
-	;;
-      esac
-
-      # Accept any command-line options.
-      case $arg in
-      -o)
-	if test "$user_target" != "no"; then
-	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
-	  exit 1
-	fi
-	user_target=next
+      case "$arg_mode" in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
 	;;
 
-      -static)
-	build_old_libs=yes
+      target )
+	libobj="$arg"
+	arg_mode=normal
 	continue
 	;;
 
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
 
-      -prefer-non-pic)
-	pic_mode=no
-	continue
-	;;
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
 
-      -Xcompiler)
-	prev=xcompiler
-	continue
-	;;
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
 
-      -Wc,*)
-	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
-	lastarg=
-	save_ifs="$IFS"; IFS=','
-	for arg in $args; do
-	  IFS="$save_ifs"
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
 
-	  # Double-quote args containing other shell metacharacters.
-	  # Many Bourne shells cannot handle close brackets correctly
-	  # in scan sets, so we specify it separately.
-	  case $arg in
-	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	    arg="\"$arg\""
-	    ;;
-	  esac
-	  lastarg="$lastarg $arg"
-	done
-	IFS="$save_ifs"
-	lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
-	# Add the arguments to base_compile.
-	if test -z "$base_compile"; then
-	  base_compile="$lastarg"
-	else
+	  # Add the arguments to base_compile.
 	  base_compile="$base_compile $lastarg"
-	fi
-	continue
-	;;
-      esac
+	  continue
+	  ;;
 
-      case $user_target in
-      next)
-	# The next one is the -o target name
-	user_target=yes
-	continue
-	;;
-      yes)
-	# We got the output file
-	user_target=set
-	libobj="$arg"
-	continue
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
 	;;
-      esac
-
-      # Accept the current argument as the source file.
-      lastarg="$srcfile"
-      srcfile="$arg"
+      esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-
-      # Backslashify any backslashes, double quotes, and dollar signs.
-      # These are the only characters that are still specially
-      # interpreted inside of double-quoted scrings.
       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
 
+      case $lastarg in
       # Double-quote args containing other shell metacharacters.
       # Many Bourne shells cannot handle close brackets correctly
       # in scan sets, so we specify it separately.
-      case $lastarg in
       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 	lastarg="\"$lastarg\""
 	;;
       esac
 
-      # Add the previous argument to base_compile.
-      if test -z "$base_compile"; then
-	base_compile="$lastarg"
-      else
-	base_compile="$base_compile $lastarg"
-      fi
-    done
+      base_compile="$base_compile $lastarg"
+    done # for arg
 
-    case $user_target in
-    set)
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
       ;;
-    no)
-      # Get the name of the library object.
-      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
       ;;
     *)
-      $echo "$modename: you must specify a target with \`-o'" 1>&2
-      exit 1
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
       ;;
     esac
 
     # Recognize several different file suffixes.
     # If the user specifies -o file.o, it is replaced with file.lo
-    xform='[cCFSfmso]'
+    xform='[cCFSifmso]'
     case $libobj in
     *.ada) xform=ada ;;
     *.adb) xform=adb ;;
@@ -440,10 +581,13 @@
     *.asm) xform=asm ;;
     *.c++) xform=c++ ;;
     *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
     *.cpp) xform=cpp ;;
     *.cxx) xform=cxx ;;
     *.f90) xform=f90 ;;
     *.for) xform=for ;;
+    *.java) xform=java ;;
     esac
 
     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -452,25 +596,55 @@
     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
     *)
       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
-      exit 1
+      exit $EXIT_FAILURE
       ;;
     esac
 
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
     if test -z "$base_compile"; then
       $echo "$modename: you must specify a compilation command" 1>&2
       $echo "$help" 1>&2
-      exit 1
+      exit $EXIT_FAILURE
     fi
 
     # Delete any leftover library objects.
     if test "$build_old_libs" = yes; then
-      removelist="$obj $libobj"
+      removelist="$obj $lobj $libobj ${libobj}T"
     else
-      removelist="$libobj"
+      removelist="$lobj $libobj ${libobj}T"
     fi
 
     $run $rm $removelist
-    trap "$run $rm $removelist; exit 1" 1 2 15
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
     case $host_os in
@@ -489,8 +663,9 @@
       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
       removelist="$removelist $output_obj $lockfile"
-      trap "$run $rm $removelist; exit 1" 1 2 15
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
     else
+      output_obj=
       need_locks=no
       lockfile=
     fi
@@ -498,13 +673,13 @@
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until $run ln "$0" "$lockfile" 2>/dev/null; do
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
 	$show "Waiting for $lockfile to be removed"
 	sleep 2
       done
     elif test "$need_locks" = warn; then
       if test -f "$lockfile"; then
-	echo "\
+	$echo "\
 *** ERROR, $lockfile exists and contains:
 `cat $lockfile 2>/dev/null`
 
@@ -516,68 +691,67 @@
 compiler."
 
 	$run $rm $removelist
-	exit 1
+	exit $EXIT_FAILURE
       fi
-      echo $srcfile > "$lockfile"
+      $echo $srcfile > "$lockfile"
     fi
 
     if test -n "$fix_srcfile_path"; then
       eval srcfile=\"$fix_srcfile_path\"
     fi
 
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
     # Only build a PIC object if we are building libtool libraries.
     if test "$build_libtool_libs" = yes; then
       # Without this assignment, base_compile gets emptied.
       fbsd_hideous_sh_bug=$base_compile
 
       if test "$pic_mode" != no; then
-	# All platforms use -DPIC, to notify preprocessed assembler code.
-	command="$base_compile $srcfile $pic_flag -DPIC"
+	command="$base_compile $srcfile $pic_flag"
       else
 	# Don't build PIC code
 	command="$base_compile $srcfile"
       fi
-      if test "$build_old_libs" = yes; then
-	lo_libobj="$libobj"
-	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
-	if test "X$dir" = "X$libobj"; then
-	  dir="$objdir"
-	else
-	  dir="$dir/$objdir"
-	fi
-	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
-	if test -d "$dir"; then
-	  $show "$rm $libobj"
-	  $run $rm $libobj
-	else
-	  $show "$mkdir $dir"
-	  $run $mkdir $dir
-	  status=$?
-	  if test $status -ne 0 && test ! -d $dir; then
-	    exit $status
-	  fi
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	status=$?
+	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $status
 	fi
       fi
-      if test "$compiler_o_lo" = yes; then
-	output_obj="$libobj"
-	command="$command -o $output_obj"
-      elif test "$compiler_c_o" = yes; then
-	output_obj="$obj"
-	command="$command -o $output_obj"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
       fi
 
-      $run $rm "$output_obj"
+      $run $rm "$lobj" "$output_obj"
+
       $show "$command"
       if $run eval "$command"; then :
       else
 	test -n "$output_obj" && $run $rm $removelist
-	exit 1
+	exit $EXIT_FAILURE
       fi
 
       if test "$need_locks" = warn &&
-	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
-	echo "\
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
 *** ERROR, $lockfile contains:
 `cat $lockfile 2>/dev/null`
 
@@ -592,13 +766,13 @@
 compiler."
 
 	$run $rm $removelist
-	exit 1
+	exit $EXIT_FAILURE
       fi
 
       # Just move the object if needed, then go on to compile the next one
-      if test x"$output_obj" != x"$libobj"; then
-	$show "$mv $output_obj $libobj"
-	if $run $mv $output_obj $libobj; then :
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
 	else
 	  error=$?
 	  $run $rm $removelist
@@ -606,48 +780,23 @@
 	fi
       fi
 
-      # If we have no pic_flag, then copy the object into place and finish.
-      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
-	 test "$build_old_libs" = yes; then
-	# Rename the .lo from within objdir to obj
-	if test -f $obj; then
-	  $show $rm $obj
-	  $run $rm $obj
-	fi
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
 
-	$show "$mv $libobj $obj"
-	if $run $mv $libobj $obj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
+EOF
 
-	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-	if test "X$xdir" = "X$obj"; then
-	  xdir="."
-	else
-	  xdir="$xdir"
-	fi
-	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
-	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
-	# Now arrange that obj and lo_libobj become the same file
-	$show "(cd $xdir && $LN_S $baseobj $libobj)"
-	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
-	  # Unlock the critical section if it was locked
-	  if test "$need_locks" != no; then
-	    $run $rm "$lockfile"
-	  fi
-	  exit 0
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
       fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
 
-      # Allow error messages only from the first compilation.
-      suppress_output=' >/dev/null 2>&1'
+EOF
     fi
 
     # Only build a position-dependent object if we build old libraries.
@@ -656,27 +805,25 @@
 	# Don't build PIC code
 	command="$base_compile $srcfile"
       else
-	# All platforms use -DPIC, to notify preprocessed assembler code.
-	command="$base_compile $srcfile $pic_flag -DPIC"
+	command="$base_compile $srcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
 	command="$command -o $obj"
-	output_obj="$obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
       command="$command$suppress_output"
-      $run $rm "$output_obj"
+      $run $rm "$obj" "$output_obj"
       $show "$command"
       if $run eval "$command"; then :
       else
 	$run $rm $removelist
-	exit 1
+	exit $EXIT_FAILURE
       fi
 
       if test "$need_locks" = warn &&
-	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
-	echo "\
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
 *** ERROR, $lockfile contains:
 `cat $lockfile 2>/dev/null`
 
@@ -691,11 +838,11 @@
 compiler."
 
 	$run $rm $removelist
-	exit 1
+	exit $EXIT_FAILURE
       fi
 
       # Just move the object if needed
-      if test x"$output_obj" != x"$obj"; then
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
 	$show "$mv $output_obj $obj"
 	if $run $mv $output_obj $obj; then :
 	else
@@ -705,29 +852,31 @@
 	fi
       fi
 
-      # Create an invalid libtool object if no PIC, so that we do not
-      # accidentally link it into a program.
-      if test "$build_libtool_libs" != yes; then
-	$show "echo timestamp > $libobj"
-	$run eval "echo timestamp > \$libobj" || exit $?
-      else
-	# Move the .lo from within objdir
-	$show "$mv $libobj $lo_libobj"
-	if $run $mv $libobj $lo_libobj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
     fi
 
+    $run $mv "${libobj}T" "${libobj}"
+
     # Unlock the critical section if it was locked
     if test "$need_locks" != no; then
       $run $rm "$lockfile"
[truncated at 1000 lines; 4051 more skipped]

reactos/lib/freetype/builds/unix
mkinstalldirs 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- mkinstalldirs	15 Feb 2004 21:45:29 -0000	1.4
+++ mkinstalldirs	10 May 2004 17:48:23 -0000	1.5
@@ -1,20 +1,32 @@
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+
+scriptversion=2004-02-15.20
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
 # Created: 1993-05-16
-# Public domain
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
 
 errstatus=0
 dirmode=""
 
 usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake@gnu.org>."
 
 # process command line arguments
 while test $# -gt 0 ; do
   case $1 in
     -h | --help | --h*)         # -h for help
-      echo "$usage" 1>&2
+      echo "$usage"
       exit 0
       ;;
     -m)                         # -m PERM arg
@@ -23,6 +35,10 @@
       dirmode=$1
       shift
       ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit 0
+      ;;
     --)                         # stop option processing
       shift
       break
@@ -50,17 +66,37 @@
   0) exit 0 ;;
 esac
 
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
 case $dirmode in
   '')
-    if mkdir -p -- . 2>/dev/null; then
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
       echo "mkdir -p -- $*"
       exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the `mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because `.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
     fi
     ;;
   *)
-    if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
       echo "mkdir -m $dirmode -p -- $*"
       exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
     fi
     ;;
 esac
@@ -84,17 +120,17 @@
       mkdir "$pathcomp" || lasterr=$?
 
       if test ! -d "$pathcomp"; then
-  	errstatus=$lasterr
+	errstatus=$lasterr
       else
-  	if test ! -z "$dirmode"; then
+	if test ! -z "$dirmode"; then
 	  echo "chmod $dirmode $pathcomp"
-    	  lasterr=""
-  	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+	  lasterr=""
+	  chmod "$dirmode" "$pathcomp" || lasterr=$?
 
-  	  if test ! -z "$lasterr"; then
-  	    errstatus=$lasterr
-  	  fi
-  	fi
+	  if test ! -z "$lasterr"; then
+	    errstatus=$lasterr
+	  fi
+	fi
       fi
     fi
 
@@ -107,5 +143,8 @@
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
 # End:
-# mkinstalldirs ends here

reactos/lib/freetype/builds/unix
unix-cc.in 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- unix-cc.in	15 Feb 2004 21:45:29 -0000	1.5
+++ unix-cc.in	10 May 2004 17:48:23 -0000	1.6
@@ -70,7 +70,10 @@
 #   Use the ANSIFLAGS variable to define the compiler flags used to enfore
 #   ANSI compliance.
 #
-CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@
+#   We use our own FreeType configuration file.
+#
+CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@ \
+          -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
 
 # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
 #

reactos/lib/freetype/builds/unix
unix-def.in 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- unix-def.in	21 Jan 2004 19:23:45 -0000	1.3
+++ unix-def.in	10 May 2004 17:48:23 -0000	1.4
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002 by
+# Copyright 1996-2000, 2002, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -21,8 +21,6 @@
 DELETE    := @RMF@
 DELDIR    := @RMDIR@
 SEP       := /
-BUILD_DIR := $(TOP_DIR)/builds/unix
-PLATFORM  := unix
 
 # this is used for `make distclean' and `make install'
 ifndef OBJ_BUILD

reactos/lib/freetype/builds/unix
unix.mk 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- unix.mk	1 Apr 2003 08:38:30 -0000	1.1
+++ unix.mk	10 May 2004 17:48:23 -0000	1.2
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002 by
+# Copyright 1996-2000, 2002, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -12,10 +12,14 @@
 # indicate that you have read the license and understand and accept it
 # fully.
 
-have_mk := $(strip $(wildcard $(TOP_DIR)/builds/unix/unix-def.mk))
+# We need these declarations here since unix-def.mk is a generated file.
+BUILD_DIR := $(TOP_DIR)/builds/unix
+PLATFORM  := unix
+
+have_mk := $(strip $(wildcard $(BUILD_DIR)/unix-def.mk))
 ifneq ($(have_mk),)
-  include $(TOP_DIR)/builds/unix/unix-def.mk
-  include $(TOP_DIR)/builds/unix/unix-cc.mk
+  include $(BUILD_DIR)/unix-def.mk
+  include $(BUILD_DIR)/unix-cc.mk
 else
   # we are building FT2 not in the src tree
   include $(OBJ_DIR)/unix-def.mk

reactos/lib/freetype/builds/vms
ftconfig.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftconfig.h	15 Feb 2004 21:45:29 -0000	1.3
+++ ftconfig.h	10 May 2004 17:48:25 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    VMS-specific configuration file (specification only).                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,8 +34,8 @@
   /*************************************************************************/
 
 
-#ifndef FTCONFIG_H
-#define FTCONFIG_H
+#ifndef __FTCONFIG_H__
+#define __FTCONFIG_H__
 
 
   /* Include the header file containing all developer build options */
@@ -43,6 +43,7 @@
 #include FT_CONFIG_OPTIONS_H
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
+
 FT_BEGIN_HEADER
 
   /*************************************************************************/
@@ -66,6 +67,8 @@
 #define FT_SIZEOF_INT   4
 #define FT_SIZEOF_LONG  4
 
+#define FT_CHAR_BIT  8
+
 
   /* Preferred alignment of data */
 #define FT_ALIGNMENT  8
@@ -91,6 +94,19 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* Mac support                                                           */
+  /*                                                                       */
+  /*   This is the only necessary change, so it is defined here instead    */
+  /*   providing a new configuration file.                                 */
+  /*                                                                       */
+#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
+    ( defined( __MWERKS__ ) && defined( macintosh )        )
+#define FT_MACINTOSH 1
+#endif
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* IntN types                                                            */
   /*                                                                       */
   /*   Used to guarantee the size of some specific integers.               */
@@ -112,32 +128,84 @@
 #error "no 32bit type found -- please check your configuration files"
 #endif
 
+  /* look up an integer type that is at least 32 bits */
+#if FT_SIZEOF_INT >= 4
+
+  typedef int            FT_Fast;
+  typedef unsigned int   FT_UFast;
+
+#elif FT_SIZEOF_LONG >= 4
+
+  typedef long           FT_Fast;
+  typedef unsigned long  FT_UFast;
+
+#endif
+
+
+  /* determine whether we have a 64-bit int type for platforms without */
+  /* Autoconf                                                          */
 #if FT_SIZEOF_LONG == 8
 
   /* FT_LONG64 must be defined if a 64-bit type is available */
 #define FT_LONG64
-#define FT_INT64   long
+#define FT_INT64  long
+
+#elif defined( _MSC_VER ) && _MSC_VER >= 900  /* Visual C++ (and Intel C++) */
+
+  /* this compiler provides the __int64 type */
+#define FT_LONG64
+#define FT_INT64  __int64
+
+#elif defined( __BORLANDC__ )  /* Borland C++ */
+
+  /* XXXX: We should probably check the value of __BORLANDC__ in order */
+  /*       to test the compiler version.                               */
+
+  /* this compiler provides the __int64 type */
+#define FT_LONG64
+#define FT_INT64  __int64
+
+#elif defined( __WATCOMC__ )   /* Watcom C++ */
+
+  /* Watcom doesn't provide 64-bit data types */
+
+#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
+
+#define FT_LONG64
+#define FT_INT64  long long int
+
+#elif defined( __GNUC__ )
+
+  /* GCC provides the "long long" type */
+#define FT_LONG64
+#define FT_INT64  long long int
+
+#endif /* FT_SIZEOF_LONG == 8 */
+
+
+#define FT_BEGIN_STMNT  do {
+#define FT_END_STMNT    } while ( 0 )
+#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
 
-#else
 
   /*************************************************************************/
   /*                                                                       */
-  /* Many compilers provide the non-ANSI `long long' 64-bit type.  You can */
-  /* activate it by defining the FTCALC_USE_LONG_LONG macro in             */
-  /* `ftoption.h'.                                                         */
+  /* A 64-bit data type will create compilation problems if you compile    */
+  /* in strict ANSI mode.  To avoid them, we disable their use if          */
+  /* __STDC__ is defined.  You can however ignore this rule by             */
+  /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro.        */
   /*                                                                       */
-  /* Note that this will produce many -ansi warnings during library        */
-  /* compilation, and that in many cases,  the generated code will be      */
-  /* neither smaller nor faster!                                           */
-  /*                                                                       */
-#ifdef FTCALC_USE_LONG_LONG
+#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
 
-#define FT_LONG64
-#define FT_INT64   long long
+#ifdef __STDC__
 
-#endif /* FTCALC_USE_LONG_LONG */
+  /* undefine the 64-bit macros in strict ANSI compilation mode */
+#undef FT_LONG64
+#undef FT_INT64
 
-#endif /* FT_SIZEOF_LONG == 8 */
+#endif /* __STDC__ */
+
+#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
 
 
 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
@@ -157,6 +225,7 @@
 
 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
 
+
 #ifndef FT_BASE
 
 #ifdef __cplusplus
@@ -167,15 +236,16 @@
 
 #endif /* !FT_BASE */
 
-#ifndef BASE_DEF
+
+#ifndef FT_BASE_DEF
 
 #ifdef __cplusplus
-#define BASE_DEF( x )  extern "C"  x
+#define FT_BASE_DEF( x )  extern "C"  x
 #else
-#define BASE_DEF( x )  extern  x
+#define FT_BASE_DEF( x )  extern  x
 #endif
 
-#endif /* !BASE_DEF */
+#endif /* !FT_BASE_DEF */
 
 
 #ifndef FT_EXPORT
@@ -188,6 +258,7 @@
 
 #endif /* !FT_EXPORT */
 
+
 #ifndef FT_EXPORT_DEF
 
 #ifdef __cplusplus
@@ -209,6 +280,9 @@
 
 #endif /* !FT_EXPORT_VAR */
 
+  /* The following macros are needed to compile the library with a   */
+  /* C++ compiler and with 16bit compilers.                          */
+  /*                                                                 */
 
   /* This is special.  Within C++, you must specify `extern "C"' for */
   /* functions which are used via function pointers, and you also    */
@@ -216,23 +290,42 @@
   /* assure C linkage -- it's not possible to have (local) anonymous */
   /* functions which are accessed by (global) function pointers.     */
   /*                                                                 */
+  /*                                                                 */
+  /* FT_CALLBACK_DEF is used to _define_ a callback function.        */
+  /*                                                                 */
+  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
+  /* contains pointers to callback functions.                        */
+  /*                                                                 */
+  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
+  /* that contains pointers to callback functions.                   */
+  /*                                                                 */
+  /*                                                                 */
+  /* Some 16bit compilers have to redefine these macros to insert    */
+  /* the infamous `_cdecl' or `__fastcall' declarations.             */
+  /*                                                                 */
+#ifndef FT_CALLBACK_DEF
 #ifdef __cplusplus
-
-#define FT_CALLBACK_DEF( x )        extern "C"  x
-#define FT_CALLBACK_TABLE           extern "C"
-#define FT_CALLBACK_TABLE_DEF       extern "C"
-
+#define FT_CALLBACK_DEF( x )  extern "C"  x
 #else
+#define FT_CALLBACK_DEF( x )  static  x
+#endif
+#endif /* FT_CALLBACK_DEF */
 
-#define FT_CALLBACK_DEF( x )        static  x
-#define FT_CALLBACK_TABLE           extern
-#define FT_CALLBACK_TABLE_DEF
+#ifndef FT_CALLBACK_TABLE
+#ifdef __cplusplus
+#define FT_CALLBACK_TABLE      extern "C"
+#define FT_CALLBACK_TABLE_DEF  extern "C"
+#else
+#define FT_CALLBACK_TABLE      extern
+#define FT_CALLBACK_TABLE_DEF  /* nothing */
+#endif
+#endif /* FT_CALLBACK_TABLE */
 
-#endif /* __cplusplus */
 
 FT_END_HEADER
 
-#endif /* FTCONFIG_H */
+
+#endif /* __FTCONFIG_H__ */
 
 
 /* END */

reactos/lib/freetype/builds/win32/visualc
freetype.sln added at 1.1
diff -N freetype.sln
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ freetype.sln	10 May 2004 17:48:25 -0000	1.1
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "freetype.vcproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Debug Multithreaded = Debug Multithreaded
+		Debug Singlethreaded = Debug Singlethreaded
+		Release = Release
+		Release Multithreaded = Release Multithreaded
+		Release Singlethreaded = Release Singlethreaded
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug.ActiveCfg = Debug|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug.Build.0 = Debug|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded.ActiveCfg = Debug Multithreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded.Build.0 = Debug Multithreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded.ActiveCfg = Debug Singlethreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded.Build.0 = Debug Singlethreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release.ActiveCfg = Release|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release.Build.0 = Release|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded.ActiveCfg = Release Multithreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded.Build.0 = Release Multithreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded.ActiveCfg = Release Singlethreaded|Win32
+		{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded.Build.0 = Release Singlethreaded|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

reactos/lib/freetype/builds/win32/visualc
freetype.vcproj added at 1.1
diff -N freetype.vcproj
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ freetype.vcproj	10 May 2004 17:48:25 -0000	1.1
@@ -0,0 +1,1717 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="freetype"
+	ProjectGUID="{D0087BEB-3E7B-4004-BD4A-E4D071CF8D92}"
+	SccProjectName=""
+	SccLocalPath="">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\..\..\..\objs\release"
+			IntermediateDirectory=".\..\..\..\objs\release"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+				StringPooling="TRUE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="TRUE"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\release/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\release/"
+				ObjectFile=".\..\..\..\objs\release/"
+				ProgramDataBaseFileName=".\..\..\..\objs\release/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218.lib"
+				SuppressStartupBanner="TRUE"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release Multithreaded|Win32"
+			OutputDirectory=".\..\..\..\objs\release_mt"
+			IntermediateDirectory=".\..\..\..\objs\release_mt"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+				StringPooling="TRUE"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="TRUE"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\release_mt/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\release_mt/"
+				ObjectFile=".\..\..\..\objs\release_mt/"
+				ProgramDataBaseFileName=".\..\..\..\objs\release_mt/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218MT.lib"
+				SuppressStartupBanner="TRUE"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release Singlethreaded|Win32"
+			OutputDirectory=".\..\..\..\objs\release_st"
+			IntermediateDirectory=".\..\..\..\objs\release_st"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+				StringPooling="TRUE"
+				RuntimeLibrary="4"
+				EnableFunctionLevelLinking="TRUE"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\release_st/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\release_st/"
+				ObjectFile=".\..\..\..\objs\release_st/"
+				ProgramDataBaseFileName=".\..\..\..\objs\release_st/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218ST.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\..\..\..\objs\debug"
+			IntermediateDirectory=".\..\..\..\objs\debug"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\debug/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\debug/"
+				ObjectFile=".\..\..\..\objs\debug/"
+				ProgramDataBaseFileName=".\..\..\..\objs\debug/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218_D.lib"
+				SuppressStartupBanner="TRUE"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Debug Singlethreaded|Win32"
+			OutputDirectory=".\..\..\..\objs\debug_st"
+			IntermediateDirectory=".\..\..\..\objs\debug_st"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="5"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\debug_st/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\debug_st/"
+				ObjectFile=".\..\..\..\objs\debug_st/"
+				ProgramDataBaseFileName=".\..\..\..\objs\debug_st/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218ST_D.lib"
+				SuppressStartupBanner="TRUE"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Debug Multithreaded|Win32"
+			OutputDirectory=".\..\..\..\objs\debug_mt"
+			IntermediateDirectory=".\..\..\..\objs\debug_mt"
+			ConfigurationType="4"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="FALSE"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\..\..\include"
+				PreprocessorDefinitions="_DEBUG;WIN32;_LIB;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				DisableLanguageExtensions="TRUE"
+				PrecompiledHeaderFile=".\..\..\..\objs\debug_mt/freetype.pch"
+				AssemblerListingLocation=".\..\..\..\objs\debug_mt/"
+				ObjectFile=".\..\..\..\objs\debug_mt/"
+				ProgramDataBaseFileName=".\..\..\..\objs\debug_mt/"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+				CompileAs="0"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\..\..\objs\freetype218MT_D.lib"
+				SuppressStartupBanner="TRUE"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+			<File
+				RelativePath="..\..\..\src\autofit\autofit.c">
+			</File>
+			<File
+				RelativePath="..\..\..\src\autohint\autohint.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\bdf\bdf.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\cff\cff.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\base\ftbase.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\cache\ftcache.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\ftdebug.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"
+						DisableLanguageExtensions="FALSE"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\base\ftglyph.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\gzip\ftgzip.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\lzw\ftlzw.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\base\ftinit.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\base\ftmm.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\base\ftsystem.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Singlethreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug Multithreaded|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="0"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+						BasicRuntimeChecks="3"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\src\pcf\pcf.c">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						Optimization="2"
+						AdditionalIncludeDirectories=""
[truncated at 1000 lines; 721 more skipped]

reactos/lib/freetype/builds/win32/visualc
freetype.dsp 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- freetype.dsp	18 Apr 2003 10:44:13 -0000	1.2
+++ freetype.dsp	10 May 2004 17:48:25 -0000	1.3
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug"
 
@@ -78,7 +78,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218_D.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Multithreaded"
 
@@ -103,7 +103,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"lib\freetype200b8_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214MT_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218MT_D.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Multithreaded"
 
@@ -127,7 +127,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"lib\freetype200b8.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214MT.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218MT.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Singlethreaded"
 
@@ -152,7 +152,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206.lib"
-# ADD LIB32 /out:"..\..\..\objs\freetype214ST.lib"
+# ADD LIB32 /out:"..\..\..\objs\freetype218ST.lib"
 # SUBTRACT LIB32 /nologo
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Singlethreaded"
@@ -178,7 +178,7 @@
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214ST_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218ST_D.lib"
 
 !ENDIF 
 
@@ -235,6 +235,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\src\lzw\ftlzw.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\src\base\ftinit.c
 # SUBTRACT CPP /Fr
 # End Source File

reactos/lib/freetype/builds/win32/visualc
index.html 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- index.html	15 Feb 2004 21:45:29 -0000	1.4
+++ index.html	10 May 2004 17:48:25 -0000	1.5
@@ -1,27 +1,38 @@
 <html>
 <header>
-<title>FreeType 2 Project Files for Visual C++</title>
+<title>
+  FreeType&nbsp;2 Project Files for Visual&nbsp;C++ and VS.NET&nbsp;2003
+</title>
 </header>
 <body>
 
-<h1>FreeType 2 Project Files for Visual C++</h1>
-
-<p>This directory contains a project file for Visual C++, named
-   <tt>freetype.dsp</tt>. It will compile the following libraries
-   from the FreeType 2.1.4 sources:</p>
+<h1>
+  FreeType&nbsp;2 Project Files for Visual&nbsp;C++ and VS.NET&nbsp;2003
+</h1>
+
+<p>This directory contains a project files for Visual C++, named
+<tt>freetype.dsp</tt>, and Visual Studio, called <tt>freetype.sln</tt>.  It
+will compile the following libraries from the FreeType 2.1.8 sources:</p>
 
 <ul>
   <pre>
-    freetype214.lib     - release build; single threaded
-    freetype214_D.lib   - debug build;   single threaded
-    freetype214MT.lib   - release build; multi-threaded
-    freetype214MT_D.lib - debug build;   multi-threaded
-  </pre>
+    freetype218.lib     - release build; single threaded
+    freetype218_D.lib   - debug build;   single threaded
+    freetype218MT.lib   - release build; multi-threaded
+    freetype218MT_D.lib - debug build;   multi-threaded</pre>
 </ul>
 
-<p>Build directories are placed in the top-level "objs" directory</p>
+<p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP
+archives are already stored this way, so no further step is required.  If
+you use some <tt>.tar.*z</tt> archives, be sure to configure your extracting
+tool to convert the line endings.  For example, with <a
+href="http://www.winzip.com">WinZip</a>, you should activate the <it>TAR
+file smart CR/LF Conversion</it> option.  Alternatively, you may consider
+using the <tt>unix2dos</tt> or <tt>u2d</tt> utilities that are floating
+around, which specifically deal with this particular problem.
 
-<p>Enjoy :-)</p>
+<p>Build directories are placed in the top-level <tt>objs</tt>
+directory.</p>
 
 </body>
-</html>
\ No newline at end of file
+</html>

reactos/lib/freetype/devel
ft2build.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ft2build.h	15 Feb 2004 21:45:29 -0000	1.4
+++ ft2build.h	10 May 2004 17:48:25 -0000	1.5
@@ -28,14 +28,14 @@
   *  "ftoption.h"), then invoke Jam as usual.
   */
 
-#ifndef __FT2_BUILD_GENERIC_H__
-#define __FT2_BUILD_GENERIC_H__
+#ifndef __FT2_BUILD_DEVEL_H__
+#define __FT2_BUILD_DEVEL_H__
 
 #define  FT_CONFIG_OPTIONS_H   <ftoption.h>
 
 #include <freetype/config/ftheader.h>
 
-#endif /* __FT2_BUILD_GENERIC_H__ */
+#endif /* __FT2_BUILD_DEVEL_H__ */
 
 
 /* END */

reactos/lib/freetype/devel
ftoption.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftoption.h	15 Feb 2004 21:45:29 -0000	1.4
+++ ftoption.h	10 May 2004 17:48:25 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -97,16 +97,30 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* LZW-compressed file support.                                          */
+  /*                                                                       */
+  /*   FreeType now handles font files that have been compressed with the  */
+  /*   'compress' program.  This is mostly used to parse many of the PCF   */
+  /*   files that come with various X11 distributions.  The implementation */
+  /*   uses NetBSD's `zopen' to partially uncompress the file on the fly   */
+  /*   (see src/lzw/ftgzip.c).                                             */
+  /*                                                                       */
+  /*   Define this macro if you want to enable this `feature'.             */
+  /*                                                                       */
+#define FT_CONFIG_OPTION_USE_LZW
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Gzip-compressed file support.                                         */
   /*                                                                       */
   /*   FreeType now handles font files that have been compressed with the  */
   /*   'gzip' program.  This is mostly used to parse many of the PCF files */
   /*   that come with XFree86.  The implementation uses `zlib' to          */
-  /*   partially uncompress the file on the fly (see src/base/ftgzip.c).   */
+  /*   partially uncompress the file on the fly (see src/gzip/ftgzip.c).   */
   /*                                                                       */
-  /*   Define this macro if you want to enable this "feature".  Note that  */
-  /*   this will however force you to link the zlib to any program that    */
-  /*   also uses FreeType.                                                 */
+  /*   Define this macro if you want to enable this `feature'.  See also   */
+  /*   the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below.                       */
   /*                                                                       */
 #define FT_CONFIG_OPTION_USE_ZLIB
 
@@ -116,7 +130,7 @@
   /* ZLib library selection                                                */
   /*                                                                       */
   /*   This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined.  */
-  /*   It allows FreeType's "ftgzip" component to link to the system's     */
+  /*   It allows FreeType's `ftgzip' component to link to the system's     */
   /*   installation of the ZLib library.  This is useful on systems like   */
   /*   Unix or VMS where it generally is already available.                */
   /*                                                                       */
@@ -232,6 +246,29 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* Guessing methods to access embedded resource forks                    */
+  /*                                                                       */
+  /*   Enable extra Mac fonts support on non-Mac platforms (e.g.           */
+  /*   GNU/Linux).                                                         */
+  /*                                                                       */
+  /*   Resource forks which include fonts data are stored sometimes in     */
+  /*   locations which users or developers don't expected.  In some cases, */
+  /*   resource forks start with some offset from the head of a file.  In  */
+  /*   other cases, the actual resource fork is stored in file different   */
+  /*   from what the user specifies.  If this option is activated,         */
+  /*   FreeType tries to guess whether such offsets or different file      */
+  /*   names must be used.                                                 */
+  /*                                                                       */
+  /*   Note that normal, direct access of resource forks is controlled via */
+  /*   the FT_CONFIG_OPTION_MAC_FONTS option.                              */
+  /*                                                                       */
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
+#endif
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Allow the use of FT_Incremental_Interface to load typefaces that      */
   /* contain no glyph data, but supply it via a callback function.         */
   /* This allows FreeType to be used with the PostScript language, using   */
@@ -296,7 +333,7 @@
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
   /*                                                                       */
-/* #define FT_DEBUG_MEMORY */
+#define FT_DEBUG_MEMORY
 
 
   /*************************************************************************/

reactos/lib/freetype/docs
raster.txt 1.2 -> 1.3
diff -N raster.txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ raster.txt	10 May 2004 17:48:26 -0000	1.3
@@ -0,0 +1,624 @@
+
+                   How FreeType's rasterizer work
+
+                          by David Turner
+
+                        Revised 2003-Dec-08
+
+
+This file  is an  attempt to explain  the internals of  the FreeType
+rasterizer.  The  rasterizer is of  quite general purpose  and could
+easily be integrated into other programs.
+
+
+  I. Introduction
+
+ II. Rendering Technology
+     1. Requirements
+     2. Profiles and Spans
+        a. Sweeping the Shape
+        b. Decomposing Outlines into Profiles
+        c. The Render Pool
+        d. Computing Profiles Extents
+        e. Computing Profiles Coordinates
+        f. Sweeping and Sorting the Spans
+
+
+I. Introduction
+===============
+
+  A  rasterizer is  a library  in charge  of converting  a vectorial
+  representation of a shape  into a bitmap.  The FreeType rasterizer
+  has  been  originally developed  to  render  the  glyphs found  in
+  TrueType  files, made  up  of segments  and second-order  B�ziers.
+  Meanwhile it has been extended to render third-order B�zier curves
+  also.   This  document  is   an  explanation  of  its  design  and
+  implementation.
+
+  While  these explanations start  from the  basics, a  knowledge of
+  common rasterization techniques is assumed.
+
+
+II. Rendering Technology
+========================
+
+1. Requirements
+---------------
+
+  We  assume that  all scaling,  rotating, hinting,  etc.,  has been
+  already done.  The glyph is thus  described by a list of points in
+  the device space.
+
+  - All point coordinates  are in the 26.6 fixed  float format.  The
+    used orientation is:
+
+
+       ^ y
+       |         reference orientation
+       |
+       *----> x
+      0
+
+
+    `26.6' means  that 26 bits  are used for  the integer part  of a
+    value   and  6   bits  are   used  for   the   fractional  part.
+    Consequently, the `distance'  between two neighbouring pixels is
+    64 `units' (1 unit = 1/64th of a pixel).
+
+    Note  that, for  the rasterizer,  pixel centers  are  located at
+    integer   coordinates.   The   TrueType   bytecode  interpreter,
+    however, assumes that  the lower left edge of  a pixel (which is
+    taken  to be  a square  with  a length  of 1  unit) has  integer
+    coordinates.
+
+
+        ^ y                                        ^ y
+        |                                          |
+        |            (1,1)                         |      (0.5,0.5)
+        +-----------+                        +-----+-----+
+        |           |                        |     |     |
+        |           |                        |     |     |
+        |           |                        |     o-----+-----> x
+        |           |                        |   (0,0)   |
+        |           |                        |           |
+        o-----------+-----> x                +-----------+
+      (0,0)                             (-0.5,-0.5)
+
+   TrueType bytecode interpreter          FreeType rasterizer
+
+
+    A pixel line in the target bitmap is called a `scanline'.
+
+  - A  glyph  is  usually  made  of several  contours,  also  called
+    `outlines'.  A contour is simply a closed curve that delimits an
+    outer or inner region of the glyph.  It is described by a series
+    of successive points of the points table.
+
+    Each point  of the glyph  has an associated flag  that indicates
+    whether  it is  `on' or  `off' the  curve.  Two  successive `on'
+    points indicate a line segment joining the two points.
+
+    One `off' point amidst two `on' points indicates a second-degree
+    (conic)  B�zier parametric  arc, defined  by these  three points
+    (the `off' point being the  control point, and the `on' ones the
+    start and end points).  Similarly, a third-degree (cubic) B�zier
+    curve  is described  by four  points (two  `off'  control points
+    between two `on' points).
+
+    Finally,  for  second-order curves  only,  two successive  `off'
+    points  forces the  rasterizer to  create, during  rendering, an
+    `on'  point amidst them,  at their  exact middle.   This greatly
+    facilitates the  definition of  successive B�zier arcs.
+
+  The parametric form of a second-order B�zier curve is:
+
+      P(t) = (1-t)^2*P1 + 2*t*(1-t)*P2 + t^2*P3
+
+      (P1 and P3 are the end points, P2 the control point.)
+
+  The parametric form of a third-order B�zier curve is:
+
+      P(t) = (1-t)^3*P1 + 3*t*(1-t)^2*P2 + 3*t^2*(1-t)*P3 + t^3*P4
+
+      (P1 and P4 are the end points, P2 and P3 the control points.)
+
+  For both formulae, t is a real number in the range [0..1].
+
+  Note  that the rasterizer  does not  use these  formulae directly.
+  They exhibit,  however, one very  useful property of  B�zier arcs:
+  Each  point of  the curve  is a  weighted average  of  the control
+  points.
+
+  As all weights  are positive and always sum up  to 1, whatever the
+  value  of t,  each arc  point lies  within the  triangle (polygon)
+  defined by the arc's three (four) control points.
+
+  In  the following,  only second-order  curves are  discussed since
+  rasterization of third-order curves is completely identical.
+
+  Here some samples for second-order curves.
+
+
+                                        *            # on curve
+                                                     * off curve
+                                     __---__
+        #-__                      _--       -_
+            --__                _-            -
+                --__           #               \
+                    --__                        #
+                        -#
+                                 Two `on' points
+         Two `on' points       and one `off' point
+                                  between them
+
+                      *
+        #            __      Two `on' points with two `off'
+         \          -  -     points between them. The point
+          \        /    \    marked `0' is the middle of the
+           -      0      \   `off' points, and is a `virtual
+            -_  _-       #   on' point where the curve passes.
+              --             It does not appear in the point
+              *              list.
+
+
+2. Profiles and Spans
+---------------------
+
+  The following is a basic explanation of the _kind_ of computations
+  made  by  the   rasterizer  to  build  a  bitmap   from  a  vector
+  representation.  Note  that the actual  implementation is slightly
+  different, due to performance tuning and other factors.
+
+  However, the following ideas remain  in the same category, and are
+  more convenient to understand.
+
+
+  a. Sweeping the Shape
+
+    The best way to fill a shape is to decompose it into a number of
+    simple  horizontal segments,  then turn  them on  in  the target
+    bitmap.  These segments are called `spans'.
+
+                __---__
+             _--       -_
+           _-            -
+          -               \
+         /                 \
+        /                   \
+       |                     \
+
+                __---__         Example: filling a shape
+             _----------_                with spans.
+           _--------------
+          ----------------\
+         /-----------------\    This is typically done from the top
+        /                   \   to the bottom of the shape, in a
+       |           |         \  movement called a `sweep'.
+                   V
+
+                __---__
+             _----------_
+           _--------------
+          ----------------\
+         /-----------------\
+        /-------------------\
+       |---------------------\
+
+
+    In  order  to draw  a  span,  the  rasterizer must  compute  its
+    coordinates, which  are simply the x coordinates  of the shape's
+    contours, taken on the y scanlines.
+
+
+                   /---/    |---|   Note that there are usually
+                  /---/     |---|   several spans per scanline.
+        |        /---/      |---|
+        |       /---/_______|---|   When rendering this shape to the
+        V      /----------------|   current scanline y, we must
+              /-----------------|   compute the x values of the
+           a /----|         |---|   points a, b, c, and d.
+      - - - *     * - - - - *   * - - y -
+           /     / b       c|   |d
+
+
+                   /---/    |---|
+                  /---/     |---|  And then turn on the spans a-b
+                 /---/      |---|  and c-d.
+                /---/_______|---|
+               /----------------|
+              /-----------------|
+           a /----|         |---|
+      - - - ####### - - - - ##### - - y -
+           /     / b       c|   |d
+
+
+  b. Decomposing Outlines into Profiles
+
+    For  each  scanline during  the  sweep,  we  need the  following
+    information:
+
+    o The  number of  spans on  the current  scanline, given  by the
+      number of  shape points  intersecting the scanline  (these are
+      the points a, b, c, and d in the above example).
+
+    o The x coordinates of these points.
+
+    x coordinates are  computed before the sweep, in  a phase called
+    `decomposition' which converts the glyph into *profiles*.
+
+    Put it simply, a `profile'  is a contour's portion that can only
+    be either ascending or descending,  i.e., it is monotonic in the
+    vertical direction (we also say  y-monotonic).  There is no such
+    thing as a horizontal profile, as we shall see.
+
+    Here are a few examples:
+
+
+      this square
+                                          1         2
+         ---->----     is made of two
+        |         |                       |         |
+        |         |       profiles        |         |
+        ^         v                       ^    +    v
+        |         |                       |         |
+        |         |                       |         |
+         ----<----
+
+                                         up        down
+
+
+      this triangle
+
+             P2                             1          2
+
+             |\        is made of two       |         \
+          ^  | \  \                         |          \
+          | |   \  \      profiles         |            \      |
+         |  |    \  v                  ^   |             \     |
+           |      \                    |  |         +     \    v
+           |       \                   |  |                \
+        P1 ---___   \                     ---___            \
+                 ---_\                          ---_         \
+             <--__     P3                   up           down
+
+
+
+      A more general contour can be made of more than two profiles:
+
+              __     ^
+             /  |   /  ___          /    |
+            /   |     /   |        /     |       /     |
+           |    |    /   /    =>  |      v      /     /
+           |    |   |   |         |      |     ^     |
+        ^  |    |___|   |  |      ^   +  |  +  |  +  v
+        |  |           |   v      |                 |
+           |           |          |           up    |
+           |___________|          |    down         |
+
+                <--               up              down
+
+
+    Successive  profiles are  always joined  by  horizontal segments
+    that are not part of the profiles themselves.
+
+    For  the  rasterizer,  a  profile  is  simply  an  *array*  that
+    associates  one  horizontal *pixel*  coordinate  to each  bitmap
+    *scanline*  crossed  by  the  contour's section  containing  the
+    profile.  Note that profiles are *oriented* up or down along the
+    glyph's original flow orientation.
+
+    In other graphics libraries, profiles are also called `edges' or
+    `edgelists'.
+
+
+  c. The Render Pool
+
+    FreeType  has been designed  to be  able to  run well  on _very_
+    light systems, including embedded systems with very few memory.
+
+    A render pool  will be allocated once; the  rasterizer uses this
+    pool for all  its needs by managing this  memory directly in it.
+    The  algorithms that are  used for  profile computation  make it
+    possible to use  the pool as a simple  growing heap.  This means
+    that this  memory management is  actually quite easy  and faster
+    than any kind of malloc()/free() combination.
+
+    Moreover,  we'll see  later that  the rasterizer  is  able, when
+    dealing with profiles too large  and numerous to lie all at once
+    in  the render  pool, to  immediately decompose  recursively the
+    rendering process  into independent sub-tasks,  each taking less
+    memory to be performed (see `sub-banding' below).
+
+    The  render pool doesn't  need to  be large.   A 4KByte  pool is
+    enough for nearly all renditions, though nearly 100% slower than
+    a more confortable 16KByte or 32KByte pool (that was tested with
+    complex glyphs at sizes over 500 pixels).
+
+
+  d. Computing Profiles Extents
+
+    Remember that a profile is an array, associating a _scanline_ to
+    the x pixel coordinate of its intersection with a contour.
+
+    Though it's not exactly how the FreeType rasterizer works, it is
+    convenient  to think  that  we need  a  profile's height  before
+    allocating it in the pool and computing its coordinates.
+
+    The profile's height  is the number of scanlines  crossed by the
+    y-monotonic section of a contour.  We thus need to compute these
+    sections from  the vectorial description.  In order  to do that,
+    we are  obliged to compute all  (local and global)  y extrema of
+    the glyph (minima and maxima).
+
+
+           P2             For instance, this triangle has only
+                          two y-extrema, which are simply
+           |\
+           | \               P2.y  as a vertical maximum
+          |   \              P3.y  as a vertical minimum
+          |    \
+         |      \            P1.y is not a vertical extremum (though
+         |       \           it is a horizontal minimum, which we
+      P1 ---___   \          don't need).
+               ---_\
+                     P3
+
+
+    Note  that the  extrema are  expressed  in pixel  units, not  in
+    scanlines.   The triangle's  height  is certainly  (P3.y-P2.y+1)
+    pixel  units,   but  its  profiles'  heights   are  computed  in
+    scanlines.  The exact conversion is simple:
+
+      - min scanline = FLOOR  ( min y )
+      - max scanline = CEILING( max y )
+
+    A problem  arises with B�zier  Arcs.  While a segment  is always
+    necessarily y-monotonic (i.e.,  flat, ascending, or descending),
+    which makes extrema computations easy,  the ascent of an arc can
+    vary between its control points.
+
+
+                          P2
+                         *
+                                       # on curve
+                                       * off curve
+                   __-x--_
+                _--       -_
+          P1  _-            -          A non y-monotonic B�zier arc.
+             #               \
+                              -        The arc goes from P1 to P3.
+                               \
+                                \  P3
+                                 #
+
+
+    We first  need to be  able to easily detect  non-monotonic arcs,
+    according to  their control points.  I will  state here, without
+    proof, that the monotony condition can be expressed as:
+
+      P1.y <= P2.y <= P3.y   for an ever-ascending arc
+
+      P1.y >= P2.y >= P3.y   for an ever-descending arc
+
+    with the special case of
+
+      P1.y = P2.y = P3.y     where the arc is said to be `flat'.
+
+    As  you can  see, these  conditions can  be very  easily tested.
+    They are, however, extremely important, as any arc that does not
+    satisfy them necessarily contains an extremum.
+
+    Note  also that  a monotonic  arc can  contain an  extremum too,
+    which is then one of its `on' points:
+
+
+        P1           P2
+          #---__   *         P1P2P3 is ever-descending, but P1
+                -_           is an y-extremum.
+                  -
+           ---_    \
+               ->   \
+                     \  P3
+                      #
+
+
+    Let's go back to our previous example:
+
+
+                          P2
+                         *
+                                       # on curve
+                                       * off curve
+                   __-x--_
+                _--       -_
+          P1  _-            -          A non-y-monotonic B�zier arc.
+             #               \
+                              -        Here we have
+                               \              P2.y >= P1.y &&
+                                \  P3         P2.y >= P3.y      (!)
+                                 #
+
+
+    We need to  compute the vertical maximum of this  arc to be able
+    to compute a profile's height (the point marked by an `x').  The
+    arc's equation indicates that  a direct computation is possible,
+    but  we rely  on a  different technique,  which use  will become
+    apparent soon.
+
+    B�zier  arcs have  the  special property  of  being very  easily
+    decomposed into two sub-arcs,  which are themselves B�zier arcs.
+    Moreover, it is easy to prove that there is at most one vertical
+    extremum on  each B�zier arc (for  second-degree curves; similar
+    conditions can be found for third-order arcs).
+
+    For instance,  the following arc  P1P2P3 can be  decomposed into
+    two sub-arcs Q1Q2Q3 and R1R2R3:
+
+
+                    P2
+                   *
+                                    # on  curve
+                                    * off curve
+
+
+                                    original B�zier arc P1P2P3.
+                __---__
+             _--       --_
+           _-             -_
+          -                 -
+         /                   \
+        /                     \
+       #                       #
+     P1                         P3
+
+
+
+                    P2
+                   *
+
+
+
+                   Q3                 Decomposed into two subarcs
+          Q2                R2        Q1Q2Q3 and R1R2R3
+            *   __-#-__   *
+             _--       --_
+           _-       R1    -_          Q1 = P1         R3 = P3
+          -                 -         Q2 = (P1+P2)/2  R2 = (P2+P3)/2
+         /                   \
+        /                     \            Q3 = R1 = (Q2+R2)/2
+       #                       #
+     Q1                         R3    Note that Q2, R2, and Q3=R1
+                                      are on a single line which is
+                                      tangent to the curve.
+
+
+    We have then decomposed  a non-y-monotonic B�zier curve into two
+    smaller sub-arcs.  Note that in the above drawing, both sub-arcs
+    are monotonic, and that the extremum is then Q3=R1.  However, in
+    a  more general  case,  only  one sub-arc  is  guaranteed to  be
+    monotonic.  Getting back to our former example:
+
+
+                    Q2
+                   *
+
+                   __-x--_ R1
+                _--       #_
+          Q1  _-        Q3  -   R2
+             #               \ *
+                              -
+                               \
+                                \  R3
+                                 #
+
+
+    Here, we see that,  though Q1Q2Q3 is still non-monotonic, R1R2R3
+    is ever  descending: We  thus know that  it doesn't  contain the
+    extremum.  We can then re-subdivide Q1Q2Q3 into two sub-arcs and
+    go  on recursively,  stopping  when we  encounter two  monotonic
+    subarcs, or when the subarcs become simply too small.
+
+    We  will finally  find  the vertical  extremum.   Note that  the
+    iterative process of finding an extremum is called `flattening'.
+
+
+  e. Computing Profiles Coordinates
+
+    Once we have the height of each profile, we are able to allocate
+    it in the render pool.   The next task is to compute coordinates
+    for each scanline.
+
+    In  the case  of segments,  the computation  is straightforward,
+    using  the  Euclidian   algorithm  (also  known  as  Bresenham).
+    However, for B�zier arcs, the job is a little more complicated.
+
+    We assume  that all B�ziers that  are part of a  profile are the
+    result of  flattening the curve,  which means that they  are all
+    y-monotonic (ascending  or descending, and never  flat).  We now
+    have  to compute the  intersections of  arcs with  the profile's
+    scanlines.  One  way is  to use a  similar scheme  to flattening
+    called `stepping'.
+
+
+                                 Consider this arc, going from P1 to
+      ---------------------      P3.  Suppose that we need to
+                                 compute its intersections with the
+                                 drawn scanlines.  As already
+      ---------------------      mentioned this can be done
+                                 directly, but the involed algorithm
+          * P2         _---# P3  is far too slow.
+      ------------- _--  --
+                  _-
+                _/               Instead, it is still possible to
+      ---------/-----------      use the decomposition property in
+              /                  the same recursive way, i.e.,
+             |                   subdivide the arc into subarcs
+      ------|--------------      until these get too small to cross
+            |                    more than one scanline!
+           |
+      -----|---------------      This is very easily done using a
+          |                      rasterizer-managed stack of
+          |                      subarcs.
+          # P1
+
+
+  f. Sweeping and Sorting the Spans
+
+    Once all our profiles have  been computed, we begin the sweep to
+    build (and fill) the spans.
+
+    As both the  TrueType and Type 1 specifications  use the winding
+    fill  rule (but  with opposite  directions), we  place,  on each
+    scanline, the present profiles in two separate lists.
+
+    One  list,  called  the  `left'  one,  only  contains  ascending
+    profiles, while  the other `right' list  contains the descending
+    profiles.
+
+    As  each glyph  is made  of  closed curves,  a simple  geometric
+    property ensures that  the two lists contain the  same number of
+    elements.
+
+    Creating spans is thus straightforward:
+
+    1. We sort each list in increasing horizontal order.
+
+    2. We pair  each value of  the left list with  its corresponding
+       value in the right list.
+
+
+                   /     /  |   |          For example, we have here
+                  /     /   |   |          four profiles.  Two of
+                >/     /    |   |  |       them are ascending (1 &
+              1//     /   ^ |   |  | 2     3), while the two others
+              //     //  3| |   |  v       are descending (2 & 4).
+              /     //4   | |   |          On the given scanline,
+           a /     /<       |   |          the left list is (1,3),
+      - - - *-----* - - - - *---* - - y -  and the right one is
+           /     / b       c|   |d         (4,2) (sorted).
+
+                                   There are then two spans, joining
+                                   1 to 4 (i.e. a-b) and 3 to 2
+                                   (i.e. c-d)!
+
+
+    Sorting doesn't necessarily  take much time, as in  99 cases out
+    of 100, the lists' order is  kept from one scanline to the next.
+    We can  thus implement it  with two simple  singly-linked lists,
+    sorted by a classic bubble-sort, which takes a minimum amount of
+    time when the lists are already sorted.
+
+    A  previous  version  of  the  rasterizer  used  more  elaborate
+    structures, like arrays to  perform `faster' sorting.  It turned
+    out that  this old scheme is  not faster than  the one described
+    above.
+
+    Once the spans  have been `created', we can  simply draw them in
+    the target bitmap.
+
+
+--- end of raster.txt ---
+
+Local Variables:
+coding: latin-1
+End:

reactos/lib/freetype/docs
CHANGES 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- CHANGES	15 Feb 2004 21:45:29 -0000	1.5
+++ CHANGES	10 May 2004 17:48:26 -0000	1.6
@@ -1,316 +1,568 @@
 
-LATEST CHANGES BETWEEN 2.1.5 and 2.1.4
+LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
+
+  I. IMPORTANT BUG FIXES
+
+    - The native  TrueType hinter contained some  bugs which prevented
+      some fonts to be rendered correctly, most notably Legendum.otf.
+
+    - The PostScript hinter now produces improved results.
+
+    - The  linear advance  width  and height  values were  incorrectly
+      rounded,  making  them virtually  unusable  if  not loaded  with
+      FT_LOAD_LINEAR_DESIGN.
+
+    - Indexing CID-keyed CFF fonts is  now working: The glyph index is
+      correctly  treated as a  CID, similar  to FreeType's  CID driver
+      module.  Note that CID CMap support is still missing.
+
+    - The FT_FACE_FLAGS_GLYPH_NAMES flag is now  set correctly for all
+      font formats.
+
+    - Some subsetted Type 1  fonts weren't parsed correctly.  This bug
+      has been introduced in 2.1.7.  In summary, the Type 1 parser has
+      become more robust.
+
+    - Non-decimal numbers weren't parsed correctly in PS fonts.
+
+    - The WinFNT driver now correctly reports FT_ENCODING_NONE for all
+      but one encoding.  Use  the new FT_WinFNT_ID_XXX values together
+      with FT_Get_WinFNT_Header() to get the WinFNT charset ID.
+
+    - The descender metrics (face->size->metrics.descender) for WinFNT
+      bitmap fonts had the wrong sign.
+
+    - The (emulated) `seac' support for CFF fonts was broken.
+
+    - The `flex' operator didn't work for CFF fonts.
+
+    - PS glyphs  which  use  the   `hintmask'  operator  haven't  been
+      rendered correctly in some cases.
+
+    - Metrics for BDF and PCF bitmap font formats have been fixed.
+
+    - Autohinting  is now  disabled for  glyphs  which  are vertically
+      distorted  or mirrored  (using a  transformation matrix).   This
+      fixes a bug which produced zero-height glyphs.
+
+    - The   `freetype-config'   script   now  handles   --prefix   and
+      --exec-prefix correctly; it also  returns the proper --rpath (or
+      -R) value if FreeType has been built as a shared library.
+
+
+  II. IMPORTANT CHANGES
+
+    - Both  PCF  and BDF  drivers  now  handle  the SETWIDTH_NAME  and
+      ADD_STYLE_NAME    properties.     Values    are   appended    to
+      face->style_name; example: `Bold SemiCondensed'.
+
+    - The PCF driver now handles bitmap  fonts compressed with the LZW
+      algorithm (extension .pcf.Z, compressed with `compress').
+
+    - A  new  API   function  `FT_Get_CMap_Language_ID'  (declared  in
+      `tttables.h')  is  available  to   get  the  language  ID  of  a
+      TrueType/SFNT cmap.
+
+    - The hexadecimal format of  data after the `StartData' command in
+      CID-keyed Type 1 fonts is now supported.  While this can't occur
+      in  file-based   fonts,  it  can   happen  in  document-embedded
+      resources of PostScript documents.
+
+    - Embedded bitmaps in SFNT-based CFF fonts are now supported.
+
+    - A simple  API is  now available  to control  FreeType's  tracing
+      mechanism if compiled  with FT_DEBUG_LEVEL_TRACE.   See the file
+      `ftdebug.h' for more details.
+
+    - YAMATO Masatake contributed improved  handling of MacOS resource
+      forks on non-MacOS platforms (for example, Linux can mount MacOS
+      file systems).
+
+    - Support for MacOS has been improved; there is now a new function
+      `FT_New_Face_From_FSSpec'  similar to `FT_New_Face'  except that
+      it accepts an FSSpec instead of a path.
+
+    - The cache sub-system has been rewritten.
+
+      - There is now support for deinstallation of faces.
+
+      - A new  API function `FTC_Manager_RemoveFaceID'  has been added
+        to  delete  all  `idle'  nodes  that  correspond  to  a  given
+        FTC_FaceID.  All `locked' nodes  (i.e., those with a reference
+        count > 0), will be modified to prevent them from appearing in
+        further  lookups (they  will  be cleaned  normally when  their
+        reference count reaches 0).
+
+      - There  is  now  support  for point  scaling  (i.e.,  providing
+        character sizes in points + dpis, instead of pixels).
+
+      - Three abstract cache classes are now available:
+
+          FTC_GCache:  Used to store  one glyph  item per  cache node,
+                      with the ability to group common attributes into
+                      `families'.      This    replaces     the    old
+                      FTC_GlyphCache class.
+
+          FTC_ICache: Used to store one FT_Glyph per cache node.  This
+                      extends  FTC_GCache.  Family  definition, family
+                      comparison, and  glyph loading are  however left
+                      to sub-classes.
+
+          FTC_SCache: Used to  store up to 16 small  bitmaps per cache
+                      node.    This    extends   FTC_GCache.    Family
+                      definition, family  comparison and glyph loading
+                      are however left to sub-classes.
+
+      - The file `src/cache/ftcbasic.c' implements:
+
+          FTC_ImageCache: Extends    FTC_ICache;   implements   family
+                          definitions and glyph loading similar to the
+                          old API.
+
+          FTC_SBitCache: Extends    FTC_SCache,    implements   family
+                         definitions and glyph  loading similar to the
+                         old API
+
+        Client  applications  should  be  able to  extend  FTC_GCache,
+        FTC_ICache, or FTC_SCache much more easily (i.e., less code to
+        write, and  less callbacks).  For example,  one could envision
+        caches  that are  capable of  storing  transformed (obliqued),
+        stroked,   emboldened,   or   colored   glyph   images.    Use
+        `ftcbasic.c' as an example.
+
+      - All public  APIs are now  in `include/freetype/ftcache.h', (to
+        be    accessed   as    `FT_CACHE_H').     The   contents    of
+        `include/freetype/cache/' is only  needed by applications that
+        wish to implement their own caches.
+
+      - There were some major performance improvements through the use
+        of  various programming  tricks.   Cache hits  are  up to  70%
+        faster than in the old code.
+
+      - The  FTC_CMapCache has  been simplied.   Charmaps can  only be
+        accessed by  index right now.  There  is also a  new API named
+        `FT_Charmap_GetIndex' for this purpose.
+
+      - The  demo programs  have been  updated to  the new  code.  The
+        previous versions will not work with the current one.
+
+      - Using  an invalid face  index in FT_Open_Face and friends  now
+        causes an error even if the font contains a single face only.
+
+
+  III. MISCELLANEOUS
+
+    - Wolfgang Domr�se contributed support files for building FreeType
+      on the Atari using the PureC compiler.  Note that the Atari is a
+      16bit platform.
+
+    - Vitaliy Pasternak contributed project files for VS.NET 2003.
+
+
+======================================================================
+
+LATEST CHANGES BETWEEN 2.1.7 and 2.1.6
+
+  I. IMPORTANT BUG FIXES
+
+    - Updated  to newest  libtool  version, fixing  build problems  on
+      various platforms.
+
+    - On  Unix  platforms,  `make  install' didn't  copy  the  correct
+      `ftconfig.h' file.
+
+  Note that version 2.1.7  contains the same library  C source code as
+  version 2.1.6.
 
 
+======================================================================
+
+LATEST CHANGES BETWEEN 2.1.6 and 2.1.5
+
   I. IMPORTANT BUG FIXES
 
-    - Parsing the /CIDFontName field now removes the leading slash to
+    - The PFR  font driver didn't  load kerning tables  correctly, and
+      the functions in FT_PFR_H didn't work at all.
+
+    - Type 1 font  files in  binary format  (PFB) with  an end-of-file
+      indicator weren't accepted by the FreeType engine.
+
+    - Fonts which contain /PaintType  and /StrokeWidth no longer cause
+      a segfault.  This bug has been introduced in version 2.1.5.
+
+    - Fonts  loaded  with   FT_LOAD_RENDER  no  longer  cause  strange
+      results.  This bug has been introduced in version 2.1.5.
+
+    - Some  Windows   (bitmap)  FNT/FON  files   couldn't  be  handled
+      correctly.
+
+
+  II. IMPORTANT CHANGES
+
+    - The internal  module API  has been heavily  changed in  favor of
+      massive simplifications within the font engine.  This also means
+      that authors of third-party modules must adapt their code to the
+      new scheme.
+
+      NOTE:  THE NEW SCHEME IS NOT COMPLETED YET.  PLEASE WAIT UNTIL A
+      FINAL ANNOUNCEMENT!
+
+    - The PostScript  parser has been enhanced to  handle comments and
+      strings   correctly.   Additionally,   more  syntax   forms  are
+      recognized.
+
+    - Added the  optional unpatented hinting system  for TrueType.  It
+      allows  typefaces which  need hinting  to produce  correct glyph
+      forms (e.g., Chinese typefaces  from Dynalab) to work acceptably
+      without infringing Apple patents.   This system is compiled only
+      if  TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING  is  defined  in
+      ftoption.h (activated by default).
+
+
+  III. MISCELLANEOUS
+
+    - There  is now  a guard  in the  public header  files  to protect
+      against inclusion of freetype.h from FreeType 1.
+
+    - Direct inclusion of freetype.h  and other public header files no
+      longer works.  You have to use the documented scheme
+
+        #include <ft2build.h>
+        #include FT_FREETYPE_H
+
+      to load freetype.h with  a symbolic name.  This protects against
+      renaming  of public  header  files (which  shouldn't happen  but
+      actually  has, avoiding two  public header  files with  the same
+      name).
+
+
+======================================================================
+
+LATEST CHANGES BETWEEN 2.1.5 and 2.1.4
+
+  I. IMPORTANT BUG FIXES
+
+    - Parsing the /CIDFontName field  now removes the leading slash to
       be in sync with other font drivers.
 
-    - gzip support was buggy. Some fonts could not be read.
+    - gzip support was buggy.  Some fonts could not be read.
 
-    - Fonts which have nested subglyphs more than one level deep no
+    - Fonts which  have nested subglyphs  more than one level  deep no
       longer cause a segfault.
 
-    - Creation of synthetic cmaps for fonts in CFF format was broken
+    - Creation of synthetic  cmaps for fonts in CFF  format was broken
       partially.
 
-    - Numeric font dictionary entries for synthetic fonts are no longer
-      overwritten.
+    - Numeric  font  dictionary entries  for  synthetic  fonts are  no
+      longer overwritten.
 
-    - The font matrix wasn't applied to the advance width for Type1, CID,
-      and CFF fonts. This caused problem when loading certain synthetic
-      Type 1 fonts like "Helvetica Narrow"
+    - The font matrix  wasn't applied to the advance  width for Type1,
+      CID, and  CFF fonts.  This caused problems  when loading certain
+      synthetic Type 1 fonts like `Helvetica Narrow'.
 
-    - The test for the charset registry in BDF and PCF fonts is now
+    - The test  for the charset registry  in BDF and PCF  fonts is now
       case-insensitive.
 
-    - FT_Vector_Rotate rotating sometimes returned strange values due to
+    - FT_Vector_Rotate  sometimes  returned   strange  values  due  to
       rounding errors.
 
-    - The PCF driver now returns the correct number of glyphs (including
-      an artificial `notdef' glyph at index 0).
+    - The  PCF  driver  now  returns  the  correct  number  of  glyphs
+      (including an artificial `notdef' glyph at index 0).
 
-    - FreeType now supports buggy CMaps which are contained in many CJK
-      fonts from Dynalab.
+    - FreeType now  supports buggy CMaps  which are contained  in many
+      CJK fonts from Dynalab.
 
-    - Opening an invalid font on a Mac caused a segfault due to
+    - Opening  an invalid  font  on a  Mac  caused a  segfault due  to
       double-freeing memory.
 
-    - BDF fonts with more than 32768 glyphs weren't supported properly.
+    - BDF  fonts  with  more   than  32768  glyphs  weren't  supported
+      properly.
 
 
   II. IMPORTANT CHANGES
 
     - Accessing bitmap font formats has been synchronized.  To do that
-      the FT_Bitmap_Size structure has been extended to contain new
+      the FT_Bitmap_Size  structure has  been extended to  contain new
       fields `size', `x_ppem', and `y_ppem'.
 
     - The FNT driver now returns multiple faces, not multiple strikes.
 
-    - The `psnames' module has been updated to the Adobe Glyph List
+    - The `psnames'  module has been  updated to the Adobe  Glyph List
       version 2.0.
 
     - The `psnames' module now understands `uXXXX[X[X]]' glyph names.
 
     - The algorithm for guessing the font style has been improved.
 
-    - For fonts in sfnt format, root->height is no longer increased if
-      the line gap is zero.  There exist fonts (containing e.g. form
-      drawing characters) which intentionally have a zero line gap value.
+    - For fonts in SFNT format, root->height is no longer increased if
+      the line gap  is zero.  There exist fonts  (containing e.g. form
+      drawing  characters) which  intentionally have  a zero  line gap
+      value.
 
-    - ft_glyph_bbox_xxx flags are now deprecated in favour of
+    - ft_glyph_bbox_xxx  flags   are  now  deprecated   in  favour  of
       FT_GLYPH_BBOX_XXX.
 
-    - ft_module_xxx flags are now deprecated in favour of FT_MODULE_XXX.
+    - ft_module_xxx   flags   are   now   deprecated  in   favour   of
+      FT_MODULE_XXX.
 
-    - FT_ENCODING_MS_{SJIS,GB2312,BIG5,WANSUNG,JOHAB} are now deprecated
-      in favour of FT_ENCODING_{SJIS,GB2312,GIB5,WANSONG,JOHAB} -- those
-      encodings are not specific to Microsoft.
+    - FT_ENCODING_MS_{SJIS,GB2312,BIG5,WANSUNG,JOHAB}      are     now
+      deprecated               in               favour              of
+      FT_ENCODING_{SJIS,GB2312,GIB5,WANSONG,JOHAB}  -- those encodings
+      are not specific to Microsoft.
 
 
   III. MISCELLANEOUS
 
-    - The autohinter has been further improved; for example, `m' glyphs
-      now retain its vertical symmetry.
+    - The  autohinter  has been  further  improved;  for example,  `m'
+      glyphs now retain its vertical symmetry.
 
     - Partial support of Mac fonts on non-Mac platforms.
 
-    - `make refdoc' (after first `make') builds the HTML documentation.
-      You need Python for this.
+    - `make   refdoc'   (after   first   `make')   builds   the   HTML
+      documentation.  You need Python for this.
 
-    - The make build system should now work more reliably on DOS-like
+    - The make build system should  now work more reliably on DOS-like
       platforms.
 
-    - Support for EMX gcc and Watson C/C++ compilers on MS-DOS has been
-      added.
+    - Support for  EMX gcc  and Watson C/C++  compilers on  MS-DOS has
+      been added.
 
     - Better VMS build support.
 
-    - Support for the pkg-config package by providing a `freetype.pc'
+    - Support for the pkg-config  package by providing a `freetype.pc'
       file.
 
     - New configure option --with-old-mac-fonts for Darwin.
 
-    - Some source files have been renamed (mainly to fit into the 8.3
+    - Some source files have been  renamed (mainly to fit into the 8.3
       naming scheme).
 
 
-==============================================================================
+======================================================================
 
 LATEST CHANGES BETWEEN 2.1.4 and 2.1.3
 
   I. IMPORTANT BUG FIXES
 
-    - Updated to newest libtool version, fixing build problems on various
-      platforms.
+    - Updated  to newest  libtool  version, fixing  build problems  on
+      various platforms.
 
-    - A fix in the Gzip stream reader: It couldn't read certain .gz files
-      properly due to a small typo.  In certain cases, FreeType could also
-      loop endlessly when trying to load tiny gzipped files.
-
-    - The configure script now tries to use the system-wide zlib when
-      it finds one (instead of the copy found in src/gzip).  And
-      "freetype-config" has been updated to return relevant flags in this
-      case when invoked with "--libs" (e.g. "-lzlib").
-
-    - Certain fonts couldn't be loaded by 2.1.3 because they lacked a
-      Unicode charmap (e.g. SYMBOL.TTF).  FreeType erroneously rejected
-      them.
+    - A fix  in the Gzip stream  reader: It couldn't  read certain .gz
+      files properly due to a  small typo.  In certain cases, FreeType
+      could  also loop  endlessly  when trying  to  load tiny  gzipped
+      files.
+
+    - The configure script now tries  to use the system-wide zlib when
+      it  finds one  (instead of  the  copy found  in src/gzip).   And
+      "freetype-config" has  been updated to return  relevant flags in
+      this case when invoked with "--libs" (e.g. "-lzlib").
+
+    - Certain fonts couldn't be loaded  by 2.1.3 because they lacked a
+      Unicode   charmap  (e.g.   SYMBOL.TTF).    FreeType  erroneously
+      rejected them.
 
     - The CFF loader was modified to accept fonts which only contain a
-      subset of their reference charset.  This prevented the correct use
-      of PDF-embedded fonts.
+      subset of  their reference charset.  This  prevented the correct
+      use of PDF-embedded fonts.
 
     - The logic to detect Unicode charmaps has been modified.  This is
-      required to support fonts which include both 16-bit and 32-bit
-      charmaps (like very recent asian ones) using the new 10 and 12 SFNT
-      formats.
-
-    - The TrueType loader now limits the depth of composite glyphs.  This is
-      necessary to prevent broken fonts to break the engine by blowing the
-      stack with recursive glyph definitions.
+      required to  support fonts which include both  16-bit and 32-bit
+      charmaps (like very  recent asian ones) using the  new 10 and 12
+      SFNT formats.
+
+    - The TrueType  loader now limits  the depth of  composite glyphs.
+      This is necessary to prevent broken fonts to break the engine by
+      blowing the stack with recursive glyph definitions.
+
+    - The CMap cache is now  capable of managing UCS-4 character codes
+      that   are   mapped   through   extended  charmaps   in   recent
+      TrueType/OpenType fonts.
+
+    - The   cache  sub-system   now  properly   manages  out-of-memory
+      conditions  instead of  blindly  reporting them  to the  caller.
+      This means that it will try to empty the cache before restarting
+      its allocations to see if that can help.
 
-    - The CMap cache is now capable of managing UCS-4 character codes that
-      are mapped through extended charmaps in recent TrueType/OpenType
-      fonts.
+    - The  PFR driver  didn't return  the list  of  available embedded
+      bitmaps properly.
 
-    - The cache sub-system now properly manages out-of-memory conditions
-      instead of blindly reporting them to the caller.  This means that it
-      will try to empty the cache before restarting its allocations to see
-      if that can help.
-
-    - The PFR driver didn't return the list of available embedded bitmaps
-      properly.
-
-    - There was a nasty memory leak when using embedded bitmaps in certain
-      font formats.
+    - There was  a nasty  memory leak when  using embedded  bitmaps in
+      certain font formats.
 
 
   II. IMPORTANT CHANGES
 
-    - David Chester contributed some enhancements to the auto-hinter that
-      significantly increase the quality of its output.  The Postscript
-      hinter was also improved in several ways.
+    - David Chester  contributed some enhancements  to the auto-hinter
+      that  significantly increase  the  quality of  its output.   The
+      Postscript hinter was also improved in several ways.
 
     - The FT_RENDER_MODE_LIGHT render mode was implemented.
 
-    - A new API function called `FT_Get_BDF_Property' has been added to
-      FT_BDF_H to retrieve BDF properties from BDF _and_ PCF font files.
-      THIS IS STILL EXPERIMENTAL, since it hasn't been properly tested yet.
+    - A new  API function called `FT_Get_BDF_Property'  has been added
+      to FT_BDF_H to  retrieve BDF properties from BDF  _and_ PCF font
+      files.   THIS  IS  STILL  EXPERIMENTAL,  since  it  hasn't  been
+      properly tested yet.
 
     - A Windows FNT specific API has been added, mostly to access font
       headers.  This is used by Wine.
 
-    - TrueType tables without an "hmtx" table are now tolerated when an
-      incremental interface is used.  This happens for certain Type42 fonts
-      passed from Ghostscript to FreeType.
-
-    - The PFR font driver is now capable of returning the font family and
-      style names when they are available (instead of the sole "FontID").
-      This is performed by parsing an *undocumented* portion of the font
-      file!
+    - TrueType tables  without an "hmtx" table are  now tolerated when
+      an  incremental interface  is  used.  This  happens for  certain
+      Type42 fonts passed from Ghostscript to FreeType.
+
+    - The PFR font driver is  now capable of returning the font family
+      and style  names when  they are available  (instead of  the sole
+      "FontID").   This  is  performed  by parsing  an  *undocumented*
+      portion of the font file!
 
 
   III. MISCELLANEOUS
 
-    - The path stroker in FT_STROKER_H has entered beta stage.  It now works
-      very well, but its interface might change a bit in the future.  More
-      on this in later releases.
+    - The path stroker in FT_STROKER_H has entered beta stage.  It now
+      works very  well, but  its interface might  change a bit  in the
+      future.  More on this in later releases.
 
-    - The documentation for FT_Size_Metrics didn't appear properly in the
-      API reference.
+    - The documentation for  FT_Size_Metrics didn't appear properly in
+      the API reference.
 
     - The file docs/VERSION.DLL has been updated to explain versioning
-      with FreeType (i.e., comparing release/libtool/so numbers, and how to
-      use them in autoconf scripts).
+      with FreeType  (i.e., comparing release/libtool/so  numbers, and
+      how to use them in autoconf scripts).
 
-    - The installation documentation has been seriously revamped.
+    - The  installation  documentation  has been  seriously  revamped.
       Everything is now in the "docs" directory.
 
 
-==============================================================================
+======================================================================
 
 LATEST CHANGES BETWEEN 2.1.3 and 2.1.2
 
   I. IMPORTANT BUG FIXES
 
-    - FT_Vector_Transform had been incorrectly modified in 2.1.2, resulting
-      in incorrect transformations being applied (for example, rotations
-      were processed in opposite angles).
-
-    - The format 8 and 12 TrueType charmap enumeration routines have been
-      fixed (FT_Get_Next_Char returned invalid values).
-
-    - The PFR font driver returned incorrect advance widths if the outline
-      and metrics resolution defined in the font file were different.
+    - FT_Vector_Transform  had  been  incorrectly modified  in  2.1.2,
+      resulting  in  incorrect   transformations  being  applied  (for
+      example, rotations were processed in opposite angles).
+
+    - The format  8 and 12 TrueType charmap  enumeration routines have
+      been fixed (FT_Get_Next_Char returned invalid values).
+
+    - The  PFR font driver  returned incorrect  advance widths  if the
+      outline  and metrics resolution  defined in  the font  file were
+      different.
 
-    - FT_Glyph_To_Bitmap now returns successfully when called with an
+    - FT_Glyph_To_Bitmap now returns  successfully when called with an
       FT_BitmapGlyph argument (it previously returned an error).
 
-    - A bug in the Type 1 loader that prevented valid font bounding boxes to
-      be loaded from multiple master fonts.
+    - A bug  in the Type 1  loader that prevented  valid font bounding
+      boxes to be loaded from multiple master fonts.
 
-    - The SFNT validation code has been rewritten.  FreeType can now load
-      "broken" fonts that were usable on Windows, but not with previous
-      versions of the library.
+    - The SFNT  validation code has been rewritten.   FreeType can now
+      load "broken"  fonts that were  usable on Windows, but  not with
+      previous versions of the library.
 
     - The computation of bearings in the BDF driver has been fixed.
 
-    - The Postscript hinter crashed when trying to hint certain glyphs (more
-      precisely, when trying to apply hints to an empty glyph outline).
-
-    - The TrueType glyph loader now supports composites in "Apple format"
-      (they differ slightly from Microsoft/OpenType ones in the way
-      transformation offsets are computed).
-
-    - FreeType was very slow at opening certain asian CID/CFF fonts, due
-      to fixed increment in dynamic array re-allocations.  This has been
-      changed to exponential behaviour to get acceptable performance.
+    - The Postscript hinter crashed when trying to hint certain glyphs
+      (more precisely,  when trying to  apply hints to an  empty glyph
+      outline).
+
+    - The  TrueType glyph  loader  now supports  composites in  "Apple
+      format"  (they differ slightly  from Microsoft/OpenType  ones in
+      the way transformation offsets are computed).
+
+    - FreeType was  very slow at opening certain  asian CID/CFF fonts,
+      due to  fixed increment  in dynamic array  re-allocations.  This
+      has  been changed  to  exponential behaviour  to get  acceptable
+      performance.
 
 
 
   II. IMPORTANT CHANGES
 
-    - The PCF driver now supports gzip-compressed font files natively.  This
-      means that you will be able to use all these bitmap fonts that come
-      with XFree86 with FreeType (and libXft/libXft2, by extension).
-
-    - The automatic and postscript hinters have both been updated.  This
-      results in a relatively important increase of rendering quality since
-      many nasty defaults have been supressed.  Please visit the web page:
+    - The PCF driver now supports gzip-compressed font files natively.
+      This means that  you will be able to use  all these bitmap fonts
+      that  come with  XFree86 with  FreeType (and  libXft/libXft2, by
+      extension).
+
+    - The  automatic and  postscript hinters  have both  been updated.
+      This  results in  a relatively  important increase  of rendering
+      quality since  many nasty defaults have  been supressed.  Please
+      visit the web page:
 
         http://www.freetype.org/hinting/smooth-hinting.html
 
       for additional details on this topic.
 
-    - The "load_flags" parameter of FT_Load_Glyph is now an FT_Int32
-      (instead of just being an FT_Int).  This breaks source and binary
-      compatibility for 16bit systems only, while retaining both of them for
-      32 and 64 bit ones.
+    - The "load_flags"  parameter of FT_Load_Glyph is  now an FT_Int32
+      (instead  of just  being  an FT_Int).   This  breaks source  and
+      binary  compatibility for  16bit systems  only,  while retaining
+      both of them for 32 and 64 bit ones.
 
       Some new flags have been added consequently:
 
         FT_LOAD_NO_AUTOHINT   :: Disable the use of the auto-hinter
                                  (but not native format hinters).
 
-        FT_LOAD_TARGET_NORMAL :: Hint and render for normal anti-aliased
-                                 displays.
+        FT_LOAD_TARGET_NORMAL :: Hint and render for normal
+                                 anti-aliased displays.
 
         FT_LOAD_TARGET_MONO   :: Hint and render for 1-bit displays.
 
-        FT_LOAD_TARGET_LCD    :: Hint and render for horizontal RGB or BGR
-                                 sub-pixel displays (like LCD screens).
-                                 THIS IS STILL EXPERIMENTAL!
-
-        FT_LOAD_TARGET_LCD_V  :: Same as FT_LOAD_TARGET_LCD, for vertical
-                                 sub-pixel displays (like rotated LCD
-                                 screens).  THIS IS STILL EXPERIMENTAL!
-
-      FT_LOAD_MONOCHROME is still supported, but only affects rendering, not
-      the hinting.
-
-      Note that the 'ftview' demo program available in the 'ft2demos' package
-      has been updated to support LCD-optimized display on non-paletted
-      displays (under Win32 and X11).
+        FT_LOAD_TARGET_LCD    :: Hint and render for horizontal RGB or
+                                 BGR sub-pixel displays (like LCD
+                                 screens).  THIS IS STILL
+                                 EXPERIMENTAL!
+
+        FT_LOAD_TARGET_LCD_V  :: Same as FT_LOAD_TARGET_LCD, for
+                                 vertical sub-pixel displays (like
+                                 rotated LCD screens).  THIS IS STILL
+                                 EXPERIMENTAL!
+
+      FT_LOAD_MONOCHROME   is  still   supported,  but   only  affects
+      rendering, not the hinting.
+
+      Note that the `ftview'  demo program available in the `ft2demos'
+      package  has been  updated to  support LCD-optimized  display on
+      non-paletted displays (under Win32 and X11).
 
-    - The PFR driver now supports embedded bitmaps (all formats supported),
-      and returns correct kerning metrics for all glyphs.
+    - The  PFR  driver  now  supports embedded  bitmaps  (all  formats
+      supported), and returns correct kerning metrics for all glyphs.
 
-    - The TrueType charmap loader now supports certain "broken" fonts that
-      load under Windows without problems.
+    - The TrueType charmap loader  now supports certain `broken' fonts
+      that load under Windows without problems.
 
     - The cache API has been slightly modified (it's still a beta!):
 
-       - The type FTC_ImageDesc has been removed; it is now replaced by
-         FTC_ImageTypeRec.  Note that one of its fields is a `load_flag'
-         parameter for FT_Load_Glyph.
-
-       - The field "num_grays" of FT_SBitRec has been changed to "max_grays"
-         in order to fit within a single byte.  Its maximum value is thus 255
-         (instead of 256 as previously).
+       - The type  FTC_ImageDesc has been removed; it  is now replaced
+         by  FTC_ImageTypeRec.   Note that  one  of  its  fields is  a
+         `load_flag' parameter for FT_Load_Glyph.
+
+       - The  field  "num_grays" of  FT_SBitRec  has  been changed  to
+         "max_grays"  in  order to  fit  within  a  single byte.   Its
+         maximum value is thus 255 (instead of 256 as previously).
 
 
   III. MISCELLANEOUS
 
-    - Added support for the DESTDIR variable during "make install".  This
-      simplifies packaging of FreeType.
+    - Added support  for the  DESTDIR variable during  "make install".
+      This simplifies packaging of FreeType.
 
-    - Included modified copies of the ZLib sources in 'src/gzip' in order to
-      support gzip-compressed PCF fonts.  We do not use the system-provided
-      zlib for now, though this is a probable enhancement for future
-      releases.
+    - Included modified  copies of the  ZLib sources in  `src/gzip' in
+      order to support  gzip-compressed PCF fonts.  We do  not use the
+      system-provided  zlib  for  now,   though  this  is  a  probable
+      enhancement for future releases.
 
-    - The DocMaker tool used to generate the on-line API reference has been
-      completely rewritten.  It is now located in
+    - The DocMaker tool used to generate the on-line API reference has
+      been   completely    rewritten.    It   is    now   located   in
       "src/tools/docmaker/docmaker.py".  Features:
 
         - better cross-referenced output
         - more polished output
-        - uses Python regular expressions (though it didn't speed the
+        - uses Python regular expressions  (though it didn't speed the
           program)
-        - much more modular structure, which allows for different "backends"
-          in order to generate HTML, XML, or whatever format.
+        - much  more  modular structure,  which  allows for  different
+          "backends"  in  order to  generate  HTML,  XML, or  whatever
+          format.
 
       One can regenerate the API reference by calling:
 
@@ -323,86 +575,92 @@
                 include/freetype/cache/*.h
 
     - A new, experimental, support for incremental font loading (i.e.,
-      loading of fonts where the glyphs are not in the font file itself, but
-      provided by an external component, like a Postscript interpreter) has
-      been added by Graham Asher.  This is still work in progress, however.
-
-    - A new, EXPERIMENTAL, path stroker has been added.  It doesn't suffer
-      from severe rounding errors and treat bezier arcs directly.  Still
-      work in progress (i.e. not part of the official API).  See the file
-      <freetype/ftstroker.h> for some of the details.
+      loading  of fonts  where the  glyphs are  not in  the  font file
+      itself, but provided by an external component, like a Postscript
+      interpreter) has been added by Graham Asher.  This is still work
+      in progress, however.
+
+    - A new,  EXPERIMENTAL, path stroker  has been added.   It doesn't
+      suffer  from  severe  rounding  errors  and  treat  bezier  arcs
+      directly.  Still work in progress (i.e. not part of the official
+      API).   See  the file  <freetype/ftstroker.h>  for  some of  the
+      details.
 
-    - The massive re-formatting of sources and internal re-design is still
-      under-way.  Many internal functions, constants, and types have been
-      renamed.
+    - The massive  re-formatting of sources and  internal re-design is
+      still under-way.  Many  internal functions, constants, and types
+      have been renamed.
 
 
-========================================================================
+======================================================================
 
 LATEST CHANGES BETWEEN 2.1.2 and 2.1.1
 
   I. IMPORTANT BUG FIXES
 
-    - Many font drivers didn't select a Unicode charmap by default when
-      a new face was opened (with the FT_CONFIG_OPTION_USE_CMAPS options
-      enabled), causing many applications to not be able to display text
-      correctly with the 2.1.x releases.
+    - Many  font drivers didn't  select a  Unicode charmap  by default
+      when a new face  was opened (with the FT_CONFIG_OPTION_USE_CMAPS
+      options enabled),  causing many applications  to not be  able to
+      display text correctly with the 2.1.x releases.
 
-    - The PFR driver had a bug in its composite loading code that produces
-      incorrectly placed accents with many fonts.
+    - The  PFR driver had  a bug  in its  composite loading  code that
+      produces incorrectly placed accents with many fonts.
 
     - The Type42 driver crashed sometimes due to a nasty bug.
 
-    - The Type 1 custom encoding charmap didn't handle the case where the
-      first glyph index wasn't 0.
+    - The Type 1 custom encoding  charmap didn't handle the case where
+      the first glyph index wasn't 0.
 
-    - A serious typo in the TrueType composite loader produced incorrectly
-      placed glyphs in fonts like "Wingdings" and a few others.
+    - A  serious  typo  in  the  TrueType  composite  loader  produced
+      incorrectly placed  glyphs in fonts  like "Wingdings" and  a few
+      others.
 
 
   II. MISCELLANEOUS
 
-    - The Win32 Visual C++ project file has been updated to include the
-      PFR driver as well.
+    - The Win32  Visual C++ project  file has been updated  to include
+      the PFR driver as well.
 
-    - "freetype.m4" is now installed by default by "make install" on Unix
-      systems.
+    - "freetype.m4" is  now installed by default by  "make install" on
+      Unix systems.
 
-    - The function FT_Get_PS_Font_Info now works with CID and Type42 fonts
-      as well.
+    - The function  FT_Get_PS_Font_Info now works with  CID and Type42
+      fonts as well.
 
 
-========================================================================
+======================================================================
 
 LATEST CHANGES BETWEEN 2.1.1 and 2.1.0
 
   I. IMPORTANT BUG FIXES
 
-    - The `version_info' returned by `freetype-config' in 2.1.0 returned an
-      invalid value. It now returns 9:1:3 (2.0.9 returned 9:0:3).
-
-    - Version 2.1.0 couldn't be linked against applications on Win32 and
-      Amiga systems due to a new debug function that wasn't properly
-      propagated to the system-specific directory in `builds'.
+    - The  `version_info'  returned   by  `freetype-config'  in  2.1.0
+      returned an invalid value.  It now returns 9:1:3 (2.0.9 returned
+      9:0:3).
+
+    - Version 2.1.0  couldn't be linked against  applications on Win32
+      and  Amiga systems  due  to  a new  debug  function that  wasn't
+      properly   propagated  to   the  system-specific   directory  in
+      `builds'.
 
     - Various MacOS and Mac OS X specific fixes.
 
-    - Fixed a bug in the TrueType charmap validation routines that made
-      version 2.1.0 too restrictive -- many popular fonts have been
-      rejected.
-
-    - There was still a very small difference between the monochrome glyph
-      bitmaps produced by FreeType 1.x and FreeType 2.x with the bytecode
-      interpreter enabled.  This was caused by an invalid flag setting in
-      the TrueType glyph loader, making the rasterizer change its drop-out
-      control mode.  Now theresults should _really_ be completely identical.
+    - Fixed  a bug in  the TrueType  charmap validation  routines that
+      made version  2.1.0 too restrictive  -- many popular  fonts have
+      been rejected.
+
+    - There was  still a very small difference  between the monochrome
+      glyph bitmaps produced by FreeType 1.x and FreeType 2.x with the
+      bytecode  interpreter enabled.   This was  caused by  an invalid
+      flag setting in the TrueType glyph loader, making the rasterizer
+      change  its  drop-out   control  mode.   Now  theresults  should
+      _really_ be completely identical.
 
     - The TrueType name table loader has been improved to support many
-      popular though buggy Asian fonts.  It now ignores empty name entries,
-      invalid pointer offsets and a few other incorrect subtleties.
-      Moreover, name strings are now loaded on demand, which reduces the
-      memory load of many faces (e.g. the ARIAL.TTF font file contains a
-      10kByte name table with 70 names).
+      popular  though buggy Asian  fonts.  It  now ignores  empty name
+      entries,  invalid  pointer offsets  and  a  few other  incorrect
+      subtleties.  Moreover,  name strings  are now loaded  on demand,
+      which reduces the memory load  of many faces (e.g. the ARIAL.TTF
+      font file contains a 10kByte name table with 70 names).
 
     - Fixed a bug in the Postscript hinter that prevented family blues
       substitution to happen correctly.
@@ -412,116 +670,119 @@
 
     - Three new font drivers in this release:
 
-      * A BDF font driver, contributed by Franco Zappa Nardelli, heavily
-        modified by Werner Lemberg.  It also supports anti-aliased bitmaps
-        (using a slightly extended BDF format).
+      * A  BDF  font driver,  contributed  by  Franco Zappa  Nardelli,
+        heavily  modified   by  Werner  Lemberg.    It  also  supports
+        anti-aliased bitmaps (using a slightly extended BDF format).
 
-      * A Type42 font driver, contributed by Roberto Alameda.  It is
+      * A Type42  font driver, contributed by Roberto  Alameda.  It is
         still experimental but seems to work relatively well.
 
-      * A PFR font driver, contributed by David Turner himself.  It doesn't
-        support PFR hinting -- note that BitStream has at least two patents
-        on this format!
+      * A PFR  font driver, contributed  by David Turner  himself.  It
+        doesn't  support PFR  hinting --  note that  BitStream  has at
+        least two patents on this format!
 
 
   III. MISCELLANEOUS
 
-    - The cache sub-system has been optimized in important ways.  Cache hits
-      are now significantly faster.  For example, using the CMap cache is
-      about twice faster than calling FT_Get_Char_Index on most platforms.
-      Similarly, using an SBit cache is about five times faster than loading
-      the bitmaps from a bitmap file, and 300 to 500 times faster than
-      generating them from a scalable format.
-
-      Note that you should recompile your sources if you designed a custom
-      cache class for the FT2 Cache subsystem, since the changes performed
-      are source, but not binary, compatible.
+    - The  cache  sub-system has  been  optimized  in important  ways.
+      Cache hits are now significantly faster.  For example, using the
+      CMap cache is about  twice faster than calling FT_Get_Char_Index
+      on most platforms.  Similarly, using an SBit cache is about five
+      times faster  than loading the  bitmaps from a bitmap  file, and
+      300 to  500 times  faster than generating  them from  a scalable
+      format.
+
+      Note that  you should recompile  your sources if you  designed a
+      custom  cache  class for  the  FT2  Cache  subsystem, since  the
+      changes performed are source, but not binary, compatible.
 
 
-========================================================================
+======================================================================
 
 LATEST CHANGES BETWEEN 2.1.0 and 2.0.9
 
   I. IMPORTANT BUG FIXES
 
-    - The TrueType bytecode interpreter has been fixed to produce
+    - The  TrueType bytecode  interpreter  has been  fixed to  produce
       _exactly_ the same output as FreeType 1.x.  Previous differences
-      were due to slightly distinct fixed-point computation routines
+      were due  to slightly distinct  fixed-point computation routines
       used to perform dot products and vector length measurements.
 
-      It seems that native TrueType hinting is _extremely_ sensitive
-      to rounding errors.  The required vector computation routines have
-      been optimized and placed within the "ttinterp.c" file.
+      It seems  that native TrueType hinting  is _extremely_ sensitive
+      to  rounding errors.  The  required vector  computation routines
+      have been optimized and placed within the "ttinterp.c" file.
 
     - Fixed the parsing of accelerator tables in the PCF font driver.
 
-    - Fixed the Type1 glyph loader routine used to compute the font's
+    - Fixed the Type1 glyph loader  routine used to compute the font's
       maximum advance width.
 
+
   II. NEW FEATURES
 
     - The `configure' script used on Unix systems has been modified to
-      check that GNU Make is being used to build the library.  Otherwise,
-      it will display a message proposing to use the GNUMAKE environment
-      variable to name it.
+      check  that  GNU  Make  is  being used  to  build  the  library.
+      Otherwise,  it  will display  a  message  proposing  to use  the
+      GNUMAKE environment variable to name it.
 
       The Unix-specific file README.UNX has been modified accordingly.
 
 
   III. MISCELLANEOUS
 
-    - The FreeType License in `docs/FTL.txt' has been updated to include
-      a proposed preferred disclaimer.  If you are using FreeType in your
-      products, you are encouraged (but not mandated) to use the following
-      text in your documentation:
+    - The  FreeType  License in  `docs/FTL.txt'  has  been updated  to
+      include  a  proposed preferred  disclaimer.   If  you are  using
+      FreeType in your products, you are encouraged (but not mandated)
+      to use the following text in your documentation:
 
       """
-        Portions of this software are copyright � 1996-2002 The FreeType
-        Project (www.freetype.org).  All rights reserved.
+        Portions of this software are copyright � 1996-2002 The
+        FreeType Project (www.freetype.org).  All rights reserved.
       """
 
     - The default size of the render pool has been reduced to 16kByte.
-      This shouldn't result in any noticeable performance penalty, unless
-      you are using the engine as-is to render very large and complex
-      glyphs.
+      This  shouldn't result  in any  noticeable  performance penalty,
+      unless you are  using the engine as-is to  render very large and
+      complex glyphs.
 
[truncated at 1000 lines; 1172 more skipped]

reactos/lib/freetype/docs
CUSTOMIZE 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- CUSTOMIZE	15 Feb 2004 21:45:30 -0000	1.4
+++ CUSTOMIZE	10 May 2004 17:48:26 -0000	1.5
@@ -101,15 +101,15 @@
     name  the  configuration headers.   To  do  so,  you need  a  custom
     "ft2build.h" whose content can be as simple as:
    
-      #ifndef __FT2_BUILD_GENERIC_H__
-      #define __FT2_BUILD_GENERIC_H__
+      #ifndef __FT2_BUILD_MY_PLATFORM_H__
+      #define __FT2_BUILD_MY_PLATFORM_H__
 
-      #define  FT_CONFIG_OPTIONS_H   <custom/my-ftoption.h>
-      #define  FT_CONFIG_MACROS_H    <custom/my-ftmodule.h>
+      #define FT_CONFIG_OPTIONS_H  <custom/my-ftoption.h>
+      #define FT_CONFIG_MODULES_H  <custom/my-ftmodule.h>
 
       #include <freetype/config/ftheader.h>
 
-      #endif /* __FT2_BUILD_GENERIC_H__ */
+      #endif /* __FT2_BUILD_MY_PLATFORM_H__ */
    
     Place those files in a separate directory, e.g.:
    

reactos/lib/freetype/docs
INSTALL 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- INSTALL	21 Jan 2004 19:23:45 -0000	1.3
+++ INSTALL	10 May 2004 17:48:26 -0000	1.4
@@ -61,6 +61,7 @@
 
 [2] make++, a  make tool written in Perl, has  sufficient support of GNU
     make       extensions       to       build      FreeType.        See
-    http://makepp.sourceforge.net for more information.
+    http://makepp.sourceforge.net for more information; you need version
+    1.19 or newer, and you must pass option `--norc-substitution'.
 
 --- end of INSTALL ---

reactos/lib/freetype/docs
INSTALL.GNU 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- INSTALL.GNU	21 Jan 2004 19:23:45 -0000	1.2
+++ INSTALL.GNU	10 May 2004 17:48:26 -0000	1.3
@@ -23,7 +23,8 @@
 
     Note  that make++,  a make  tool  written in  Perl, supports  enough
     features    of    GNU     make    to    compile    FreeType.     See
-    http://makepp.sourceforge.net for more information.
+    http://makepp.sourceforge.net for more information; you need version
+    1.19 or newer, and you must pass option `--norc-substitution'.
 
     Make sure that  you are invoking GNU Make from  the command line, by
     typing something like:

reactos/lib/freetype/docs
INSTALL.UNX 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- INSTALL.UNX	21 Jan 2004 19:23:45 -0000	1.2
+++ INSTALL.UNX	10 May 2004 17:48:26 -0000	1.3
@@ -13,7 +13,8 @@
     [Well, this is not  really correct.  Recently, a perl implementation
     of make called `makepp' has appeared which can also build FreeType 2
     successfully  on Unix platforms.   See http://makepp.sourceforge.net
-    for more details.]
+    for more details; you need version 1.19 or newer,  and you must pass
+    option `--norc-substitution'.]
 
     Trying to compile the library  with a different Make tool will print
     a message like:

reactos/lib/freetype/docs
VERSION.DLL 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- VERSION.DLL	15 Feb 2004 21:45:30 -0000	1.5
+++ VERSION.DLL	10 May 2004 17:48:26 -0000	1.6
@@ -51,7 +51,10 @@
 systems, but not all of them:
 
     release    libtool      so
-  --------------------------------------------------------------------
+  -------------------------------
+     2.1.8      9.6.3     6.3.6
+     2.1.7      9.5.3     6.3.5
+     2.1.6      9.5.3     6.3.5
      2.1.5      9.4.3     6.3.4
      2.1.4      9.3.3     6.3.3
      2.1.3      9.2.3     6.3.2
@@ -60,6 +63,8 @@
      2.1.0      8.0.2         ?
      2.0.9      9.0.3         ?
      2.0.8      8.0.2         ?
+     2.0.4      7.0.1         ?
+     2.0.1      6.1.0         ?
 
 The libtool numbers are a bit inconsistent due to the library's history:
 
@@ -86,19 +91,19 @@
   old_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS=`freetype-config --cflags`
   AC_TRY_CPP([
-#include <freetype/freetype.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
 #if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009
 #error Freetype version too low.
 #endif
-  ],[
-    AC_MSG_RESULT(yes)
-    FREETYPE_LIBS=`freetype-config --libs`
-    AC_SUBST(FREETYPE_LIBS)
-    AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
-    CPPFLAGS="$old_CPPFLAGS"
-  ],[
-    AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])
-  ])
+  ],
+  [AC_MSG_RESULT(yes)
+   FREETYPE_LIBS=`freetype-config --libs`
+   AC_SUBST(FREETYPE_LIBS)
+   AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
+   CPPFLAGS="$old_CPPFLAGS"],
+  [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
 
 
 --- end of VERSION.DLL ---

reactos/lib/freetype/docs
license.txt 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- license.txt	15 Feb 2004 21:45:30 -0000	1.5
+++ license.txt	10 May 2004 17:48:26 -0000	1.6
@@ -2,24 +2,27 @@
 The  FreeType 2  font  engine is  copyrighted  work and  cannot be  used
 legally  without a  software license.   In  order to  make this  project
 usable  to a vast  majority of  developers, we  distribute it  under two
-mutually exclusive licenses.
+mutually exclusive open-source licenses.
 
-This means  that *you*  must choose *one*  license of the  two described
+This means  that *you* must choose  *one* of the  two licenses described
 below, then obey  all its terms and conditions when  using FreeType 2 in
 any of your projects or products.
 
-  - The  FreeType License,  found in  the  file "FTL.TXT",  which is  an
-    BSD-style  open-source  license *with*  an  advertising clause  that
-    forces  you  to  explicitely  cite  the  FreeType  project  in  your
-    product's documentation.  All details are in the license file.
-
-  - The GNU  General Public  License, found in  "GPL.TXT", which  is the
-    traditionnal and "viral" GPL license that forces you to redistribute
-    the _complete_ sources of all your products that use FreeType 2.
-
-Note that  the contributed  PCF driver comes  with a license  similar to
-that of  X Window System which  is compatible to the  above two licenses
-(see file src/pcf/readme).
+  - The FreeType License, found in  the file `FTL.TXT', which is similar
+    to the original BSD license *with* an advertising clause that forces
+    you  to  explicitly cite  the  FreeType  project  in your  product's
+    documentation.  All  details are in the license  file.  This license
+    is  suited  to products  which  don't  use  the GNU  General  Public
+    License.
+
+  - The GNU  General Public License  version 2, found in  `GPL.TXT' (any
+    later version can be used  also), for programs which already use the
+    GPL.  Note  that the  FTL is  incompatible with the  GPL due  to its
+    advertisement clause.
+
+The contributed PCF driver comes with a license similar to that of the X
+Window System.   It is  compatible to the  above two licenses  (see file
+src/pcf/readme).
 
 
 --- end of licence.txt ---

reactos/lib/freetype/docs
release 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- release	15 Feb 2004 21:45:30 -0000	1.3
+++ release	10 May 2004 17:48:26 -0000	1.4
@@ -7,12 +7,26 @@
 . builds/unix/configure.ac (version_info): Update according to the libtool
   rules, then regenerate the configure script.
 
-. builds/freetype.mk (refdoc): Update the --title option.
+. builds/freetype.mk (refdoc): Update the `--title' option.
 
 . docs/CHANGES: Document differences to last release.
 
 . README: Update.
 
-. docs/VERSION.DLL: Document changed version_info.
+. docs/VERSION.DLL: Document changed `version_info'.
 
 . ChangeLog: Announce new release.
+
+. Call `make refdoc' to update HTML reference.  Copy it to
+  freetype2/docs/reference in the `www' CVS module and update the CVS.
+  Then call `update-www' in ~/cvs/scripts on www.freetype.org to
+  update and distribute everything to sourceforge.
+
+. Tag the CVS (freetype, ft2demos, www/freetype2/docs).
+
+. Update `make-release' and `make-current' in ~/cvs/scripts/ on
+  www.freetype.org, then call them.
+
+. Create an md5 checksum file (with md5sum).
+
+. Announce new release on announce@freetype.org and to relevant newsgroups.

reactos/lib/freetype/include/freetype
ftlzw.h added at 1.1
diff -N ftlzw.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftlzw.h	10 May 2004 17:48:26 -0000	1.1
@@ -0,0 +1,99 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftlzw.h                                                                */
+/*                                                                         */
+/*    LZW-compressed stream support.                                       */
+/*                                                                         */
+/*  Copyright 2004 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __FTLZW_H__
+#define __FTLZW_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    lzw                                                                */
+  /*                                                                       */
+  /* <Title>                                                               */
+  /*    LZW Streams                                                        */
+  /*                                                                       */
+  /* <Abstract>                                                            */
+  /*    Using LZW-compressed font files                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This section contains the declaration of LZW-specific functions.   */
+  /*                                                                       */
+  /*************************************************************************/
+
+ /************************************************************************
+  *
+  * @function:
+  *   FT_Stream_OpenLZW
+  *
+  * @description:
+  *   Open a new stream to parse LZW-compressed font files.  This is
+  *   mainly used to support the compressed *.pcf.Z fonts that come
+  *   with XFree86.
+  *
+  * @input:
+  *   stream :: The target embedding stream.
+  *
+  *   source :: The source stream.
+  *
+  * @return:
+  *   FreeType error code.  0 means success.
+  *
+  * @note:
+  *   The source stream must be opened _before_ calling this function.
+  *
+  *   Calling the internal function FT_Stream_Close on the new stream will
+  *   *not* call FT_Stream_Close on the source stream.  None of the stream
+  *   objects will be released to the heap.
+  *
+  *   The stream implementation is very basic and resets the decompression
+  *   process each time seeking backwards is needed within the stream
+  *
+  *   In certain builds of the library, LZW compression recognition is
+  *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
+  *   This means that if no font driver is capable of handling the raw
+  *   compressed file, the library will try to open a LZW stream from it
+  *   and re-open the face with it.
+  *
+  *   This function may return "FT_Err_Unimplemented" if your build of
+  *   FreeType was not compiled with LZW support.
+  */
+  FT_EXPORT( FT_Error )
+  FT_Stream_OpenLZW( FT_Stream  stream,
+                     FT_Stream  source );
+
+ /* */
+
+
+FT_END_HEADER
+
+#endif /* __FTLZW_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype
ftmodapi.h 1.2 -> 1.3
diff -N ftmodapi.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftmodapi.h	10 May 2004 17:48:26 -0000	1.3
@@ -0,0 +1,319 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftmodapi.h                                                             */
+/*                                                                         */
+/*    FreeType modules public interface (specification).                   */
+/*                                                                         */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __FTMODAPI_H__
+#define __FTMODAPI_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    module_management                                                  */
+  /*                                                                       */
+  /* <Title>                                                               */
+  /*    Module Management                                                  */
+  /*                                                                       */
+  /* <Abstract>                                                            */
+  /*    How to add, upgrade, and remove modules from FreeType.             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The definitions below are used to manage modules within FreeType.  */
+  /*    Modules can be added, upgraded, and removed at runtime.            */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /* module bit flags */
+#define FT_MODULE_FONT_DRIVER         1  /* this module is a font driver  */
+#define FT_MODULE_RENDERER            2  /* this module is a renderer     */
+#define FT_MODULE_HINTER              4  /* this module is a glyph hinter */
+#define FT_MODULE_STYLER              8  /* this module is a styler       */
+
+#define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */
+                                              /* scalable fonts           */
+#define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */
+                                              /* support vector outlines  */
+#define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */
+                                              /* own hinter               */
+
+
+  /* deprecated values */
+#define ft_module_font_driver         FT_MODULE_FONT_DRIVER
+#define ft_module_renderer            FT_MODULE_RENDERER
+#define ft_module_hinter              FT_MODULE_HINTER
+#define ft_module_styler              FT_MODULE_STYLER
+
+#define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE
+#define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES
+#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER
+
+
+  typedef FT_Pointer  FT_Module_Interface;
+
+  typedef FT_Error
+  (*FT_Module_Constructor)( FT_Module  module );
+
+  typedef void
+  (*FT_Module_Destructor)( FT_Module  module );
+
+  typedef FT_Module_Interface 
+  (*FT_Module_Requester)( FT_Module    module,
+                          const char*  name );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FT_Module_Class                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The module class descriptor.                                       */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    module_flags      :: Bit flags describing the module.              */
+  /*                                                                       */
+  /*    module_size       :: The size of one module object/instance in     */
+  /*                         bytes.                                        */
+  /*                                                                       */
+  /*    module_name       :: The name of the module.                       */
+  /*                                                                       */
+  /*    module_version    :: The version, as a 16.16 fixed number          */
+  /*                         (major.minor).                                */
+  /*                                                                       */
+  /*    module_requires   :: The version of FreeType this module requires  */
+  /*                         (starts at version 2.0, i.e 0x20000)          */
+  /*                                                                       */
+  /*    module_init       :: A function used to initialize (not create) a  */
+  /*                         new module object.                            */
+  /*                                                                       */
+  /*    module_done       :: A function used to finalize (not destroy) a   */
+  /*                         given module object                           */
+  /*                                                                       */
+  /*    get_interface     :: Queries a given module for a specific         */
+  /*                         interface by name.                            */
+  /*                                                                       */
+  typedef struct  FT_Module_Class_
+  {
+    FT_ULong               module_flags;
+    FT_Long                module_size;
+    const FT_String*       module_name;
+    FT_Fixed               module_version;
+    FT_Fixed               module_requires;
+
+    const void*            module_interface;
+
+    FT_Module_Constructor  module_init;
+    FT_Module_Destructor   module_done;
+    FT_Module_Requester    get_interface;
+
+  } FT_Module_Class;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Add_Module                                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Adds a new module to a given library instance.                     */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library :: A handle to the library object.                         */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    clazz   :: A pointer to class descriptor for the module.           */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    An error will be returned if a module already exists by that name, */
+  /*    or if the module requires a version of FreeType that is too great. */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_Add_Module( FT_Library              library,
+                 const FT_Module_Class*  clazz );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Get_Module                                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Finds a module by its name.                                        */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library     :: A handle to the library object.                     */
+  /*                                                                       */
+  /*    module_name :: The module's name (as an ASCII string).             */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    A module handle.  0 if none was found.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    You should better be familiar with FreeType internals to know      */
+  /*    which module to look for :-)                                       */
+  /*                                                                       */
+  FT_EXPORT( FT_Module )
+  FT_Get_Module( FT_Library   library,
+                 const char*  module_name );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Remove_Module                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Removes a given module from a library instance.                    */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library :: A handle to a library object.                           */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    module  :: A handle to a module object.                            */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The module object is destroyed by the function in case of success. */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_Remove_Module( FT_Library  library,
+                    FT_Module   module );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_New_Library                                                     */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This function is used to create a new FreeType library instance    */
+  /*    from a given memory object.  It is thus possible to use libraries  */
+  /*    with distinct memory allocators within the same program.           */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    memory   :: A handle to the original memory object.                */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    alibrary :: A pointer to handle of a new library object.           */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_New_Library( FT_Memory    memory,
+                  FT_Library  *alibrary );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Done_Library                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Discards a given library object.  This closes all drivers and      */
+  /*    discards all resource objects.                                     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library :: A handle to the target library.                         */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_Done_Library( FT_Library  library );
+
+
+
+  typedef void
+  (*FT_DebugHook_Func)( void*  arg );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Set_Debug_Hook                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Sets a debug hook function for debugging the interpreter of a font */
+  /*    format.                                                            */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library    :: A handle to the library object.                      */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    hook_index :: The index of the debug hook.  You should use the     */
+  /*                  values defined in ftobjs.h, e.g.                     */
+  /*                  FT_DEBUG_HOOK_TRUETYPE.                              */
+  /*                                                                       */
+  /*    debug_hook :: The function used to debug the interpreter.          */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    Currently, four debug hook slots are available, but only two (for  */
+  /*    the TrueType and the Type 1 interpreter) are defined.              */
+  /*                                                                       */
+  FT_EXPORT( void )
+  FT_Set_Debug_Hook( FT_Library         library,
+                     FT_UInt            hook_index,
+                     FT_DebugHook_Func  debug_hook );
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Add_Default_Modules                                             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Adds the set of default drivers to a given library object.         */
+  /*    This is only useful when you create a library object with          */
+  /*    FT_New_Library() (usually to plug a custom memory manager).        */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library :: A handle to a new library object.                       */
+  /*                                                                       */
+  FT_EXPORT( void )
+  FT_Add_Default_Modules( FT_Library  library );
+
+
+  /* */
+
+
+FT_END_HEADER
+
+#endif /* __FTMODAPI_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype
freetype.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- freetype.h	15 Feb 2004 21:45:31 -0000	1.5
+++ freetype.h	10 May 2004 17:48:26 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType high-level API and common types (specification only).       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,6 +16,15 @@
 /***************************************************************************/
 
 
+#ifndef FT_FREETYPE_H
+#error "`ft2build.h' hasn't been included yet!"
+#error "Please always use macros to include FreeType header files."
+#error "Example:"
+#error "  #include <ft2build.h>"
+#error "  #include FT_FREETYPE_H"
+#endif
+
+
 #ifndef __FREETYPE_H__
 #define __FREETYPE_H__
 
@@ -35,7 +44,7 @@
   /*                                                                       */
 #define FREETYPE_MAJOR 2
 #define FREETYPE_MINOR 1
-#define FREETYPE_PATCH 5
+#define FREETYPE_PATCH 8
 
 
 #include <ft2build.h>
@@ -460,7 +469,7 @@
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
-  /*      #define FT_ENC_TAG( value, a, b, c, d )  (value)                 */
+  /*      #define FT_ENC_TAG( value, a, b, c, d )  value                   */
   /*                                                                       */
   /*    to get a simple enumeration without assigning special numbers.     */
   /*                                                                       */
@@ -581,6 +590,37 @@
   /*   the font file, for the cases when they are needed, with the Adobe   */
   /*   values as well.                                                     */
   /*                                                                       */
+  /*   FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap   */
+  /*   is neither Unicode nor ISO-8859-1 (otherwise it is set to           */
+  /*   FT_ENCODING_UNICODE).  Use `FT_Get_BDF_Charset_ID' to find out      */
+  /*   which encoding is really present.  If, for example, the             */
+  /*   `cs_registry' field is `KOI8' and the `cs_encoding' field is `R',   */
+  /*   the font is encoded in KOI8-R.                                      */
+  /*                                                                       */
+  /*   FT_ENCODING_NONE is always set (with a single exception) by the     */
+  /*   winfonts driver.  Use `FT_Get_WinFNT_Header' and examine the        */
+  /*   `charset' field of the `FT_WinFNT_HeaderRec' structure to find out  */
+  /*   which encoding is really present.  For example, FT_WinFNT_ID_CP1251 */
+  /*   (204) means Windows code page 1251 (for Russian).                   */
+  /*                                                                       */
+  /*   FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */
+  /*   and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to  */
+  /*   FT_ENCODING_APPLE_ROMAN).                                           */
+  /*                                                                       */
+  /*   If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function       */
+  /*   `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */
+  /*   needed to be able to distinguish Apple encoding variants.  See      */
+  /*                                                                       */
+  /*     http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT   */
+  /*                                                                       */
+  /*   to get an idea how to do that.  Basically, if the language ID is 0, */
+  /*   dont use it, otherwise subtract 1 from the language ID.  Then       */
+  /*   examine `encoding_id'.  If, for example, `encoding_id' is           */
+  /*   `TT_MAC_ID_ROMAN' and the language ID (minus 1) is                  */
+  /*   `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.         */
+  /*   `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi       */
+  /*   variant the Arabic encoding.                                        */
+  /*                                                                       */
   typedef enum  FT_Encoding_
   {
     FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
@@ -728,10 +768,12 @@
   /*                           collection (i.e., a file which embeds       */
   /*                           several faces), this is the total number of */
   /*                           faces found in the resource.  1 by default. */
+  /*                           Accessing non-existent face indices causes  */
+  /*                           an error.                                   */
   /*                                                                       */
   /*    face_index          :: The index of the face in its font file.     */
   /*                           Usually, this is 0 for all normal font      */
-  /*                           formats.  It can be more in the case of     */
+  /*                           formats.  It can be > 0 in the case of      */
   /*                           collections (which embed several fonts in a */
   /*                           single resource/file).                      */
   /*                                                                       */
@@ -932,7 +974,7 @@
   /*    FT_FACE_FLAG_XXX                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A list of bit flags used in the 'face_flags' field of the          */
+  /*    A list of bit flags used in the `face_flags' field of the          */
   /*    @FT_FaceRec structure.  They inform client applications of         */
   /*    properties of the corresponding face.                              */
   /*                                                                       */
@@ -1709,6 +1751,7 @@
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
   /*                  first face has index 0.                              */
+  /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
@@ -1722,9 +1765,9 @@
   /*                                                                       */
   /*    @FT_New_Face can be used to determine and/or check the font format */
   /*    of a given font resource.  If the `face_index' field is negative,  */
-  /*    the function will _not_ return any face handle in `aface'.  Its    */
-  /*    return value should be 0 if the font format is recognized, or      */
-  /*    non-zero otherwise.                                                */
+  /*    the function will _not_ return any face handle in `aface';  the    */
+  /*    return value is 0 if the font format is recognized, or non-zero    */
+  /*    otherwise.                                                         */
   /*                                                                       */
   /*    Each new face object created with this function also owns a        */
   /*    default @FT_Size object, accessible as `face->size'.               */
@@ -1755,6 +1798,7 @@
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
   /*                  first face has index 0.                              */
+  /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
@@ -1774,8 +1818,8 @@
   /*    @FT_New_Memory_Face can be used to determine and/or check the font */
   /*    format of a given font resource.  If the `face_index' field is     */
   /*    negative, the function will _not_ return any face handle in        */
-  /*    `aface'.  Its return value should be 0 if the font format is       */
-  /*    recognized, or non-zero otherwise.                                 */
+  /*    `aface'; the return value is 0 if the font format is recognized,   */
+  /*    or non-zero otherwise.                                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_New_Memory_Face( FT_Library      library,
@@ -1804,6 +1848,7 @@
   /*                                                                       */
   /*    face_index :: The index of the face within the resource.  The      */
   /*                  first face has index 0.                              */
+  /*                                                                       */
   /* <Output>                                                              */
   /*    aface      :: A handle to a new face object.                       */
   /*                                                                       */
@@ -1815,11 +1860,11 @@
   /*    slot for the face object which can be accessed directly through    */
   /*    `face->glyph'.                                                     */
   /*                                                                       */
-  /*    @FT_Open_Face can be used to determine and/or check the font      */
+  /*    @FT_Open_Face can be used to determine and/or check the font       */
   /*    format of a given font resource.  If the `face_index' field is     */
   /*    negative, the function will _not_ return any face handle in        */
-  /*    `*face'.  Its return value should be 0 if the font format is       */
-  /*    recognized, or non-zero otherwise.                                 */
+  /*    `*face'; the return value is 0 if the font format is recognized,   */
+  /*    or non-zero otherwise.                                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Open_Face( FT_Library           library,
@@ -2021,7 +2066,9 @@
   /*                   will be loaded.                                     */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    glyph_index :: The index of the glyph in the font file.            */
+  /*    glyph_index :: The index of the glyph in the font file.  For       */
+  /*                   CID-keyed fonts (either in PS or in CFF format)     */
+  /*                   this argument specifies the CID value.              */
   /*                                                                       */
   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
   /*                   @FT_LOAD_XXX constants can be used to control the   */
@@ -2212,6 +2259,21 @@
   *     outlines.  This doesn't prevent native format-specific hinters from
   *     being used.  This can be important for certain fonts where unhinted
   *     output is better than auto-hinted one.
+  *
+  *   FT_LOAD_TARGET_NORMAL ::
+  *     Use hinting for @FT_RENDER_MODE_NORMAL.
+  *
+  *   FT_LOAD_TARGET_LIGHT ::
+  *     Use hinting for @FT_RENDER_MODE_LIGHT.
+  *
+  *   FT_LOAD_TARGET_MONO ::
+  *     Use hinting for @FT_RENDER_MODE_MONO.
+  *
+  *   FT_LOAD_TARGET_LCD ::
+  *     Use hinting for @FT_RENDER_MODE_LCD.
+  *
+  *   FT_LOAD_TARGET_LCD_V ::
+  *     Use hinting for @FT_RENDER_MODE_LCD_V.
   */
 #define FT_LOAD_DEFAULT                      0x0
 #define FT_LOAD_NO_SCALE                     0x1
@@ -2234,36 +2296,9 @@
 
   /* */
 
-
 #define FT_LOAD_TARGET_( x )      ( (FT_Int32)( (x) & 15 ) << 16 )
 #define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
 
-
- /***************************************************************************
-  *
-  * @enum:
-  *   FT_LOAD_TARGET_XXX
-  *
-  * @description:
-  *   A list of load targets.  XXX
-  *
-  * @values:
-  *   FT_LOAD_TARGET_NORMAL ::
-  *     XXX
-  *
-  *   FT_LOAD_TARGET_LIGHT ::
-  *     XXX
-  *
-  *   FT_LOAD_TARGET_MONO ::
-  *     XXX
-  *
-  *   FT_LOAD_TARGET_LCD ::
-  *     XXX
-  *
-  *   FT_LOAD_TARGET_LCD_V ::
-  *     XXX
-  */
-
 #define FT_LOAD_TARGET_NORMAL     FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
 #define FT_LOAD_TARGET_LIGHT      FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )
 #define FT_LOAD_TARGET_MONO       FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )
@@ -2325,11 +2360,14 @@
   /*      anti-aliased bitmaps, using 256 levels of opacity.               */
   /*                                                                       */
   /*    FT_RENDER_MODE_LIGHT ::                                            */
-  /*      This is similar to @FT_RENDER_MODE_NORMAL, except that this      */
-  /*      changes the hinting to prevent stem width quantization.  This    */
-  /*      results in glyph shapes that are more similar to the original,   */
-  /*      while being a bit more fuzzy ("better shapes", instead of        */
-  /*      "better contrast" if you want :-).                               */
+  /*      This is similar to @FT_RENDER_MODE_NORMAL -- you have to use     */
+  /*      @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any      */
+  /*      effect since the rendering process no longer influences the      */
+  /*      positioning of glyph outlines.                                   */
+  /*                                                                       */
+  /*      The resulting glyph shapes are more similar to the original,     */
+  /*      while being a bit more fuzzy (`better shapes' instead of `better */
+  /*      contrast', so to say.                                            */
   /*                                                                       */
   /*    FT_RENDER_MODE_MONO ::                                             */
   /*      This mode corresponds to 1-bit bitmaps.                          */

reactos/lib/freetype/include/freetype
ftbbox.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftbbox.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftbbox.h	10 May 2004 17:48:26 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType exact bbox computation (specification).                     */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,6 +34,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftbdf.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftbdf.h	15 Feb 2004 21:45:31 -0000	1.5
+++ ftbdf.h	10 May 2004 17:48:26 -0000	1.6
@@ -22,6 +22,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftcache.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftcache.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftcache.h	10 May 2004 17:48:26 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache subsystem (specification).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -63,8 +63,8 @@
   /*   FTC_Face_Requester                                                  */
   /*                                                                       */
   /*   FTC_Manager_New                                                     */
-  /*   FTC_Manager_Lookup_Face                                             */
-  /*   FTC_Manager_Lookup_Size                                             */
+  /*   FTC_Manager_LookupFace                                              */
+  /*   FTC_Manager_LookupSize                                              */
   /*                                                                       */
   /*   FTC_Node                                                            */
   /*   FTC_Node_Ref                                                        */
@@ -108,10 +108,10 @@
   /*    FTC_FaceID                                                         */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A generic pointer type that is used to identity face objects.  The */
+  /*    An opaque pointer type that is used to identity face objects.  The */
   /*    contents of such objects is application-dependent.                 */
   /*                                                                       */
-  typedef FT_Pointer  FTC_FaceID;
+  typedef struct FTC_FaceIDRec_*  FTC_FaceID;
 
 
   /*************************************************************************/
@@ -257,22 +257,16 @@
   /*    Creates a new cache manager.                                       */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    library   :: The parent FreeType library handle to use.            */
+  /*    library     :: The parent FreeType library handle to use.          */
   /*                                                                       */
-  /*    max_faces :: Maximum number of faces to keep alive in manager.     */
-  /*                 Use 0 for defaults.                                   */
+  /*    max_bytes   :: Maximum number of bytes to use for cached data.     */
+  /*                   Use 0 for defaults.                                 */
   /*                                                                       */
-  /*    max_sizes :: Maximum number of sizes to keep alive in manager.     */
-  /*                 Use 0 for defaults.                                   */
+  /*    requester   :: An application-provided callback used to translate  */
+  /*                   face IDs into real @FT_Face objects.                */
   /*                                                                       */
-  /*    max_bytes :: Maximum number of bytes to use for cached data.       */
-  /*                 Use 0 for defaults.                                   */
-  /*                                                                       */
-  /*    requester :: An application-provided callback used to translate    */
-  /*                 face IDs into real @FT_Face objects.                  */
-  /*                                                                       */
-  /*    req_data  :: A generic pointer that is passed to the requester     */
-  /*                 each time it is called (see @FTC_Face_Requester).     */
+  /*    req_data    :: A generic pointer that is passed to the requester   */
+  /*                   each time it is called (see @FTC_Face_Requester).   */
   /*                                                                       */
   /* <Output>                                                              */
   /*    amanager  :: A handle to a new manager object.  0 in case of       */
@@ -325,7 +319,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    FTC_Manager_Lookup_Face                                            */
+  /*    FTC_Manager_LookupFace                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Retrieves the @FT_Face object that corresponds to a given face ID  */
@@ -348,63 +342,479 @@
   /*                                                                       */
   /*    The @FT_Face object doesn't necessarily have a current size object */
   /*    (i.e., face->size can be 0).  If you need a specific `font size',  */
-  /*    use @FTC_Manager_Lookup_Size instead.                              */
+  /*    use @FTC_Manager_LookupSize instead.                               */
   /*                                                                       */
   /*    Never change the face's transformation matrix (i.e., never call    */
   /*    the @FT_Set_Transform function) on a returned face!  If you need   */
   /*    to transform glyphs, do it yourself after glyph loading.           */
   /*                                                                       */
   FT_EXPORT( FT_Error )
-  FTC_Manager_Lookup_Face( FTC_Manager  manager,
-                           FTC_FaceID   face_id,
-                           FT_Face     *aface );
+  FTC_Manager_LookupFace( FTC_Manager  manager,
+                          FTC_FaceID   face_id,
+                          FT_Face     *aface );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FTC_ScalerRec                                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A structure used to describe a given character size in either      */
+  /*    pixels or points to the cache manager.  See                        */
+  /*    @FTC_Manager_LookupSize.                                           */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    face_id :: The source face ID.                                     */
+  /*                                                                       */
+  /*    width   :: The character width.                                    */
+  /*                                                                       */
+  /*    height  :: The character height.                                   */
+  /*                                                                       */
+  /*    pixel   :: A Boolean.  If TRUE, the `width' and `height' fields    */
+  /*               are interpreted as integer pixel character sizes.       */
+  /*               Otherwise, they are expressed as 1/64th of points.      */
+  /*                                                                       */
+  /*    x_res   :: Only used when `pixel' is FALSE to indicate the         */
+  /*               horizontal resolution in dpi.                           */
+  /*                                                                       */
+  /*    y_res   :: Only used when `pixel' is FALSE to indicate the         */
+  /*               vertical resolution in dpi.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This type is mainly used to retrieve @FT_Size objects through the  */
+  /*    cache manager.                                                     */
+  /*                                                                       */
+  typedef struct  FTC_ScalerRec_
+  {
+    FTC_FaceID  face_id;
+    FT_UInt     width;
+    FT_UInt     height;
+    FT_Int      pixel;
+    FT_UInt     x_res;
+    FT_UInt     y_res;
+
+  } FTC_ScalerRec, *FTC_Scaler;
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    FTC_Manager_Lookup_Size                                            */
+  /*    FTC_Manager_LookupSize                                             */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Retrieves the @FT_Face and @FT_Size objects that correspond to a   */
-  /*    given font.                                                        */
+  /*    Retrieve the @FT_Size object that corresponds to a given           */
+  /*    @FTC_Scaler through a cache manager.                               */
   /*                                                                       */
   /* <Input>                                                               */
   /*    manager :: A handle to the cache manager.                          */
   /*                                                                       */
-  /*    font    :: The font to use.                                        */
+  /*    scaler  :: A scaler handle.                                        */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    asize   :: A handle to the size object.                            */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The returned @FT_Size object is always owned by the manager.  You  */
+  /*    should never try to discard it by yourself.                        */
+  /*                                                                       */
+  /*    You can access the parent @FT_Face object simply as `size->face'   */
+  /*    if you need it.  Note that this object is also owned by the        */
+  /*    manager.                                                           */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FTC_Manager_LookupSize( FTC_Manager  manager,
+                          FTC_Scaler   scaler,
+                          FT_Size     *asize );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FTC_Node_Unref                                                     */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Decrement a cache node's internal reference count.  When the count */
+  /*    reaches 0, it is not destroyed but becomes eligible for subsequent */
+  /*    cache flushes.                                                     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    node    :: The cache node handle.                                  */
+  /*                                                                       */
+  /*    manager :: The cache manager handle.                               */
+  /*                                                                       */
+  FT_EXPORT( void )
+  FTC_Node_Unref( FTC_Node     node,
+                  FTC_Manager  manager );
+
+
+  /* remove all nodes belonging to a given face_id */
+  FT_EXPORT( void )
+  FTC_Manager_RemoveFaceID( FTC_Manager  manager,
+                            FTC_FaceID   face_id );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    cache_subsystem                                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+  /************************************************************************
+   *
+   * @type:
+   *    FTC_CMapCache
+   *
+   * @description:
+   *    An opaque handle used to manager a charmap cache.  This cache is
+   *    to hold character codes -> glyph indices mappings.
+   */
+  typedef struct FTC_CMapCacheRec_*  FTC_CMapCache;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @function:                                                            */
+  /*    FTC_CMapCache_New                                                  */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    Create a new charmap cache.                                        */
+  /*                                                                       */
+  /* @input:                                                               */
+  /*    manager :: A handle to the cache manager.                          */
+  /*                                                                       */
+  /* @output:                                                              */
+  /*    acache  :: A new cache handle.  NULL in case of error.             */
+  /*                                                                       */
+  /* @return:                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* @note:                                                                */
+  /*    Like all other caches, this one will be destroyed with the cache   */
+  /*    manager.                                                           */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FTC_CMapCache_New( FTC_Manager     manager,
+                     FTC_CMapCache  *acache );
+
+
+  /* retrieve the index of a given charmap */
+  FT_EXPORT( FT_Int )
+  FT_Get_CharMap_Index( FT_CharMap  charmap );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @function:                                                            */
+  /*    FTC_CMapCache_Lookup                                               */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    Translate a character code into a glyph index, using the charmap   */
+  /*    cache.                                                             */
+  /*                                                                       */
+  /* @input:                                                               */
+  /*    cache      :: A charmap cache handle.                              */
+  /*                                                                       */
+  /*    face_id    :: source face id                                       */
+  /*                                                                       */
+  /*    cmap_index :: index of charmap in source face                      */
+  /*                                                                       */
+  /*    char_code  :: The character code (in the corresponding charmap).   */
+  /*                                                                       */
+  /* @return:                                                              */
+  /*    Glyph index.  0 means `no glyph'.                                  */
+  /*                                                                       */
+  FT_EXPORT( FT_UInt )
+  FTC_CMapCache_Lookup( FTC_CMapCache  cache,
+                        FTC_FaceID     face_id,
+                        FT_Int         cmap_index,
+                        FT_UInt32      char_code );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Section>                                                             */
+  /*    cache_subsystem                                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                       IMAGE CACHE OBJECT                      *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  typedef struct  FTC_ImageTypeRec_
+  {
+    FTC_FaceID   face_id;
+    FT_Int       width;
+    FT_Int       height;
+    FT_Int32     flags;
+
+  } FTC_ImageTypeRec;
+
+  typedef struct FTC_ImageTypeRec_*   FTC_ImageType;
+
+ /* */
+
+#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )                    \
+          ( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
+            (d1)->flags == (d2)->flags                   )
+
+#define FTC_IMAGE_TYPE_HASH( d )                    \
+          (FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
+                      ( (d)->flags << 4 )         )
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FTC_ImageCache                                                     */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to an glyph image cache object.  They are designed to     */
+  /*    hold many distinct glyph images while not exceeding a certain      */
+  /*    memory threshold.                                                  */
+  /*                                                                       */
+  typedef struct FTC_ImageCacheRec_*  FTC_ImageCache;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FTC_ImageCache_New                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Creates a new glyph image cache.                                   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    manager :: The parent manager for the image cache.                 */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    aface   :: A pointer to the handle of the face object.  Set it to  */
-  /*               zero if you don't need it.                              */
+  /*    acache  :: A handle to the new glyph image cache object.           */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FTC_ImageCache_New( FTC_Manager      manager,
+                      FTC_ImageCache  *acache );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FTC_ImageCache_Lookup                                              */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Retrieves a given glyph image from a glyph image cache.            */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    cache  :: A handle to the source glyph image cache.                */
   /*                                                                       */
-  /*    asize   :: A pointer to the handle of the size object.  Set it to  */
-  /*               zero if you don't need it.                              */
+  /*    type   :: A pointer to a glyph image type descriptor.              */
+  /*                                                                       */
+  /*    gindex :: The glyph index to retrieve.                             */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    aglyph :: The corresponding @FT_Glyph object.  0 in case of        */
+  /*              failure.                                                 */
+  /*                                                                       */
+  /*    anode  :: Used to return the address of of the corresponding cache */
+  /*              node after incrementing its reference count (see note    */
+  /*              below).                                                  */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   /* <Note>                                                                */
-  /*    The returned @FT_Face object is always owned by the manager.  You  */
-  /*    should never try to discard it yourself.                           */
+  /*    The returned glyph is owned and managed by the glyph image cache.  */
+  /*    Never try to transform or discard it manually!  You can however    */
+  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */
+  /*                                                                       */
+  /*    If `anode' is _not_ NULL, it receives the address of the cache     */
+  /*    node containing the glyph image, after increasing its reference    */
+  /*    count.  This ensures that the node (as well as the FT_Glyph) will  */
+  /*    always be kept in the cache until you call @FTC_Node_Unref to      */
+  /*    `release' it.                                                      */
+  /*                                                                       */
+  /*    If `anode' is NULL, the cache node is left unchanged, which means  */
+  /*    that the FT_Glyph could be flushed out of the cache on the next    */
+  /*    call to one of the caching sub-system APIs.  Don't assume that it  */
+  /*    is persistent!                                                     */
   /*                                                                       */
-  /*    Never change the face's transformation matrix (i.e., never call    */
-  /*    the @FT_Set_Transform function) on a returned face!  If you need   */
-  /*    to transform glyphs, do it yourself after glyph loading.           */
+  FT_EXPORT( FT_Error )
+  FTC_ImageCache_Lookup( FTC_ImageCache  cache,
+                         FTC_ImageType   type,
+                         FT_UInt         gindex,
+                         FT_Glyph       *aglyph,
+                         FTC_Node       *anode );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FTC_SBit                                                           */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a small bitmap descriptor.  See the @FTC_SBitRec       */
+  /*    structure for details.                                             */
+  /*                                                                       */
+  typedef struct FTC_SBitRec_*  FTC_SBit;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FTC_SBitRec                                                        */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A very compact structure used to describe a small glyph bitmap.    */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    width     :: The bitmap width in pixels.                           */
   /*                                                                       */
-  /*    Similarly, the returned @FT_Size object is always owned by the     */
-  /*    manager.  You should never try to discard it, and never change its */
-  /*    settings with @FT_Set_Pixel_Sizes or @FT_Set_Char_Size!            */
+  /*    height    :: The bitmap height in pixels.                          */
   /*                                                                       */
-  /*    The returned size object is the face's current size, which means   */
-  /*    that you can call @FT_Load_Glyph with the face if you need to.     */
+  /*    left      :: The horizontal distance from the pen position to the  */
+  /*                 left bitmap border (a.k.a. `left side bearing', or    */
+  /*                 `lsb').                                               */
+  /*                                                                       */
+  /*    top       :: The vertical distance from the pen position (on the   */
+  /*                 baseline) to the upper bitmap border (a.k.a. `top     */
+  /*                 side bearing').  The distance is positive for upwards */
+  /*                 Y coordinates.                                        */
+  /*                                                                       */
+  /*    format    :: The format of the glyph bitmap (monochrome or gray).  */
+  /*                                                                       */
+  /*    max_grays :: Maximum gray level value (in the range 1 to 255).     */
+  /*                                                                       */
+  /*    pitch     :: The number of bytes per bitmap line.  May be positive */
+  /*                 or negative.                                          */
+  /*                                                                       */
+  /*    xadvance  :: The horizontal advance width in pixels.               */
+  /*                                                                       */
+  /*    yadvance  :: The vertical advance height in pixels.                */
+  /*                                                                       */
+  /*    buffer    :: A pointer to the bitmap pixels.                       */
+  /*                                                                       */
+  typedef struct  FTC_SBitRec_
+  {
+    FT_Byte   width;
+    FT_Byte   height;
+    FT_Char   left;
+    FT_Char   top;
+
+    FT_Byte   format;
+    FT_Byte   max_grays;
+    FT_Short  pitch;
+    FT_Char   xadvance;
+    FT_Char   yadvance;
+
+    FT_Byte*  buffer;
+
+  } FTC_SBitRec;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Type>                                                                */
+  /*    FTC_SBitCache                                                      */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A handle to a small bitmap cache.  These are special cache objects */
+  /*    used to store small glyph bitmaps (and anti-aliased pixmaps) in a  */
+  /*    much more efficient way than the traditional glyph image cache     */
+  /*    implemented by @FTC_ImageCache.                                    */
+  /*                                                                       */
+  typedef struct FTC_SBitCacheRec_*  FTC_SBitCache;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FTC_SBitCache_New                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Creates a new cache to store small glyph bitmaps.                  */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    manager :: A handle to the source cache manager.                   */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
-  FTC_Manager_Lookup_Size( FTC_Manager  manager,
-                           FTC_Font     font,
-                           FT_Face     *aface,
-                           FT_Size     *asize );
+  FTC_SBitCache_New( FTC_Manager     manager,
+                     FTC_SBitCache  *acache );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FTC_SBitCache_Lookup                                               */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Looks up a given small glyph bitmap in a given sbit cache and      */
+  /*    `lock' it to prevent its flushing from the cache until needed.     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    cache  :: A handle to the source sbit cache.                       */
+  /*                                                                       */
+  /*    type   :: A pointer to the glyph image type descriptor.            */
+  /*                                                                       */
+  /*    gindex :: The glyph index.                                         */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    sbit   :: A handle to a small bitmap descriptor.                   */
+  /*                                                                       */
+  /*    anode  :: Used to return the address of of the corresponding cache */
+  /*              node after incrementing its reference count (see note    */
+  /*              below).                                                  */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The small bitmap descriptor and its bit buffer are owned by the    */
+  /*    cache and should never be freed by the application.  They might    */
+  /*    as well disappear from memory on the next cache lookup, so don't   */
+  /*    treat them as persistent data.                                     */
+  /*                                                                       */
+  /*    The descriptor's `buffer' field is set to 0 to indicate a missing  */
+  /*    glyph bitmap.                                                      */
+  /*                                                                       */
+  /*    If `anode' is _not_ NULL, it receives the address of the cache     */
+  /*    node containing the bitmap, after increasing its reference count.  */
+  /*    This ensures that the node (as well as the image) will always be   */
+  /*    kept in the cache until you call @FTC_Node_Unref to `release' it.  */
+  /*                                                                       */
+  /*    If `anode' is NULL, the cache node is left unchanged, which means  */
+  /*    that the bitmap could be flushed out of the cache on the next      */
+  /*    call to one of the caching sub-system APIs.  Don't assume that it  */
+  /*    is persistent!                                                     */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FTC_SBitCache_Lookup( FTC_SBitCache    cache,
+                        FTC_ImageType    type,
+                        FT_UInt          gindex,
+                        FTC_SBit        *sbit,
+                        FTC_Node        *anode );
+
 
+ /* */
 
 FT_END_HEADER
 

reactos/lib/freetype/include/freetype
fterrdef.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- fterrdef.h	1 Apr 2003 08:38:32 -0000	1.1
+++ fterrdef.h	10 May 2004 17:48:26 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType error codes (specification).                                */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2004 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -207,6 +207,8 @@
                 "opcode syntax error" )
   FT_ERRORDEF_( Stack_Underflow,                             0xA1, \
                 "argument stack underflow" )
+  FT_ERRORDEF_( Ignore,                                      0xA2, \
+                "ignore" )
 
   /* BDF errors */
 

reactos/lib/freetype/include/freetype
ftglyph.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftglyph.h	15 Feb 2004 21:45:31 -0000	1.5
+++ ftglyph.h	10 May 2004 17:48:26 -0000	1.6
@@ -36,6 +36,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -235,7 +241,8 @@
   /*    FT_Glyph_Copy                                                      */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A function used to copy a glyph image.                             */
+  /*    A function used to copy a glyph image.  Note that the created      */
+  /*    @FT_Glyph object must be released with @FT_Done_Glyph.             */
   /*                                                                       */
   /* <Input>                                                               */
   /*    source :: A handle to the source glyph object.                     */
@@ -472,8 +479,7 @@
   /*      }                                                                */
   /*                                                                       */
   /*                                                                       */
-  /*    This function will always fail if the glyph's format isn't         */
-  /*    scalable.                                                          */
+  /*    This function does nothing if the glyph format isn't scalable.     */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,

reactos/lib/freetype/include/freetype
ftgzip.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftgzip.h	15 Feb 2004 21:45:31 -0000	1.5
+++ ftgzip.h	10 May 2004 17:48:26 -0000	1.6
@@ -22,6 +22,13 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
 FT_BEGIN_HEADER
 
   /*************************************************************************/

reactos/lib/freetype/include/freetype
ftimage.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftimage.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftimage.h	10 May 2004 17:48:26 -0000	1.5
@@ -5,7 +5,7 @@
 /*    FreeType glyph image formats and default raster interface            */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -53,8 +53,8 @@
   /* <Description>                                                         */
   /*    The type FT_Pos is a 32-bit integer used to store vectorial        */
   /*    coordinates.  Depending on the context, these can represent        */
-  /*    distances in integer font units, or 26.6 fixed float pixel         */
-  /*    coordinates.                                                       */
+  /*    distances in integer font units, or 16,16, or 26.6 fixed float     */
+  /*    pixel coordinates.                                                 */
   /*                                                                       */
   typedef signed long  FT_Pos;
 
@@ -657,7 +657,7 @@
   /*    should redefine this macro in case of problems to something like   */
   /*    this:                                                              */
   /*                                                                       */
-  /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  (value)       */
+  /*      #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  value         */
   /*                                                                       */
   /*    to get a simple enumeration without assigning special numbers.     */
   /*                                                                       */

reactos/lib/freetype/include/freetype
ftincrem.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftincrem.h	15 Feb 2004 21:45:31 -0000	1.5
+++ ftincrem.h	10 May 2004 17:48:26 -0000	1.6
@@ -22,6 +22,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftlist.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftlist.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftlist.h	10 May 2004 17:48:26 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Generic list support for FreeType (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,6 +31,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftmac.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftmac.h	1 Apr 2003 08:38:32 -0000	1.1
+++ ftmac.h	10 May 2004 17:48:26 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Additional Mac-specific API.                                         */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2004 by                                           */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -111,10 +111,44 @@
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-  FT_EXPORT_DEF( FT_Error )
-  FT_GetFile_From_Mac_Name( char*     fontName, 
-                            FSSpec*   pathSpec,
-                            FT_Long*  face_index );
+  FT_EXPORT( FT_Error )
+  FT_GetFile_From_Mac_Name( const char*  fontName, 
+                            FSSpec*      pathSpec,
+                            FT_Long*     face_index );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_New_Face_From_FSSpec                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Creates a new face object from a given resource and typeface index */
+  /*    using an FSSpec to the font file.                                  */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library    :: A handle to the library resource.                    */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    spec       :: FSSpec to the font file.                             */
+  /*                                                                       */
+  /*    face_index :: The index of the face within the resource.  The      */
+  /*                  first face has index 0.                              */
+  /* <Output>                                                              */
+  /*    aface      :: A handle to a new face object.                       */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    @FT_New_Face_From_FSSpec is identical to @FT_New_Face except       */
+  /*    it accepts an FSSpec instead of a path.                            */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_New_Face_From_FSSpec( FT_Library     library,
+                           const FSSpec  *spec,
+                           FT_Long        face_index,
+                           FT_Face       *aface );
 
   /* */
 

reactos/lib/freetype/include/freetype
ftmm.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftmm.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftmm.h	10 May 2004 17:48:26 -0000	1.4
@@ -100,21 +100,6 @@
 
   /* */
 
-  typedef FT_Error
-  (*FT_Get_MM_Func)( FT_Face           face,
-                     FT_Multi_Master*  master );
-
-  typedef FT_Error
-  (*FT_Set_MM_Design_Func)( FT_Face   face,
-                            FT_UInt   num_coords,
-                            FT_Long*  coords );
-
-  typedef FT_Error
-  (*FT_Set_MM_Blend_Func)( FT_Face   face,
-                           FT_UInt   num_coords,
-                           FT_Long*  coords );
-
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */

reactos/lib/freetype/include/freetype
ftmoderr.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ftmoderr.h	21 Jan 2004 19:23:45 -0000	1.2
+++ ftmoderr.h	10 May 2004 17:48:26 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType module error offsets (specification).                       */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -23,8 +23,8 @@
   /* The lower byte gives the error code, the higher byte gives the        */
   /* module.  The base module has error offset 0.  For example, the error  */
   /* `FT_Err_Invalid_File_Format' has value 0x003, the error               */
-  /* `TT_Err_Invalid_File_Format' has value 0xF03, the error               */
-  /* `T1_Err_Invalid_File_Format' has value 0x1003, etc.                   */
+  /* `TT_Err_Invalid_File_Format' has value 0x1003, the error              */
+  /* `T1_Err_Invalid_File_Format' has value 0x1103, etc.                   */
   /*                                                                       */
   /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h   */
   /* to make the higher byte always zero (disabling the module error       */
@@ -109,18 +109,19 @@
   FT_MODERRDEF( CFF,       0x400, "CFF module" )
   FT_MODERRDEF( CID,       0x500, "CID module" )
   FT_MODERRDEF( Gzip,      0x600, "Gzip module" )
-  FT_MODERRDEF( PCF,       0x700, "PCF module" )
-  FT_MODERRDEF( PFR,       0x800, "PFR module" )
-  FT_MODERRDEF( PSaux,     0x900, "PS auxiliary module" )
-  FT_MODERRDEF( PShinter,  0xA00, "PS hinter module" )
-  FT_MODERRDEF( PSnames,   0xB00, "PS names module" )
-  FT_MODERRDEF( Raster,    0xC00, "raster module" )
-  FT_MODERRDEF( SFNT,      0xD00, "SFNT module" )
-  FT_MODERRDEF( Smooth,    0xE00, "smooth raster module" )
-  FT_MODERRDEF( TrueType,  0xF00, "TrueType module" )
-  FT_MODERRDEF( Type1,    0x1000, "Type 1 module" )
-  FT_MODERRDEF( Type42,   0x1100, "Type 42 module" )
-  FT_MODERRDEF( Winfonts, 0x1200, "Windows FON/FNT module" )
+  FT_MODERRDEF( LZW,       0x700, "LZW module" )
+  FT_MODERRDEF( PCF,       0x800, "PCF module" )
+  FT_MODERRDEF( PFR,       0x900, "PFR module" )
+  FT_MODERRDEF( PSaux,     0xA00, "PS auxiliary module" )
+  FT_MODERRDEF( PShinter,  0xB00, "PS hinter module" )
+  FT_MODERRDEF( PSnames,   0xC00, "PS names module" )
+  FT_MODERRDEF( Raster,    0xD00, "raster module" )
+  FT_MODERRDEF( SFNT,      0xE00, "SFNT module" )
+  FT_MODERRDEF( Smooth,    0xF00, "smooth raster module" )
+  FT_MODERRDEF( TrueType, 0x1000, "TrueType module" )
+  FT_MODERRDEF( Type1,    0x1100, "Type 1 module" )
+  FT_MODERRDEF( Type42,   0x1200, "Type 42 module" )
+  FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" )
 
 
 #ifdef FT_MODERR_END_LIST

reactos/lib/freetype/include/freetype
ftoutln.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftoutln.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftoutln.h	10 May 2004 17:48:26 -0000	1.5
@@ -5,7 +5,7 @@
 /*    Support for the FT_Outline type used to store glyph shapes of        */
 /*    most scalable font formats (specification).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -24,6 +24,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -389,6 +395,72 @@
                      FT_Raster_Params*  params );
 
 
+ /**************************************************************************
+  *
+  * @enum:
+  *   FT_Orientation
+  *  
+  * @description:
+  *   A list of values used to describe an outline's contour orientation.
+  *
+  *   The TrueType and Postscript specifications use different conventions
+  *   to determine whether outline contours should be filled or unfilled.
+  *   
+  * @values:
+  *   FT_ORIENTATION_TRUETYPE ::
+  *     According to the TrueType specification, clockwise contours must
+  *     be filled, and counter-clockwise ones must be unfilled.
+  *
+  *   FT_ORIENTATION_POSTSCRIPT ::
+  *     According to the Postscript specification, counter-clockwise contours
+  *     must be filled, and clockwise ones must be unfilled.
+  *
+  *   FT_ORIENTATION_FILL_RIGHT ::
+  *     This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
+  *     remember that in TrueType, everything that is to the right of
+  *     the drawing direction of a contour must be filled.
+  *
+  *   FT_ORIENTATION_FILL_LEFT ::
+  *     This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
+  *     remember that in Postscript, everything that is to the left of
+  *     the drawing direction of a contour must be filled.
+  */
+  typedef enum
+  {
+    FT_ORIENTATION_TRUETYPE   = 0,
+    FT_ORIENTATION_POSTSCRIPT = 1,
+    FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
+    FT_ORIENTATION_FILL_LEFT  = FT_ORIENTATION_POSTSCRIPT
+  
+  } FT_Orientation;
+
+
+ /**************************************************************************
+  *
+  * @function:
+  *   FT_Outline_Get_Orientation
+  *  
+  * @description:
+  *   This function analyzes a glyph outline and tries to compute its
+  *   fill orientation (see @FT_Orientation).  This is done by computing
+  *   the direction of each global horizontal and/or vertical extrema
+  *   within the outline.
+  *
+  *   Note that this will return @FT_ORIENTATION_TRUETYPE for empty
+  *   outlines.
+  *
+  * @input:
+  *   outline ::
+  *     A handle to the source outline.
+  *
+  * @return:
+  *   The orientation.
+  *
+  */
+  FT_EXPORT( FT_Orientation )
+  FT_Outline_Get_Orientation( FT_Outline*  outline );
+
+
   /* */
 
 

reactos/lib/freetype/include/freetype
ftpfr.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftpfr.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftpfr.h	10 May 2004 17:48:26 -0000	1.5
@@ -22,6 +22,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftsizes.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftsizes.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftsizes.h	10 May 2004 17:48:26 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType size objects management (specification).                    */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -32,6 +32,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -101,7 +107,9 @@
   /*    FT_Done_Size                                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Discards a given size object.                                      */
+  /*    Discards a given size object.  Note that @FT_Done_Face             */
+  /*    automatically discards all size objects allocated with             */
+  /*    @FT_New_Size.                                                      */
   /*                                                                       */
   /* <Input>                                                               */
   /*    size :: A handle to a target size object.                          */

reactos/lib/freetype/include/freetype
ftsnames.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftsnames.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftsnames.h	10 May 2004 17:48:26 -0000	1.4
@@ -7,7 +7,7 @@
 /*                                                                         */
 /*    This is _not_ used to retrieve glyph names!                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -26,6 +26,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftstroke.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftstroke.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftstroke.h	10 May 2004 17:48:26 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType path stroker (specification).                               */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,42 +21,45 @@
 
 #include <ft2build.h>
 #include FT_OUTLINE_H
+#include FT_GLYPH_H
 
 FT_BEGIN_HEADER
 
-/*@*************************************************************
- *
- * @type: FT_Stroker
- *
- * @description:
- *    opaque handler to a path stroker object
- */
-  typedef struct FT_StrokerRec_*    FT_Stroker;
-
-
-/*@*************************************************************
- *
- * @enum: FT_Stroker_LineJoin
- *
- * @description:
- *    these values determine how two joining lines are rendered
- *    in a stroker.
- *
- * @values:
- *    FT_STROKER_LINEJOIN_ROUND ::
- *      used to render rounded line joins. circular arcs are used
- *      to join two lines smoothly
- *
- *    FT_STROKER_LINEJOIN_BEVEL ::
- *      used to render beveled line joins; i.e. the two joining lines
- *      are extended until they intersect
- *
- *    FT_STROKER_LINEJOIN_MITER ::
- *      same as beveled rendering, except that an additional line
- *      break is added if the angle between the two joining lines
- *      is too closed (this is useful to avoid unpleasant spikes
- *      in beveled rendering).
- */
+ /*@*************************************************************
+  *
+  * @type:
+  *   FT_Stroker
+  *
+  * @description:
+  *   Opaque handler to a path stroker object.
+  */
+  typedef struct FT_StrokerRec_*  FT_Stroker;
+
+
+  /*@*************************************************************
+   *
+   * @enum:
+   *   FT_Stroker_LineJoin
+   *
+   * @description:
+   *   These values determine how two joining lines are rendered
+   *   in a stroker.
+   *
+   * @values:
+   *   FT_STROKER_LINEJOIN_ROUND ::
+   *     Used to render rounded line joins.  Circular arcs are used
+   *     to join two lines smoothly.
+   *
+   *   FT_STROKER_LINEJOIN_BEVEL ::
+   *     Used to render beveled line joins; i.e., the two joining lines
+   *     are extended until they intersect.
+   *
+   *   FT_STROKER_LINEJOIN_MITER ::
+   *     Same as beveled rendering, except that an additional line
+   *     break is added if the angle between the two joining lines
+   *     is too closed (this is useful to avoid unpleasant spikes
+   *     in beveled rendering).
+   */
   typedef enum
   {
     FT_STROKER_LINEJOIN_ROUND = 0,
@@ -66,27 +69,28 @@
   } FT_Stroker_LineJoin;
 
 
-/*@*************************************************************
- *
- * @enum: FT_Stroker_LineCap
- *
- * @description:
- *    these values determine how the end of opened sub-paths are
- *    rendered in a stroke
- *
- * @values:
- *    FT_STROKER_LINECAP_BUTT ::
- *      the end of lines is rendered as a full stop on the last
- *      point itself
- *
- *    FT_STROKER_LINECAP_ROUND ::
- *      the end of lines is rendered as a half-circle around the
- *      last point
- *
- *    FT_STROKER_LINECAP_SQUARE ::
- *      the end of lines is rendered as a square around the
- *      last point
- */
+  /*@*************************************************************
+   *
+   * @enum:
+   *   FT_Stroker_LineCap
+   *
+   * @description:
+   *   These values determine how the end of opened sub-paths are
+   *   rendered in a stroke.
+   *
+   * @values:
+   *   FT_STROKER_LINECAP_BUTT ::
+   *     The end of lines is rendered as a full stop on the last
+   *     point itself.
+   *
+   *   FT_STROKER_LINECAP_ROUND ::
+   *     The end of lines is rendered as a half-circle around the
+   *     last point.
+   *
+   *   FT_STROKER_LINECAP_SQUARE ::
+   *     The end of lines is rendered as a square around the
+   *     last point.
+   */
   typedef enum
   {
     FT_STROKER_LINECAP_BUTT = 0,
@@ -95,12 +99,134 @@
 
   } FT_Stroker_LineCap;
 
- /* */
 
+  /**************************************************************
+   *
+   * @enum:
+   *   FT_StrokerBorder
+   *
+   * @description:
+   *   These values are used to select a given stroke border
+   *   in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
+   *
+   * @values:
+   *   FT_STROKER_BORDER_LEFT ::
+   *     Select the left border, relative to the drawing direction.
+   *
+   *   FT_STROKER_BORDER_RIGHT ::
+   *     Select the right border, relative to the drawing direction.
+   *
+   * @note:
+   *   Applications are generally interested in the `inside' and `outside'
+   *   borders.  However, there is no direct mapping between these and
+   *   the `left' / `right' ones, since this really depends on the glyph's
+   *   drawing orientation, which varies between font formats.
+   *
+   *   You can however use @FT_Outline_GetInsideBorder and
+   *   @FT_Outline_GetOutsideBorder to get these.
+   */
+  typedef enum
+  {
+    FT_STROKER_BORDER_LEFT = 0,
+    FT_STROKER_BORDER_RIGHT
+
+  } FT_StrokerBorder;
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Outline_GetInsideBorder
+   *
+   * @description:
+   *   Retrieve the @FT_StrokerBorder value corresponding to the
+   *   `inside' borders of a given outline.
+   *
+   * @input:
+   *   outline ::
+   *     The source outline handle.
+   *
+   * @return:
+   *   The border index.  @FT_STROKER_BORDER_LEFT for empty or invalid
+   *   outlines.
+   */
+  FT_EXPORT( FT_StrokerBorder )
+  FT_Outline_GetInsideBorder( FT_Outline*  outline );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Outline_GetOutsideBorder
+   *
+   * @description:
+   *   Retrieve the @FT_StrokerBorder value corresponding to the
+   *   `outside' borders of a given outline.
+   *
+   * @input:
+   *   outline ::
+   *     The source outline handle.
+   *
+   * @return:
+   *   The border index.  @FT_STROKER_BORDER_LEFT for empty or invalid
+   *   outlines.
+   */
+  FT_EXPORT( FT_StrokerBorder )
+  FT_Outline_GetOutsideBorder( FT_Outline*  outline );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_New
+   *
+   * @description:
+   *   Create a new stroker object.
+   *
+   * @input:
+   *   memory ::
+   *     The memory manager handle.
+   *
+   * @output:
+   *   A new stroker object handle.  NULL in case of error.
+   *
+   * @return:
+   *    FreeType error code.  0 means success.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_New( FT_Memory    memory,
                   FT_Stroker  *astroker );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_Set
+   *
+   * @description:
+   *   Reset a stroker object's attributes.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   radius ::
+   *     The border radius.
+   *
+   *   line_cap ::
+   *     The line cap style.
+   *
+   *   line_join ::
+   *     The line join style.
+   *
+   *   miter_limit ::
+   *     The miter limit for the FT_STROKER_LINEJOIN_MITER style,
+   *     expressed as 16.16 fixed point value.
+   *
+   * @note:
+   *   The radius is expressed in the same units that the outline
+   *   coordinates.
+   */
   FT_EXPORT( void )
   FT_Stroker_Set( FT_Stroker           stroker,
                   FT_Fixed             radius,
@@ -109,29 +235,208 @@
                   FT_Fixed             miter_limit );
 
 
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_Rewind
+   *
+   * @description:
+   *   Reset a stroker object without changing its attributes.
+   *   You should call this function before beginning a new
+   *   series of calls to @FT_Stroker_BeginSubPath or
+   *   @FT_Stroker_EndSubPath.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   */
+  FT_EXPORT( void )
+  FT_Stroker_Rewind( FT_Stroker  stroker );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_ParseOutline
+   *
+   * @description:
+   *   A convenience function used to parse a whole outline with
+   *   the stroker.  The resulting outline(s) can be retrieved
+   *   later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   outline ::
+   *     The source outline.
+   *
+   *   opened ::
+   *     A boolean.  If TRUE, the outline is treated as an open path
+   *     instead of a closed one.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   If `opened' is 0 (the default), the outline is treated as a closed
+   *   path, and the stroker will generate two distinct `border' outlines.
+   *
+   *   If `opened' is 1, the outline is processed as an open path, and the
+   *   stroker will generate a single `stroke' outline.
+   *
+   *   This function calls @FT_Stroker_Rewind automatically.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_ParseOutline( FT_Stroker   stroker,
                            FT_Outline*  outline,
                            FT_Bool      opened );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_BeginSubPath
+   *
+   * @description:
+   *   Start a new sub-path in the stroker.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   to ::
+   *     A pointer to the start vector.
+   *
+   *   open ::
+   *     A boolean.  If TRUE, the sub-path is treated as an open one.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   This function is useful when you need to stroke a path that is
+   *   not stored as a @FT_Outline object.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_BeginSubPath( FT_Stroker  stroker,
                            FT_Vector*  to,
                            FT_Bool     open );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_EndSubPath
+   *
+   * @description:
+   *   Close the current sub-path in the stroker.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   You should call this function after @FT_Stroker_BeginSubPath.
+   *   If the subpath was not `opened', this function will `draw' a
+   *   single line segment to the start position when needed.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_EndSubPath( FT_Stroker  stroker );
 
 
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_LineTo
+   *
+   * @description:
+   *   `Draw' a single line segment in the stroker's current sub-path,
+   *   from the last position.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   to ::
+   *     A pointer to the destination point.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   You should call this function between @FT_Stroker_BeginSubPath and
+   *   @FT_Stroker_EndSubPath.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_LineTo( FT_Stroker  stroker,
                      FT_Vector*  to );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_ConicTo
+   *
+   * @description:
+   *   `Draw; a single quadratic bezier in the stroker's current sub-path,
+   *   from the last position.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   control ::
+   *     A pointer to a B�zier control point.
+   *
+   *   to ::
+   *     A pointer to the destination point.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   You should call this function between @FT_Stroker_BeginSubPath and
+   *   @FT_Stroker_EndSubPath.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_ConicTo( FT_Stroker  stroker,
                       FT_Vector*  control,
                       FT_Vector*  to );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_CubicTo
+   *
+   * @description:
+   *   `Draw' a single cubic B�zier in the stroker's current sub-path,
+   *   from the last position.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   control1 ::
+   *     A pointer to the first B�zier control point.
+   *
+   *   control2 ::
+   *     A pointer to second B�zier control point.
+   *
+   *   to ::
+   *     A pointer to the destination point.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   You should call this function between @FT_Stroker_BeginSubPath and
+   *   @FT_Stroker_EndSubPath.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_CubicTo( FT_Stroker  stroker,
                       FT_Vector*  control1,
@@ -139,19 +444,240 @@
                       FT_Vector*  to );
 
 
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_GetBorderCounts
+   *
+   * @description:
+   *   Vall this function once you have finished parsing your paths
+   *   with the stroker.  It will return the number of points and
+   *   contours necessary to export one of the `border' or `stroke'
+   *   outlines generated by the stroker.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   border ::
+   *     The border index.
+   *
+   * @output:
+   *   anum_points ::
+   *     The number of points.
+   *
+   *   anum_contours ::
+   *     The number of contours.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   *
+   * @note:
+   *   When an outline, or a sub-path, is `closed', the stroker generates
+   *   two independent `border' outlines, named `left' and `right'.
+   *
+   *   When the outline, or a sub-path, is `opened', the stroker merges
+   *   the `border' outlines with caps.  The `left' border receives all
+   *   points, while the `right' border becomes empty.
+   *
+   *   Use the function @FT_Stroker_GetCounts instead if you want to
+   *   retrieve the counts associated to both borders.
+   */
+  FT_EXPORT( FT_Error )
+  FT_Stroker_GetBorderCounts( FT_Stroker        stroker,
+                              FT_StrokerBorder  border,
+                              FT_UInt          *anum_points,
+                              FT_UInt          *anum_contours );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_ExportBorder
+   *
+   * @description:
+   *   Call this function after @FT_Stroker_GetBorderCounts to
+   *   export the corresponding border to your own @FT_Outline
+   *   structure.
+   *
+   *   Note that this function will append the border points and
+   *   contours to your outline, but will not try to resize its
+   *   arrays.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   border ::
+   *     The border index.
+   *
+   *   outline ::
+   *     The target outline handle.
+   *
+   * @note:
+   *   Always call this function after @FT_Stroker_GetBorderCounts to
+   *   get sure that there is enough room in your @FT_Outline object to
+   *   receive all new data.
+   *
+   *   When an outline, or a sub-path, is `closed', the stroker generates
+   *   two independent `border' outlines, named `left' and `right'
+   *
+   *   When the outline, or a sub-path, is `opened', the stroker merges
+   *   the `border' outlines with caps. The `left' border receives all
+   *   points, while the `right' border becomes empty.
+   *
+   *   Use the function @FT_Stroker_Export instead if you want to
+   *   retrieve all borders at once.
+   */
+  FT_EXPORT( void )
+  FT_Stroker_ExportBorder( FT_Stroker        stroker,
+                           FT_StrokerBorder  border,
+                           FT_Outline*       outline );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_GetCounts
+   *
+   * @description:
+   *   Call this function once you have finished parsing your paths
+   *   with the stroker.  It returns the number of points and
+   *   contours necessary to export all points/borders from the stroked
+   *   outline/path.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   * @output:
+   *   anum_points ::
+   *     The number of points.
+   *
+   *   anum_contours ::
+   *     The number of contours.
+   *
+   * @return:
+   *   FreeType error code.  0 means success.
+   */
   FT_EXPORT( FT_Error )
   FT_Stroker_GetCounts( FT_Stroker  stroker,
                         FT_UInt    *anum_points,
                         FT_UInt    *anum_contours );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_Export
+   *
+   * @description:
+   *   Call this function after @FT_Stroker_GetBorderCounts to
+   *   export the all borders to your own @FT_Outline structure.
+   *
+   *   Note that this function will append the border points and
+   *   contours to your outline, but will not try to resize its
+   *   arrays.
+   *
+   * @input:
+   *   stroker ::
+   *     The target stroker handle.
+   *
+   *   outline ::
+   *     The target outline handle.
+   */
   FT_EXPORT( void )
   FT_Stroker_Export( FT_Stroker   stroker,
                      FT_Outline*  outline );
 
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Stroker_Done
+   *
+   * @description:
+   *   Destroy a stroker object.
+   *
+   * @input:
+   *   stroker ::
+   *     A stroker handle.  Can be NULL.
+   */
   FT_EXPORT( void )
   FT_Stroker_Done( FT_Stroker  stroker );
 
 
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Glyph_Stroke
+   *
+   * @description:
+   *   Stroke a given outline glyph object with a given stroker.
+   *
+   * @inout:
+   *   pglyph :: Source glyph handle on input, new glyph handle
+   *             on output.
+   *
+   * @input:
+   *   stroker ::
+   *     A stroker handle.
+   *
+   *   destroy ::
+   *     A Boolean.  If TRUE, the source glyph object is destroyed
+   *     on success.
+   *
+   * @return:
+   *    FreeType error code.  0 means success.
+   *
+   * @note:
+   *   The source glyph is untouched in case of error.
+   */
+  FT_EXPORT( FT_Error )
+  FT_Glyph_Stroke( FT_Glyph    *pglyph,
+                   FT_Stroker   stroker,
+                   FT_Bool      destroy );
+
+
+  /**************************************************************
+   *
+   * @function:
+   *   FT_Glyph_StrokeBorder
+   *
+   * @description:
+   *   Stroke a given outline glyph object with a given stroker, but
+   *   only return either its inside or outside border.
+   *
+   * @inout:
+   *   pglyph ::
+   *     Source glyph handle on input, new glyph handle on output.
+   *
+   * @input:
+   *   stroker ::
+   *     A stroker handle.
+   *
+   *   inside ::
+   *     A Boolean.  If TRUE, return the inside border, otherwise
+   *     the outside border.
+   *
+   *   destroy ::
+   *     A Boolean.  If TRUE, the source glyph object is destroyed
+   *     on success.
+   *
+   * @return:
+   *    FreeType error code.  0 means success.
+   *
+   * @note:
+   *   The source glyph is untouched in case of error.
+   */
+  FT_EXPORT( FT_Error )
+  FT_Glyph_StrokeBorder( FT_Glyph    *pglyph,
+                         FT_Stroker   stroker,
+                         FT_Bool      inside,
+                         FT_Bool      destroy );
+
+ /* */
+
 FT_END_HEADER
 
 #endif /* __FT_STROKE_H__ */

reactos/lib/freetype/include/freetype
ftsynth.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftsynth.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftsynth.h	10 May 2004 17:48:26 -0000	1.4
@@ -5,7 +5,7 @@
 /*    FreeType synthesizing code for emboldening and slanting              */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -41,6 +41,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
fttrigon.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- fttrigon.h	15 Feb 2004 21:45:31 -0000	1.4
+++ fttrigon.h	10 May 2004 17:48:26 -0000	1.5
@@ -21,6 +21,12 @@
 
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftwinfnt.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftwinfnt.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftwinfnt.h	10 May 2004 17:48:26 -0000	1.5
@@ -22,6 +22,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -43,10 +49,132 @@
   /*                                                                       */
   /*************************************************************************/
 
+
+  /*************************************************************************
+   *
+   * @enum:
+   *   FT_WinFNT_ID_XXX
+   *
+   * @description:
+   *   A list of valid values for the `charset' byte in
+   *   @FT_WinFNT_HeaderRec.  Exact mapping tables for the various cpXXXX
+   *   encodings (except for cp1361) can be found at ftp://ftp.unicode.org
+   *   in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory.  cp1361 is
+   *   roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.
+   *
+   * @values:
+   *   FT_WinFNT_ID_DEFAULT ::
+   *     This is used for font enumeration and font creation as a 
+   *     `don't care' value.  Valid font files don't contain this value.
+   *     When querying for information about the character set of the font
+   *     that is currently selected into a specified device context, this
+   *     return value (of the related Windows API) simply denotes failure.
+   *
+   *   FT_WinFNT_ID_SYMBOL ::
+   *     There is no known mapping table available.
+   *
+   *   FT_WinFNT_ID_MAC ::
+   *     Mac Roman encoding.
+   *
+   *   FT_WinFNT_ID_OEM ::
+   *     From Michael P�ttgen <michael@poettgen.de>:
+   *       The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
+   *       is used for the charset of vector fonts, like `modern.fon',
+   *       `roman.fon', and `script.fon' on Windows.
+   *
+   *       The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value
+   *       specifies a character set that is operating-system dependent.
+   *
+   *       The `IFIMETRICS' documentation from the `Windows Driver
+   *       Development Kit' says: This font supports an OEM-specific
+   *       character set.  The OEM character set is system dependent.
+   *
+   *       In general OEM, as opposed to ANSI (i.e., cp1252), denotes the
+   *       second default codepage that most international versions of
+   *       Windows have.  It is one of the OEM codepages from
+   *
+   *         http://www.microsoft.com/globaldev/reference/cphome.mspx,
+   *    
+   *       and is used for the `DOS boxes', to support legacy applications.
+   *       A German Windows version for example usually uses ANSI codepage
+   *       1252 and OEM codepage 850.
+   *
+   *   FT_WinFNT_ID_CP874 ::
+   *     A superset of Thai TIS 620 and ISO 8859-11.
+   *
+   *   FT_WinFNT_ID_CP932 ::
+   *     A superset of Japanese Shift-JIS (with minor deviations).
+   *
+   *   FT_WinFNT_ID_CP936 ::
+   *     A superset of simplified Chinese GB 2312-1980 (with different
+   *     ordering and minor deviations).
+   *
+   *   FT_WinFNT_ID_CP949 ::
+   *     A superset of Korean Hangul KS C 5601-1987 (with different
+   *     ordering and minor deviations).
+   *
+   *   FT_WinFNT_ID_CP950 ::
+   *     A superset of traditional Chinese Big 5 ETen (with different
+   *     ordering and minor deviations).
+   *
+   *   FT_WinFNT_ID_CP1250 ::
+   *     A superset of East European ISO 8859-2 (with slightly different
+   *     ordering).
+   *
+   *   FT_WinFNT_ID_CP1251 ::
+   *     A superset of Russian ISO 8859-5 (with different ordering).
+   *
+   *   FT_WinFNT_ID_CP1252 ::
+   *     ANSI encoding.  A superset of ISO 8859-1.
+   *
+   *   FT_WinFNT_ID_CP1253 ::
+   *     A superset of Greek ISO 8859-7 (with minor modifications).
+   *     
+   *   FT_WinFNT_ID_CP1254 ::
+   *     A superset of Turkish ISO 8859-9.
+   *     
+   *   FT_WinFNT_ID_CP1255 ::
+   *     A superset of Hebrew ISO 8859-8 (with some modifications).
+   *
+   *   FT_WinFNT_ID_CP1256 ::
+   *     A superset of Arabic ISO 8859-6 (with different ordering).
+   *
+   *   FT_WinFNT_ID_CP1257 ::
+   *     A superset of Baltic ISO 8859-13 (with some deviations).
+   *
+   *   FT_WinFNT_ID_CP1258 ::
+   *     For Vietnamese.  This encoding doesn't cover all necessary
+   *     characters.
+   *
+   *   FT_WinFNT_ID_CP1361 ::
+   *     Korean (Johab).
+   */
+
+#define FT_WinFNT_ID_CP1252    0
+#define FT_WinFNT_ID_DEFAULT   1
+#define FT_WinFNT_ID_SYMBOL    2
+#define FT_WinFNT_ID_MAC      77
+#define FT_WinFNT_ID_CP932   128
+#define FT_WinFNT_ID_CP949   129
+#define FT_WinFNT_ID_CP1361  130
+#define FT_WinFNT_ID_CP936   134
+#define FT_WinFNT_ID_CP950   136
+#define FT_WinFNT_ID_CP1253  161
+#define FT_WinFNT_ID_CP1254  162
+#define FT_WinFNT_ID_CP1258  163
+#define FT_WinFNT_ID_CP1255  177
+#define FT_WinFNT_ID_CP1256  178
+#define FT_WinFNT_ID_CP1257  186
+#define FT_WinFNT_ID_CP1251  204
+#define FT_WinFNT_ID_CP874   222
+#define FT_WinFNT_ID_CP1250  238
+#define FT_WinFNT_ID_OEM     255
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
-  /*    FT_WinFNT_HeaderRec_                                               */
+  /*    FT_WinFNT_HeaderRec                                                */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Windows FNT Header info.                                           */

reactos/lib/freetype/include/freetype
ftxf86.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftxf86.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftxf86.h	10 May 2004 17:48:26 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Support functions for X11.                                           */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,6 +22,13 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
 FT_BEGIN_HEADER
 
   /* this comment is intentionally disabled for now, to prevent this       */
@@ -43,7 +50,7 @@
   /* <Return>                                                              */
   /*    Font format string.  NULL in case of error.                        */
   /*                                                                       */
-  FT_EXPORT_DEF( const char* )
+  FT_EXPORT( const char* )
   FT_Get_X11_Font_Format( FT_Face  face );
 
  /* */

reactos/lib/freetype/include/freetype
t1tables.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1tables.h	15 Feb 2004 21:45:31 -0000	1.4
+++ t1tables.h	10 May 2004 17:48:26 -0000	1.5
@@ -5,7 +5,7 @@
 /*    Basic Type 1/Type 2 tables definitions and interface (specification  */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -24,6 +24,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -129,6 +135,8 @@
     FT_Short   snap_widths [13];  /* including std width  */
     FT_Short   snap_heights[13];  /* including std height */
 
+    FT_Fixed   expansion_factor;
+
     FT_Long    language_group;
     FT_Long    password;
 
@@ -157,7 +165,7 @@
   /*                                                                       */
   /* <Description>                                                         */
   /*    A set of flags used to indicate which fields are present in a      */
-  /*    given blen dictionary (font info or private).  Used to support     */
+  /*    given blend dictionary (font info or private).  Used to support    */
   /*    Multiple Masters fonts.                                            */
   /*                                                                       */
   typedef enum

reactos/lib/freetype/include/freetype
ttnameid.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttnameid.h	15 Feb 2004 21:45:31 -0000	1.5
+++ ttnameid.h	10 May 2004 17:48:26 -0000	1.6
@@ -291,6 +291,7 @@
 #define TT_ADOBE_ID_STANDARD  0
 #define TT_ADOBE_ID_EXPERT    1
 #define TT_ADOBE_ID_CUSTOM    2
+#define TT_ADOBE_ID_LATIN_1   3
 
 
   /*************************************************************************/

reactos/lib/freetype/include/freetype
tttables.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- tttables.h	15 Feb 2004 21:45:31 -0000	1.5
+++ tttables.h	10 May 2004 17:48:26 -0000	1.6
@@ -24,6 +24,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 
@@ -566,11 +572,6 @@
 
   /* */
 
-  /* internal use only */
-  typedef void*
-  (*FT_Get_Sfnt_Table_Func)( FT_Face      face,
-                             FT_Sfnt_Tag  tag );
-
 
   /*************************************************************************/
   /*                                                                       */
@@ -662,6 +663,27 @@
                       FT_Byte*   buffer,
                       FT_ULong*  length );
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Get_CMap_Language_ID                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return TrueType/sfnt specific cmap language ID.  Definitions of    */
+  /*    language ID values are in freetype/ttnameid.h.                     */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    charmap ::                                                         */
+  /*      The target charmap.                                              */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The language ID of `charmap'.  If `charmap' doesn't belong to a    */
+  /*    TrueType/sfnt face, just return 0 as the default value.            */
+  /*                                                                       */
+  FT_EXPORT( FT_ULong )
+  FT_Get_CMap_Language_ID( FT_CharMap  charmap );
+
   /* */
 
 

reactos/lib/freetype/include/freetype
tttags.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- tttags.h	15 Feb 2004 21:45:31 -0000	1.3
+++ tttags.h	10 May 2004 17:48:26 -0000	1.4
@@ -23,6 +23,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ttunpat.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttunpat.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ttunpat.h	10 May 2004 17:48:26 -0000	1.4
@@ -25,6 +25,12 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
 
 FT_BEGIN_HEADER
 

reactos/lib/freetype/include/freetype
ftmodule.h removed after 1.2
diff -N ftmodule.h
--- ftmodule.h	21 Jan 2004 19:23:45 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,314 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftmodule.h                                                             */
-/*                                                                         */
-/*    FreeType modules public interface (specification).                   */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __FTMODULE_H__
-#define __FTMODULE_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Section>                                                             */
-  /*    module_management                                                  */
-  /*                                                                       */
-  /* <Title>                                                               */
-  /*    Module Management                                                  */
-  /*                                                                       */
-  /* <Abstract>                                                            */
-  /*    How to add, upgrade, and remove modules from FreeType.             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The definitions below are used to manage modules within FreeType.  */
-  /*    Modules can be added, upgraded, and removed at runtime.            */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /* module bit flags */
-#define FT_MODULE_FONT_DRIVER         1  /* this module is a font driver  */
-#define FT_MODULE_RENDERER            2  /* this module is a renderer     */
-#define FT_MODULE_HINTER              4  /* this module is a glyph hinter */
-#define FT_MODULE_STYLER              8  /* this module is a styler       */
-
-#define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */
-                                              /* scalable fonts           */
-#define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */
-                                              /* support vector outlines  */
-#define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */
-                                              /* own hinter               */
-
-
-  /* deprecated values */
-#define ft_module_font_driver         FT_MODULE_FONT_DRIVER
-#define ft_module_renderer            FT_MODULE_RENDERER
-#define ft_module_hinter              FT_MODULE_HINTER
-#define ft_module_styler              FT_MODULE_STYLER
-
-#define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE
-#define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES
-#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER
-
-
-  typedef void
-  (*FT_Module_Interface)( void );
-
-  typedef FT_Error
-  (*FT_Module_Constructor)( FT_Module  module );
-
-  typedef void
-  (*FT_Module_Destructor)( FT_Module  module );
-
-  typedef FT_Module_Interface
-  (*FT_Module_Requester)( FT_Module    module,
-                          const char*  name );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FT_Module_Class                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The module class descriptor.                                       */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    module_flags      :: Bit flags describing the module.              */
-  /*                                                                       */
-  /*    module_size       :: The size of one module object/instance in     */
-  /*                         bytes.                                        */
-  /*                                                                       */
-  /*    module_name       :: The name of the module.                       */
-  /*                                                                       */
-  /*    module_version    :: The version, as a 16.16 fixed number          */
-  /*                         (major.minor).                                */
-  /*                                                                       */
-  /*    module_requires   :: The version of FreeType this module requires  */
-  /*                         (starts at version 2.0, i.e 0x20000)          */
-  /*                                                                       */
-  /*    module_init       :: A function used to initialize (not create) a  */
-  /*                         new module object.                            */
-  /*                                                                       */
-  /*    module_done       :: A function used to finalize (not destroy) a   */
-  /*                         given module object                           */
-  /*                                                                       */
-  /*    get_interface     :: Queries a given module for a specific         */
-  /*                         interface by name.                            */
-  /*                                                                       */
-  typedef struct  FT_Module_Class_
-  {
-    FT_ULong               module_flags;
-    FT_Long                module_size;
-    const FT_String*       module_name;
-    FT_Fixed               module_version;
-    FT_Fixed               module_requires;
-
-    const void*            module_interface;
-
-    FT_Module_Constructor  module_init;
-    FT_Module_Destructor   module_done;
-    FT_Module_Requester    get_interface;
-
-  } FT_Module_Class;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Add_Module                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Adds a new module to a given library instance.                     */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    library :: A handle to the library object.                         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    clazz   :: A pointer to class descriptor for the module.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    An error will be returned if a module already exists by that name, */
-  /*    or if the module requires a version of FreeType that is too great. */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_Add_Module( FT_Library              library,
-                 const FT_Module_Class*  clazz );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Get_Module                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Finds a module by its name.                                        */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library     :: A handle to the library object.                     */
-  /*                                                                       */
-  /*    module_name :: The module's name (as an ASCII string).             */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    A module handle.  0 if none was found.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    You should better be familiar with FreeType internals to know      */
-  /*    which module to look for :-)                                       */
-  /*                                                                       */
-  FT_EXPORT( FT_Module )
-  FT_Get_Module( FT_Library   library,
-                 const char*  module_name );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Remove_Module                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Removes a given module from a library instance.                    */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    library :: A handle to a library object.                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    module  :: A handle to a module object.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The module object is destroyed by the function in case of success. */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_Remove_Module( FT_Library  library,
-                    FT_Module   module );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_New_Library                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This function is used to create a new FreeType library instance    */
-  /*    from a given memory object.  It is thus possible to use libraries  */
-  /*    with distinct memory allocators within the same program.           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    memory   :: A handle to the original memory object.                */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    alibrary :: A pointer to handle of a new library object.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_New_Library( FT_Memory    memory,
-                  FT_Library  *alibrary );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Done_Library                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Discards a given library object.  This closes all drivers and      */
-  /*    discards all resource objects.                                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library :: A handle to the target library.                         */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_Done_Library( FT_Library  library );
-
-
-
-  typedef void
-  (*FT_DebugHook_Func)( void*  arg );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Set_Debug_Hook                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Sets a debug hook function for debugging the interpreter of a font */
-  /*    format.                                                            */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    library    :: A handle to the library object.                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    hook_index :: The index of the debug hook.  You should use the     */
-  /*                  values defined in ftobjs.h, e.g.                     */
-  /*                  FT_DEBUG_HOOK_TRUETYPE.                              */
-  /*                                                                       */
-  /*    debug_hook :: The function used to debug the interpreter.          */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Currently, four debug hook slots are available, but only two (for  */
-  /*    the TrueType and the Type 1 interpreter) are defined.              */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FT_Set_Debug_Hook( FT_Library         library,
-                     FT_UInt            hook_index,
-                     FT_DebugHook_Func  debug_hook );
-
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Add_Default_Modules                                             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Adds the set of default drivers to a given library object.         */
-  /*    This is only useful when you create a library object with          */
-  /*    FT_New_Library() (usually to plug a custom memory manager).        */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    library :: A handle to a new library object.                       */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FT_Add_Default_Modules( FT_Library  library );
-
-
-  /* */
-
-
-FT_END_HEADER
-
-#endif /* __FTMODULE_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/cache
ftcmru.h 1.2 -> 1.3
diff -N ftcmru.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftcmru.h	10 May 2004 17:48:27 -0000	1.3
@@ -0,0 +1,246 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcmru.h                                                               */
+/*                                                                         */
+/*    Simple MRU list-cache (specification).                               */
+/*                                                                         */
+/*  Copyright 2000-2001, 2003, 2004 by                                     */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* An MRU is a list that cannot hold more than a certain number of       */
+  /* elements (`max_elements').  All elements in the list are sorted in    */
+  /* least-recently-used order, i.e., the `oldest' element is at the tail  */
+  /* of the list.                                                          */
+  /*                                                                       */
+  /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'),   */
+  /* the list is searched for an element with the corresponding key.  If   */
+  /* it is found, the element is moved to the head of the list and is      */
+  /* returned.                                                             */
+  /*                                                                       */
+  /* If no corresponding element is found, the lookup routine will try to  */
+  /* obtain a new element with the relevant key.  If the list is already   */
+  /* full, the oldest element from the list is discarded and replaced by a */
+  /* new one; a new element is added to the list otherwise.                */
+  /*                                                                       */
+  /* Note that it is possible to pre-allocate the element list nodes.      */
+  /* This is handy if `max_elements' is sufficiently small, as it saves    */
+  /* allocations/releases during the lookup process.                       */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#ifndef __FTCMRU_H__
+#define __FTCMRU_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+#define  xxFT_DEBUG_ERROR
+#define  FTC_INLINE
+
+FT_BEGIN_HEADER
+
+  typedef struct FTC_MruNodeRec_*  FTC_MruNode;
+
+  typedef struct  FTC_MruNodeRec_
+  {
+    FTC_MruNode  next;
+    FTC_MruNode  prev;
+
+  } FTC_MruNodeRec;
+
+
+  FT_EXPORT( void )
+  FTC_MruNode_Prepend( FTC_MruNode  *plist,
+                       FTC_MruNode   node );
+
+  FT_EXPORT( void )
+  FTC_MruNode_Up( FTC_MruNode  *plist,
+                  FTC_MruNode   node );
+
+  FT_EXPORT( void )
+  FTC_MruNode_Remove( FTC_MruNode  *plist,
+                      FTC_MruNode   node );
+
+
+  typedef struct FTC_MruListRec_*              FTC_MruList;
+
+  typedef struct FTC_MruListClassRec_ const *  FTC_MruListClass;
+
+
+  typedef FT_Int
+  (*FTC_MruNode_CompareFunc)( FTC_MruNode  node,
+                              FT_Pointer   key );
+
+  typedef FT_Error
+  (*FTC_MruNode_InitFunc)( FTC_MruNode  node,
+                           FT_Pointer   key,
+                           FT_Pointer   data );
+
+  typedef FT_Error
+  (*FTC_MruNode_ResetFunc)( FTC_MruNode  node,
+                            FT_Pointer   key,
+                            FT_Pointer   data );
+
+  typedef void
+  (*FTC_MruNode_DoneFunc)( FTC_MruNode  node,
+                           FT_Pointer   data );
+
+
+  typedef struct  FTC_MruListClassRec_
+  {
+    FT_UInt                  node_size;
+    FTC_MruNode_CompareFunc  node_compare;
+    FTC_MruNode_InitFunc     node_init;
+    FTC_MruNode_ResetFunc    node_reset;
+    FTC_MruNode_DoneFunc     node_done;
+
+  } FTC_MruListClassRec;
+
+  typedef struct  FTC_MruListRec_
+  {
+    FT_UInt              num_nodes;
+    FT_UInt              max_nodes;
+    FTC_MruNode          nodes;
+    FT_Pointer           data;
+    FTC_MruListClassRec  clazz;
+    FT_Memory            memory;
+
+  } FTC_MruListRec;
+
+
+  FT_EXPORT( void )
+  FTC_MruList_Init( FTC_MruList       list,
+                    FTC_MruListClass  clazz,
+                    FT_UInt           max_nodes,
+                    FT_Pointer        data,
+                    FT_Memory         memory );
+
+  FT_EXPORT( void )
+  FTC_MruList_Reset( FTC_MruList  list );
+
+
+  FT_EXPORT( void )
+  FTC_MruList_Done( FTC_MruList  list );
+
+  FT_EXPORT( FTC_MruNode )
+  FTC_MruList_Find( FTC_MruList  list,
+                    FT_Pointer   key );
+
+  FT_EXPORT( FT_Error )
+  FTC_MruList_New( FTC_MruList   list,
+                   FT_Pointer    key,
+                   FTC_MruNode  *anode );
+
+  FT_EXPORT( FT_Error )
+  FTC_MruList_Lookup( FTC_MruList   list,
+                      FT_Pointer    key,
+                      FTC_MruNode  *pnode );
+                      
+
+  FT_EXPORT( void )
+  FTC_MruList_Remove( FTC_MruList  list,
+                      FTC_MruNode  node );
+
+  FT_EXPORT( void )
+  FTC_MruList_RemoveSelection( FTC_MruList              list,
+                               FTC_MruNode_CompareFunc  selection,
+                               FT_Pointer               key );
+
+
+#ifdef FTC_INLINE
+
+#define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error )           \
+  FT_BEGIN_STMNT                                                            \
+    FTC_MruNode*             _pfirst  = &(list)->nodes;                     \
+    FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \
+    FTC_MruNode              _first, _node;                              \
+                                                                         \
+                                                                         \
+    error  = 0;                                                          \
+    _first = *(_pfirst);                                                 \
+    _node  = NULL;                                                       \
+                                                                         \
+    if ( _first )                                                        \
+    {                                                                    \
+      _node = _first;                                                    \
+      do                                                                 \
+      {                                                                  \
+        if ( _compare( _node, (key) ) )                                  \
+        {                                                                \
+          if ( _node != _first )                                         \
+            FTC_MruNode_Up( _pfirst, _node );                            \
+                                                                         \
+          *(FTC_MruNode*)&(node) = _node;                                \
+          goto _MruOk;                                                   \
+        }                                                                \
+        _node = _node->next;                                             \
+                                                                         \
+      } while ( _node != _first) ;                                       \
+    }                                                                    \
+                                                                         \
+    error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) );     \
+  _MruOk:                                                                \
+    ;                                                                    \
+  FT_END_STMNT
+
+#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
+  FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )
+
+#else  /* !FTC_INLINE */
+
+#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
+  error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) ) 
+
+#endif /* !FTC_INLINE */
+
+
+#define FTC_MRULIST_LOOP( list, node )        \
+  FT_BEGIN_STMNT                              \
+    FTC_MruNode  _first = (list)->nodes;      \
+                                              \
+                                              \
+    if ( _first )                             \
+    {                                         \
+      FTC_MruNode  _node = _first;            \
+                                              \
+                                              \
+      do                                      \
+      {                                       \
+        *(FTC_MruNode*)&(node) = _node;
+
+
+#define FTC_MRULIST_LOOP_END()               \
+        _node = _node->next;                 \
+                                             \
+      } while ( _node != _first );           \
+    }                                        \
+  FT_END_STMNT
+
+ /* */
+
+FT_END_HEADER
+
+
+#endif /* __FTCMRU_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/cache
ftccache.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftccache.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftccache.h	10 May 2004 17:48:27 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType internal cache interface (specification).                   */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,9 +20,7 @@
 #define __FTCCACHE_H__
 
 
-/* define to allow cache lookup inlining */
-#define  FTC_CACHE_USE_INLINE
-
+#include FT_CACHE_INTERNAL_MRU_H
 
 FT_BEGIN_HEADER
 
@@ -30,13 +28,7 @@
   typedef struct FTC_CacheRec_*  FTC_Cache;
 
   /* handle to cache class */
-  typedef const struct FTC_Cache_ClassRec_*  FTC_Cache_Class;
-
-  /* handle to cache node family */
-  typedef struct FTC_FamilyRec_*  FTC_Family;
-
-  /* handle to cache root query */
-  typedef struct FTC_QueryRec_*  FTC_Query;
+  typedef const struct FTC_CacheClassRec_*  FTC_CacheClass;
 
 
   /*************************************************************************/
@@ -62,12 +54,11 @@
   /* structure size should be 20 bytes on 32-bits machines */
   typedef struct  FTC_NodeRec_
   {
-    FTC_Node   mru_next;     /* circular mru list pointer           */
-    FTC_Node   mru_prev;     /* circular mru list pointer           */
-    FTC_Node   link;         /* used for hashing                    */
-    FT_UInt32  hash;         /* used for hashing too                */
-    FT_UShort  fam_index;    /* index of family the node belongs to */
-    FT_Short   ref_count;    /* reference count for this node       */
+    FTC_MruNodeRec  mru;          /* circular mru list pointer           */
+    FTC_Node        link;         /* used for hashing                    */
+    FT_UInt32       hash;         /* used for hashing too                */
+    FT_UShort       cache_index;  /* index of cache the node belongs to  */
+    FT_Short        ref_count;    /* reference count for this node       */
 
   } FTC_NodeRec;
 
@@ -75,6 +66,9 @@
 #define FTC_NODE( x )    ( (FTC_Node)(x) )
 #define FTC_NODE_P( x )  ( (FTC_Node*)(x) )
 
+#define FTC_NODE__NEXT(x)  FTC_NODE( (x)->mru.next )
+#define FTC_NODE__PREV(x)  FTC_NODE( (x)->mru.prev )
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -83,11 +77,6 @@
   /* cache sub-system internals.                                           */
   /*                                                                       */
 
-  /* can be used as a FTC_Node_DoneFunc */
-  FT_EXPORT( void )
-  ftc_node_done( FTC_Node   node,
-                 FTC_Cache  cache );
-
   /* reserved for manager's use */
   FT_EXPORT( void )
   ftc_node_destroy( FTC_Node     node,
@@ -97,135 +86,17 @@
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
-  /*****                   CACHE QUERY DEFINITIONS                     *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* A structure modelling a cache node query.  The following fields must  */
-  /* all be set by the @FTC_Family_CompareFunc method of a cache's family  */
-  /* list.                                                                 */
-  /*                                                                       */
-  typedef struct  FTC_QueryRec_
-  {
-    FTC_Family  family;
-    FT_UFast    hash;
-
-  } FTC_QueryRec;
-
-
-#define FTC_QUERY( x )    ( (FTC_Query)(x) )
-#define FTC_QUERY_P( x )  ( (FTC_Query*)(x) )
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                   CACHE FAMILY DEFINITIONS                    *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  typedef struct  FTC_FamilyRec_
-  {
-    FT_LruNodeRec  lru;
-    FTC_Cache      cache;
-    FT_UInt        num_nodes;
-    FT_UInt        fam_index;
-
-  } FTC_FamilyRec;
-
-
-#define FTC_FAMILY( x )    ( (FTC_Family)(x) )
-#define FTC_FAMILY_P( x )  ( (FTC_Family*)(x) )
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* These functions are exported so that they can be called from          */
-  /* user-provided cache classes; otherwise, they are really part of the   */
-  /* cache sub-system internals.                                           */
-  /*                                                                       */
-
-  /* must be called by any FTC_Node_InitFunc routine */
-  FT_EXPORT( FT_Error )
-  ftc_family_init( FTC_Family  family,
-                   FTC_Query   query,
-                   FTC_Cache   cache );
-
-
-  /* can be used as a FTC_Family_DoneFunc; otherwise, must be called */
-  /* by any family finalizer function                                */
-  FT_EXPORT( void )
-  ftc_family_done( FTC_Family  family );
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
   /*****                       CACHE DEFINITIONS                       *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-  /* each cache really implements a dynamic hash table to manage its nodes */
-  typedef struct  FTC_CacheRec_
-  {
-    FTC_Manager          manager;
-    FT_Memory            memory;
-    FTC_Cache_Class      clazz;
-
-    FT_UInt              cache_index;  /* in manager's table         */
-    FT_Pointer           cache_data;   /* used by cache node methods */
-
-    FT_UFast             p;
-    FT_UFast             mask;
-    FT_Long              slack;
-    FTC_Node*            buckets;
-
-    FT_LruList_ClassRec  family_class;
-    FT_LruList           families;
-
-  } FTC_CacheRec;
-
-
-#define FTC_CACHE( x )    ( (FTC_Cache)(x) )
-#define FTC_CACHE_P( x )  ( (FTC_Cache*)(x) )
-
-
-  /* initialize a given cache */
-  typedef FT_Error
-  (*FTC_Cache_InitFunc)( FTC_Cache  cache );
-
-  /* clear a cache */
-  typedef void
-  (*FTC_Cache_ClearFunc)( FTC_Cache  cache );
-
-  /* finalize a given cache */
-  typedef void
-  (*FTC_Cache_DoneFunc)( FTC_Cache  cache );
-
-
-  typedef FT_Error
-  (*FTC_Family_InitFunc)( FTC_Family  family,
-                          FTC_Query   query,
-                          FTC_Cache   cache );
-
-  typedef FT_Int
-  (*FTC_Family_CompareFunc)( FTC_Family  family,
-                             FTC_Query   query );
-
-  typedef void
-  (*FTC_Family_DoneFunc)( FTC_Family  family,
-                          FTC_Cache   cache );
-
   /* initialize a new cache node */
   typedef FT_Error
-  (*FTC_Node_InitFunc)( FTC_Node    node,
-                        FT_Pointer  type,
-                        FTC_Cache   cache );
+  (*FTC_Node_NewFunc)( FTC_Node    *pnode,
+                       FT_Pointer   query,
+                       FTC_Cache    cache );
 
-  /* compute the weight of a given cache node */
   typedef FT_ULong
   (*FTC_Node_WeightFunc)( FTC_Node   node,
                           FTC_Cache  cache );
@@ -236,62 +107,159 @@
                            FT_Pointer  key,
                            FTC_Cache   cache );
 
-  /* finalize a given cache node */
+
   typedef void
-  (*FTC_Node_DoneFunc)( FTC_Node   node,
+  (*FTC_Node_FreeFunc)( FTC_Node   node,
                         FTC_Cache  cache );
 
+  typedef FT_Error
+  (*FTC_Cache_InitFunc)( FTC_Cache  cache );
+
+  typedef void
+  (*FTC_Cache_DoneFunc)( FTC_Cache  cache );
 
-  typedef struct  FTC_Cache_ClassRec_
+
+  typedef struct  FTC_CacheClassRec_
   {
-    FT_UInt                 cache_size;
-    FTC_Cache_InitFunc      cache_init;
-    FTC_Cache_ClearFunc     cache_clear;
-    FTC_Cache_DoneFunc      cache_done;
-
-    FT_UInt                 family_size;
-    FTC_Family_InitFunc     family_init;
-    FTC_Family_CompareFunc  family_compare;
-    FTC_Family_DoneFunc     family_done;
-
-    FT_UInt                 node_size;
-    FTC_Node_InitFunc       node_init;
-    FTC_Node_WeightFunc     node_weight;
-    FTC_Node_CompareFunc    node_compare;
-    FTC_Node_DoneFunc       node_done;
+    FTC_Node_NewFunc      node_new;
+    FTC_Node_WeightFunc   node_weight;
+    FTC_Node_CompareFunc  node_compare;
+    FTC_Node_CompareFunc  node_remove_faceid;
+    FTC_Node_FreeFunc     node_free;
+
+    FT_UInt               cache_size;
+    FTC_Cache_InitFunc    cache_init;
+    FTC_Cache_DoneFunc    cache_done;
 
-  } FTC_Cache_ClassRec;
+  } FTC_CacheClassRec;
 
 
-  /* */
+  /* each cache really implements a dynamic hash table to manage its nodes */
+  typedef struct  FTC_CacheRec_
+  {
+    FT_UFast           p;
+    FT_UFast           mask;
+    FT_Long            slack;
+    FTC_Node*          buckets;
+
+    FTC_CacheClassRec  clazz;       /* local copy, for speed  */
+
+    FTC_Manager        manager;
+    FT_Memory          memory;
+    FT_UInt            index;       /* in manager's table     */
 
+    FTC_CacheClass     org_class;   /* original class pointer */
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* These functions are exported so that they can be called from          */
-  /* user-provided cache classes; otherwise, they are really part of the   */
-  /* cache sub-system internals.                                           */
-  /*                                                                       */
+  } FTC_CacheRec;
 
-  /* can be used directly as FTC_Cache_DoneFunc(), or called by custom */
-  /* cache finalizers                                                  */
-  FT_EXPORT( void )
-  ftc_cache_done( FTC_Cache  cache );
 
-  /* can be used directly as FTC_Cache_ClearFunc(), or called by custom */
-  /* cache clear routines                                               */
+#define FTC_CACHE( x )    ( (FTC_Cache)(x) )
+#define FTC_CACHE_P( x )  ( (FTC_Cache*)(x) )
+
+
+  /* default cache initialize */
+  FT_EXPORT( FT_Error )
+  FTC_Cache_Init( FTC_Cache  cache );
+
+  /* default cache finalizer */
   FT_EXPORT( void )
-  ftc_cache_clear( FTC_Cache  cache );
+  FTC_Cache_Done( FTC_Cache  cache );
 
-  /* initalize the hash table within the cache */
+  /* Call this function to lookup the cache.  If no corresponding
+   * node is found, a new one is automatically created.  This function
+   * is capable of flushing the cache adequately to make room for the
+   * new cache object.
+   */
   FT_EXPORT( FT_Error )
-  ftc_cache_init( FTC_Cache  cache );
+  FTC_Cache_Lookup( FTC_Cache   cache,
+                    FT_UInt32   hash,
+                    FT_Pointer  query,
+                    FTC_Node   *anode );
 
-  /* can be called when the key's hash value has been computed */
   FT_EXPORT( FT_Error )
-  ftc_cache_lookup( FTC_Cache  cache,
-                    FTC_Query  query,
-                    FTC_Node  *anode );
+  FTC_Cache_NewNode( FTC_Cache   cache,
+                     FT_UInt32   hash,
+                     FT_Pointer  query,
+                     FTC_Node   *anode );
+
+  /* Remove all nodes that relate to a given face_id.  This is useful
+   * when un-installing fonts.  Note that if a cache node relates to
+   * the face_id, but is locked (i.e., has 'ref_count > 0'), the node
+   * will _not_ be destroyed, but its internal face_id reference will
+   * be modified.
+   *
+   * The final result will be that the node will never come back
+   * in further lookup requests, and will be flushed on demand from
+   * the cache normally when its reference count reaches 0.
+   */
+  FT_EXPORT( void )
+  FTC_Cache_RemoveFaceID( FTC_Cache   cache,
+                          FTC_FaceID  face_id );
+
+
+#ifdef FTC_INLINE
+
+#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
+  FT_BEGIN_STMNT                                                         \
+    FTC_Node             *_bucket, *_pnode, _node;                       \
+    FTC_Cache             _cache   = FTC_CACHE(cache);                   \
+    FT_UInt32             _hash    = (FT_UInt32)(hash);                  \
+    FTC_Node_CompareFunc  _nodcomp = (FTC_Node_CompareFunc)(nodecmp);    \
+    FT_UInt               _idx;                                          \
+                                                                         \
+                                                                         \
+    error = 0;                                                           \
+    node  = NULL;                                                        \
+    _idx  = _hash & _cache->mask;                                        \
+    if ( _idx < _cache->p )                                              \
+      _idx = _hash & ( _cache->mask*2 + 1 );                             \
+                                                                         \
+    _bucket = _pnode = _cache->buckets + _idx;                           \
+    for (;;)                                                             \
+    {                                                                    \
+      _node = *_pnode;                                                   \
+      if ( _node == NULL )                                               \
+        goto _NewNode;                                                   \
+                                                                         \
+      if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) )    \
+        break;                                                           \
+                                                                         \
+      _pnode = &_node->link;                                             \
+    }                                                                    \
+                                                                         \
+    if ( _node != *_bucket )                                             \
+    {                                                                    \
+      *_pnode     = _node->link;                                         \
+      _node->link = *_bucket;                                            \
+      *_bucket    = _node;                                               \
+    }                                                                    \
+                                                                         \
+    {                                                                    \
+      FTC_Manager  _manager = _cache->manager;                           \
+                                                                         \
+                                                                         \
+      if ( _node != _manager->nodes_list )                               \
+        FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list,             \
+                        (FTC_MruNode)_node );                            \
+    }                                                                    \
+    goto _Ok;                                                            \
+                                                                         \
+  _NewNode:                                                              \
+    error = FTC_Cache_NewNode( _cache, _hash, query, &_node );           \
+                                                                         \
+  _Ok:                                                                   \
+    *(FTC_Node*)&(node) = _node;                                         \
+  FT_END_STMNT
+
+#else /* !FTC_INLINE */
+
+#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
+  FT_BEGIN_STMNT                                                         \
+    error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query,           \
+                              (FTC_Node*)&(node) );                      \
+  FT_END_STMNT
+
+#endif /* !FTC_INLINE */
 
  /* */
 

reactos/lib/freetype/include/freetype/cache
ftcglyph.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftcglyph.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftcglyph.h	10 May 2004 17:48:27 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType abstract glyph cache (specification).                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2003 by                                           */
+/*  Copyright 2000-2001, 2003, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,13 +16,84 @@
 /***************************************************************************/
 
 
+  /*
+   *
+   *  FTC_GCache is an _abstract_ cache object optimized to store glyph
+   *  data.  It works as follows:
+   *
+   *   - It manages FTC_GNode objects. Each one of them can hold one or more
+   *     glyph `items'.  Item types are not specified in the FTC_GCache but
+   *     in classes that extend it.
+   *
+   *   - Glyph attributes, like face ID, character size, render mode, etc.,
+   *     can be grouped into abstract `glyph families'.  This avoids storing
+   *     the attributes within the FTC_GCache, since it is likely that many
+   *     FTC_GNodes will belong to the same family in typical uses.
+   *
+   *   - Each FTC_GNode is thus an FTC_Node with two additional fields:
+   *
+   *       * gindex: A glyph index, or the first index in a glyph range.
+   *       * family: A pointer to a glyph `family'.
+   *
+   *   - Family types are not fully specific in the FTC_Family type, but
+   *     by classes that extend it.
+   *
+   *  Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.
+   *  They share an FTC_Family sub-class called FTC_BasicFamily which is
+   *  used to store the following data: face ID, pixel/point sizes, load
+   *  flags.  For more details see the file `src/cache/ftcbasic.c'.
+   *
+   *  Client applications can extend FTC_GNode with their own FTC_GNode
+   *  and FTC_Family sub-classes to implement more complex caches (e.g.,
+   *  handling automatic synthesis, like obliquing & emboldening, colored
+   *  glyphs, etc.).
+   *
+   *  See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and
+   *  `ftcsbits.h', which both extend FTC_GCache with additional
+   *  optimizations.
+   *
+   *  A typical FTC_GCache implementation must provide at least the
+   *  following:
+   *
+   *  - FTC_GNode sub-class, e.g. MyNode, with relevant methods:
+   *        my_node_new            (must call FTC_GNode_Init)
+   *        my_node_free           (must call FTC_GNode_Done)
+   *        my_node_compare        (must call FTC_GNode_Compare)
+   *        my_node_remove_faceid  (must call ftc_gnode_unselect in case
+   *                                of match)
+   *
+   *  - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
+   *        my_family_compare
+   *        my_family_init
+   *        my_family_reset (optional)
+   *        my_family_done
+   *
+   *  - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
+   *    data.
+   *
+   *  - Constant structures for a FTC_GNodeClass.
+   *
+   *  - MyCacheNew() can be implemented easily as a call to the convenience
+   *    function FTC_GCache_New.
+   *
+   *  - MyCacheLookup with a call to FTC_GCache_Lookup.  This function will
+   *    automatically:
+   *
+   *    - Search for the corresponding family in the cache, or create
+   *      a new one if necessary.  Put it in FTC_GQUERY(myquery).family
+   *
+   *    - Call FTC_Cache_Lookup.
+   *
+   *    If it returns NULL, you should create a new node, then call
+   *    ftc_cache_add as usual.
+   */
+
+
   /*************************************************************************/
   /*                                                                       */
   /* Important: The functions defined in this file are only used to        */
   /*            implement an abstract glyph cache class.  You need to      */
   /*            provide additional logic to implement a complete cache.    */
-  /*            For example, see `ftcimage.h' and `ftcimage.c' which       */
-  /*            implement a FT_Glyph cache based on this code.             */
   /*                                                                       */
   /*************************************************************************/
 
@@ -47,99 +118,53 @@
 
 
 #include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_MANAGER_H
-
-#include <stddef.h>
+#include FT_CACHE_INTERNAL_MANAGER_H
 
 
 FT_BEGIN_HEADER
 
 
-  /* each glyph set is characterized by a "glyph set type" which must be */
-  /* defined by sub-classes                                              */
-  typedef struct FTC_GlyphFamilyRec_*  FTC_GlyphFamily;
-
-  /* handle to a glyph cache node */
-  typedef struct FTC_GlyphNodeRec_*  FTC_GlyphNode;
+ /*
+  *  We can group glyphs into `families'.  Each family correspond to a
+  *  given face ID, character size, transform, etc.
+  *
+  *  Families are implemented as MRU list nodes.  They are
+  *  reference-counted.
+  */
 
-
-  /* size should be 24 + chunk size on 32-bit machines;                 */
-  /* note that the node's hash is ((gfam->hash << 16) | glyph_index) -- */
-  /* this _must_ be set properly by the glyph node initializer          */
-  /*                                                                    */
-  typedef struct  FTC_GlyphNodeRec_
+  typedef struct  FTC_FamilyRec_
   {
-    FTC_NodeRec   node;
-    FT_UShort     item_count;
-    FT_UShort     item_start;
-
-  } FTC_GlyphNodeRec;
+    FTC_MruNodeRec    mrunode;
+    FT_UInt           num_nodes; /* current number of nodes in this family */
+    FTC_Cache         cache;
+    FTC_MruListClass  clazz;
 
+  } FTC_FamilyRec, *FTC_Family;
 
-#define FTC_GLYPH_NODE( x )    ( (FTC_GlyphNode)(x) )
-#define FTC_GLYPH_NODE_P( x )  ( (FTC_GlyphNode*)(x) )
+#define  FTC_FAMILY(x)    ( (FTC_Family)(x) )
+#define  FTC_FAMILY_P(x)  ( (FTC_Family*)(x) )
 
 
-  typedef struct  FTC_GlyphQueryRec_
+  typedef struct  FTC_GNodeRec_
   {
-    FTC_QueryRec  query;
-    FT_UInt       gindex;
+    FTC_NodeRec      node;
+    FTC_Family       family;
+    FT_UInt          gindex;
 
-  } FTC_GlyphQueryRec, *FTC_GlyphQuery;
+  } FTC_GNodeRec, *FTC_GNode;
 
+#define FTC_GNODE( x )    ( (FTC_GNode)(x) )
+#define FTC_GNODE_P( x )  ( (FTC_GNode*)(x) )
 
-#define FTC_GLYPH_QUERY( x )  ( (FTC_GlyphQuery)(x) )
 
-
-  /* a glyph set is used to categorize glyphs of a given type */
-  typedef struct  FTC_GlyphFamilyRec_
+  typedef struct  FTC_GQueryRec_
   {
-    FTC_FamilyRec  family;
-    FT_UInt32      hash;
-    FT_UInt        item_total;   /* total number of glyphs in family */
-    FT_UInt        item_count;   /* number of glyph items per node   */
-
-  } FTC_GlyphFamilyRec;
-
-
-#define FTC_GLYPH_FAMILY( x )         ( (FTC_GlyphFamily)(x) )
-#define FTC_GLYPH_FAMILY_P( x )       ( (FTC_GlyphFamily*)(x) )
-
-#define FTC_GLYPH_FAMILY_MEMORY( x )  FTC_FAMILY(x)->cache->memory
-
-
-  /* each glyph node contains a 'chunk' of glyph items; */
-  /* translate a glyph index into a chunk index         */
-#define FTC_GLYPH_FAMILY_CHUNK( gfam, gindex )                  \
-          ( ( gindex ) / FTC_GLYPH_FAMILY( gfam )->item_count )
-
-  /* find a glyph index's chunk, and return its start index */
-#define FTC_GLYPH_FAMILY_START( gfam, gindex )       \
-          ( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) * \
-            FTC_GLYPH_FAMILY( gfam )->item_count )
-
-  /* compute a glyph request's hash value */
-#define FTC_GLYPH_FAMILY_HASH( gfam, gindex )                          \
-          ( (FT_UFast)(                                                \
-              ( FTC_GLYPH_FAMILY( gfam )->hash << 16 ) |               \
-              ( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) & 0xFFFFU ) ) )
-
-  /* must be called in an FTC_Family_CompareFunc to update the query */
-  /* whenever a glyph set is matched in the lookup, or when it       */
-  /* is created                                                      */
-#define FTC_GLYPH_FAMILY_FOUND( gfam, gquery )                            \
-          do                                                              \
-          {                                                               \
-            FTC_QUERY( gquery )->family = FTC_FAMILY( gfam );             \
-            FTC_QUERY( gquery )->hash =                                   \
-              FTC_GLYPH_FAMILY_HASH( gfam,                                \
-                                     FTC_GLYPH_QUERY( gquery )->gindex ); \
-          } while ( 0 )
-
-  /* retrieve glyph index of glyph node */
-#define FTC_GLYPH_NODE_GINDEX( x )                                  \
-          ( (FT_UInt)( FTC_GLYPH_NODE( x )->node.hash & 0xFFFFU ) )
+    FT_UInt      gindex;
+    FTC_Family   family;
+
+  } FTC_GQueryRec, *FTC_GQuery;
+
+#define FTC_GQUERY( x )  ( (FTC_GQuery)(x) )
 
 
   /*************************************************************************/
@@ -151,39 +176,116 @@
 
   /* must be called by derived FTC_Node_InitFunc routines */
   FT_EXPORT( void )
-  ftc_glyph_node_init( FTC_GlyphNode    node,
-                       FT_UInt          gindex,  /* glyph index for node */
-                       FTC_GlyphFamily  gfam );
+  FTC_GNode_Init( FTC_GNode   node,
+                  FT_UInt     gindex,  /* glyph index for node */
+                  FTC_Family  family );
 
   /* returns TRUE iff the query's glyph index correspond to the node;  */
   /* this assumes that the "family" and "hash" fields of the query are */
   /* already correctly set                                             */
   FT_EXPORT( FT_Bool )
-  ftc_glyph_node_compare( FTC_GlyphNode   gnode,
-                          FTC_GlyphQuery  gquery );
+  FTC_GNode_Compare( FTC_GNode   gnode,
+                     FTC_GQuery  gquery );
+
+  /* call this function to clear a node's family -- this is necessary */
+  /* to implement the `node_remove_faceid' cache method correctly     */
+  FT_EXPORT( void )
+  FTC_GNode_UnselectFamily( FTC_GNode  gnode,
+                            FTC_Cache  cache );
 
   /* must be called by derived FTC_Node_DoneFunc routines */
   FT_EXPORT( void )
-  ftc_glyph_node_done( FTC_GlyphNode  node,
-                       FTC_Cache      cache );
+  FTC_GNode_Done( FTC_GNode  node,
+                  FTC_Cache  cache );
+
+
+  FT_EXPORT( void )
+  FTC_Family_Init( FTC_Family  family,
+                   FTC_Cache   cache );
+
+  typedef struct FTC_GCacheRec_
+  {
+    FTC_CacheRec    cache;
+    FTC_MruListRec  families;
+
+  } FTC_GCacheRec, *FTC_GCache;
+
+#define FTC_GCACHE( x )  ((FTC_GCache)(x))
 
 
-  /* must be called by derived FTC_Family_InitFunc; */
-  /* calls "ftc_family_init"                        */
+  /* can be used as @FTC_Cache_InitFunc */
   FT_EXPORT( FT_Error )
-  ftc_glyph_family_init( FTC_GlyphFamily  gfam,
-                         FT_UInt32        hash,
-                         FT_UInt          item_count,
-                         FT_UInt          item_total,
-                         FTC_GlyphQuery   gquery,
-                         FTC_Cache        cache );
+  FTC_GCache_Init( FTC_GCache  cache );
 
+
+  /* can be used as @FTC_Cache_DoneFunc */
   FT_EXPORT( void )
-  ftc_glyph_family_done( FTC_GlyphFamily  gfam );
+  FTC_GCache_Done( FTC_GCache  cache );
+
+
+  /* the glyph cache class adds fields for the family implementation */
+  typedef struct  FTC_GCacheClassRec_
+  {
+    FTC_CacheClassRec  clazz;
+    FTC_MruListClass   family_class;
+
+  } FTC_GCacheClassRec;
+
+  typedef const FTC_GCacheClassRec*   FTC_GCacheClass;
+
+#define FTC_GCACHE_CLASS( x )  ((FTC_GCacheClass)(x))
+
+#define FTC_CACHE__GCACHE_CLASS( x ) \
+          FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
+#define FTC_CACHE__FAMILY_CLASS( x ) \
+          ((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class)
 
 
+  /* convenience function; use it instead of FTC_Manager_Register_Cache */
+  FT_EXPORT( FT_Error )
+  FTC_GCache_New( FTC_Manager       manager,
+                  FTC_GCacheClass   clazz,
+                  FTC_GCache       *acache );
+
+  FT_EXPORT( FT_Error )
+  FTC_GCache_Lookup( FTC_GCache   cache,
+                     FT_UInt32    hash,
+                     FT_UInt      gindex,
+                     FTC_GQuery   query,
+                     FTC_Node    *anode );
+
+
+#ifdef FTC_INLINE
+
+#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,                \
+                               gindex, query, node, error )                 \
+  FT_BEGIN_STMNT                                                            \
+    FTC_GCache               _gcache   = FTC_GCACHE( cache );               \
+    FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \
+    FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
+                                                                            \
+                                                                            \
+    _gquery->gindex = (gindex);                                             \
+                                                                            \
+    FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \
+                            _gquery->family, error );                       \
+    if ( !error )                                                           \
+      FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error );     \
+  FT_END_STMNT
   /* */
- 
+
+#else /* !FTC_INLINE */
+
+#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,               \
+                               gindex, query, node, error )                \
+   FT_BEGIN_STMNT                                                          \
+     error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,         \
+                                FTC_GQUERY( query ), (FTC_Node*)&(node) ); \
+   FT_END_STMNT
+
+#endif /* !FTC_INLINE */
+
+
 FT_END_HEADER
 
 

reactos/lib/freetype/include/freetype/cache
ftcimage.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftcimage.h	15 Feb 2004 21:45:31 -0000	1.4
+++ ftcimage.h	10 May 2004 17:48:27 -0000	1.5
@@ -2,7 +2,7 @@
 /*                                                                         */
 /*  ftcimage.h                                                             */
 /*                                                                         */
-/*    FreeType Image cache (specification).                                */
+/*    FreeType Generic Image cache (specification)                         */
 /*                                                                         */
 /*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
@@ -16,6 +16,15 @@
 /***************************************************************************/
 
 
+ /*
+  *  FTC_ICache is an _abstract_ cache used to store a single FT_Glyph
+  *  image per cache node.
+  *
+  *  FTC_ICache extends FTC_GCache.  For an implementation example,
+  *  see FTC_ImageCache in `src/cache/ftbasic.c'.
+  */
+  
+
   /*************************************************************************/
   /*                                                                       */
   /* Each image cache really manages FT_Glyph objects.                     */
@@ -29,284 +38,66 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-
+#include FT_CACHE_INTERNAL_GLYPH_H
 
 FT_BEGIN_HEADER
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Section>                                                             */
-  /*    cache_subsystem                                                    */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                       IMAGE CACHE OBJECT                      *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
- /**************************************************************************
-  *
-  * @struct:
-  *   FTC_ImageTypeRec
-  *
-  * @description:
-  *   A simple structure used to describe the type of glyph image to be
-  *   loaded into the cache.
-  *
-  * @fields:
-  *   font  :: An @FTC_FontRec used to describe the glyph's face and size.
-  *
-  *   flags :: The load flags to be applied when loading the glyph; see
-  *            the @FT_LOAD_XXX constants for details.
-  *
-  * @note:
-  *   This type completely replaces the @FTC_Image_Desc structure which is
-  *   now obsolete.
-  */
-  typedef struct  FTC_ImageTypeRec_
+  /* the FT_Glyph image node type - we store only 1 glyph per node */
+  typedef struct  FTC_INodeRec_
   {
-    FTC_FontRec  font;
-    FT_Int32     flags;
-
-  } FTC_ImageTypeRec;
-
-  typedef struct FTC_ImageTypeRec_*   FTC_ImageType;
-
- /* */
-
-#define FTC_IMAGE_TYPE_COMPARE( d1, d2 )                    \
-          ( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
-            (d1)->flags == (d2)->flags                   )
-
-#define FTC_IMAGE_TYPE_HASH( d )                    \
-          (FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
-                      ( (d)->flags << 4 )         )
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    FTC_ImageCache                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A handle to an glyph image cache object.  They are designed to     */
-  /*    hold many distinct glyph images while not exceeding a certain      */
-  /*    memory threshold.                                                  */
-  /*                                                                       */
-  typedef struct FTC_ImageCacheRec_*  FTC_ImageCache;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_ImageCache_New                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new glyph image cache.                                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    manager :: The parent manager for the image cache.                 */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    acache  :: A handle to the new glyph image cache object.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_ImageCache_New( FTC_Manager      manager,
-                      FTC_ImageCache  *acache );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_ImageCache_Lookup                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Retrieves a given glyph image from a glyph image cache.            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    cache  :: A handle to the source glyph image cache.                */
-  /*                                                                       */
-  /*    type   :: A pointer to a glyph image type descriptor.              */
-  /*                                                                       */
-  /*    gindex :: The glyph index to retrieve.                             */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    aglyph :: The corresponding @FT_Glyph object.  0 in case of        */
-  /*              failure.                                                 */
-  /*                                                                       */
-  /*    anode  :: Used to return the address of of the corresponding cache */
-  /*              node after incrementing its reference count (see note    */
-  /*              below).                                                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The returned glyph is owned and managed by the glyph image cache.  */
-  /*    Never try to transform or discard it manually!  You can however    */
-  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */
-  /*                                                                       */
-  /*    If "anode" is _not_ NULL, it receives the address of the cache     */
-  /*    node containing the glyph image, after increasing its reference    */
-  /*    count.  This ensures that the node (as well as the FT_Glyph) will  */
-  /*    always be kept in the cache until you call @FTC_Node_Unref to      */
-  /*    "release" it.                                                      */
-  /*                                                                       */
-  /*    If "anode" is NULL, the cache node is left unchanged, which means  */
-  /*    that the FT_Glyph could be flushed out of the cache on the next    */
-  /*    call to one of the caching sub-system APIs.  Don't assume that it  */
-  /*    is persistent!                                                     */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_ImageCache_Lookup( FTC_ImageCache  cache,
-                         FTC_ImageType   type,
-                         FT_UInt         gindex,
-                         FT_Glyph       *aglyph,
-                         FTC_Node       *anode );
-
-  /* */
-
-#define ftc_image_format( x )  ( (x) & 7 )
-
+    FTC_GNodeRec  gnode;
+    FT_Glyph      glyph;
 
-#define ftc_image_format_bitmap    0x0000
-#define ftc_image_format_outline   0x0001
+  } FTC_INodeRec, *FTC_INode;
 
-#define ftc_image_format_mask      0x000F
+#define FTC_INODE( x )         ( (FTC_INode)( x ) )
+#define FTC_INODE_GINDEX( x )  FTC_GNODE(x)->gindex
+#define FTC_INODE_FAMILY( x )  FTC_GNODE(x)->family
+
+  typedef FT_Error
+  (*FTC_IFamily_LoadGlyphFunc)( FTC_Family  family,
+                                FT_UInt     gindex,
+                                FTC_Cache   cache,
+                                FT_Glyph   *aglyph );
 
-#define ftc_image_flag_monochrome  0x0010
-#define ftc_image_flag_unhinted    0x0020
-#define ftc_image_flag_autohinted  0x0040
-#define ftc_image_flag_unscaled    0x0080
-#define ftc_image_flag_no_sbits    0x0100
-
-  /* monochrome bitmap */
-#define ftc_image_mono             ftc_image_format_bitmap | \
-                                   ftc_image_flag_monochrome
-
-  /* anti-aliased bitmap */
-#define ftc_image_grays            ftc_image_format_bitmap
-
-  /* scaled outline */
-#define ftc_image_outline          ftc_image_format_outline
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FTC_Image_Desc                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    THIS TYPE IS DEPRECATED.  Use @FTC_ImageTypeRec instead.           */
-  /*                                                                       */
-  /*    A simple structure used to describe a given glyph image category.  */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    font       :: An @FTC_FontRec used to describe the glyph's face    */
-  /*                  and size.                                            */
-  /*                                                                       */
-  /*    image_type :: The glyph image's type.                              */
-  /*                                                                       */
-  typedef struct  FTC_Image_Desc_
+  typedef struct  FTC_IFamilyClassRec_
   {
-    FTC_FontRec  font;
-    FT_UInt      image_type;
+    FTC_MruListClassRec        clazz;
+    FTC_IFamily_LoadGlyphFunc  family_load_glyph;
 
-  } FTC_Image_Desc;
+  } FTC_IFamilyClassRec;
 
+  typedef const FTC_IFamilyClassRec*  FTC_IFamilyClass;
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    FTC_Image_Cache                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    THIS TYPE IS DEPRECATED.  Use @FTC_ImageCache instead.             */
-  /*                                                                       */
-  typedef FTC_ImageCache  FTC_Image_Cache;
+#define FTC_IFAMILY_CLASS( x )  ((FTC_IFamilyClass)(x))
 
+#define FTC_CACHE__IFAMILY_CLASS( x ) \
+          FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_Image_Cache_New                                                */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    THIS FUNCTION IS DEPRECATED.  Use @FTC_ImageCache_New instead.     */
-  /*                                                                       */
-  /*    Creates a new glyph image cache.                                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    manager :: The parent manager for the image cache.                 */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    acache  :: A handle to the new glyph image cache object.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_Image_Cache_New( FTC_Manager       manager,
-                       FTC_Image_Cache  *acache );
 
+  /* can be used as a @FTC_Node_FreeFunc */
+  FT_EXPORT( void )
+  FTC_INode_Free( FTC_INode  inode,
+                  FTC_Cache  cache );
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_Image_Cache_Lookup                                             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    THIS FUNCTION IS DEPRECATED.  Use @FTC_ImageCache_Lookup instead.  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    cache  :: A handle to the source glyph image cache.                */
-  /*                                                                       */
-  /*    desc   :: A pointer to a glyph image descriptor.                   */
-  /*                                                                       */
-  /*    gindex :: The glyph index to retrieve.                             */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    aglyph :: The corresponding @FT_Glyph object.  0 in case of        */
-  /*              failure.                                                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The returned glyph is owned and managed by the glyph image cache.  */
-  /*    Never try to transform or discard it manually!  You can however    */
-  /*    create a copy with @FT_Glyph_Copy and modify the new one.          */
-  /*                                                                       */
-  /*    Because the glyph image cache limits the total amount of memory    */
-  /*    taken by the glyphs it holds, the returned glyph might disappear   */
-  /*    on a later invocation of this function!  It is a cache after       */
-  /*    all...                                                             */
-  /*                                                                       */
-  /*    Use this function to "lock" the glyph as long as it is needed.     */
-  /*                                                                       */
+  /* Can be used as @FTC_Node_NewFunc.  `gquery.index' and `gquery.family'
+   * must be set correctly.  This function will call the `family_load_glyph'
+   * method to load the FT_Glyph into the cache node.
+   */
   FT_EXPORT( FT_Error )
-  FTC_Image_Cache_Lookup( FTC_Image_Cache  cache,
-                          FTC_Image_Desc*  desc,
-                          FT_UInt          gindex,
-                          FT_Glyph        *aglyph );
+  FTC_INode_New( FTC_INode   *pinode,
+                 FTC_GQuery   gquery,
+                 FTC_Cache    cache );
+
+  /* can be used as @FTC_Node_WeightFunc */
+  FT_EXPORT( FT_ULong )
+  FTC_INode_Weight( FTC_INode  inode );
 
  /* */
 
 FT_END_HEADER
 
-
 #endif /* __FTCIMAGE_H__ */
 
 

reactos/lib/freetype/include/freetype/cache
ftcmanag.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcmanag.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftcmanag.h	10 May 2004 17:48:27 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache Manager (specification).                              */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2003, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -65,7 +65,7 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-#include FT_CACHE_INTERNAL_LRU_H
+#include FT_CACHE_INTERNAL_MRU_H
 #include FT_CACHE_INTERNAL_CACHE_H
 
 
@@ -88,91 +88,25 @@
 #define FTC_MAX_CACHES         16
 
 
-  typedef struct  FTC_FamilyEntryRec_
-  {
-    FTC_Family  family;
-    FTC_Cache   cache;
-    FT_UInt     index;
-    FT_UInt     link;
-
-  } FTC_FamilyEntryRec, *FTC_FamilyEntry;
-
-
-#define FTC_FAMILY_ENTRY_NONE  ( (FT_UInt)-1 )
-
-
-  typedef struct  FTC_FamilyTableRec_
-  {
-    FT_UInt          count;
-    FT_UInt          size;
-    FTC_FamilyEntry  entries;
-    FT_UInt          free;
-  
-  } FTC_FamilyTableRec, *FTC_FamilyTable;
-
-
-  FT_EXPORT( FT_Error )
-  ftc_family_table_alloc( FTC_FamilyTable   table,
-                          FT_Memory         memory,
-                          FTC_FamilyEntry  *aentry );
-
-  FT_EXPORT( void )
-  ftc_family_table_free( FTC_FamilyTable  table,
-                         FT_UInt          idx );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FTC_ManagerRec                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The cache manager structure.                                       */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    library      :: A handle to a FreeType library instance.           */
-  /*                                                                       */
-  /*    faces_list   :: The lru list of @FT_Face objects in the cache.     */
-  /*                                                                       */
-  /*    sizes_list   :: The lru list of @FT_Size objects in the cache.     */
-  /*                                                                       */
-  /*    max_weight   :: The maximum cache pool weight.                     */
-  /*                                                                       */
-  /*    cur_weight   :: The current cache pool weight.                     */
-  /*                                                                       */
-  /*    num_nodes    :: The current number of nodes in the manager.        */
-  /*                                                                       */
-  /*    nodes_list   :: The global lru list of all cache nodes.            */
-  /*                                                                       */
-  /*    caches       :: A table of installed/registered cache objects.     */
-  /*                                                                       */
-  /*    request_data :: User-provided data passed to the requester.        */
-  /*                                                                       */
-  /*    request_face :: User-provided function used to implement a mapping */
-  /*                    between abstract @FTC_FaceID values and real       */
-  /*                    @FT_Face objects.                                  */
-  /*                                                                       */
-  /*    families     :: Global table of families.                          */
-  /*                                                                       */
   typedef struct  FTC_ManagerRec_
   {
     FT_Library          library;
-    FT_LruList          faces_list;
-    FT_LruList          sizes_list;
+    FT_Memory           memory;
 
+    FTC_Node            nodes_list;
     FT_ULong            max_weight;
     FT_ULong            cur_weight;
-    
     FT_UInt             num_nodes;
-    FTC_Node            nodes_list;
-    
+
     FTC_Cache           caches[FTC_MAX_CACHES];
+    FT_UInt             num_caches;
+
+    FTC_MruListRec      faces;
+    FTC_MruListRec      sizes;
 
     FT_Pointer          request_data;
     FTC_Face_Requester  request_face;
 
-    FTC_FamilyTableRec  families;
-
   } FTC_ManagerRec;
 
 
@@ -201,43 +135,40 @@
   FTC_Manager_Compress( FTC_Manager  manager );
 
 
-  /* this must be used internally for the moment */
-  FT_EXPORT( FT_Error )
-  FTC_Manager_Register_Cache( FTC_Manager      manager,
-                              FTC_Cache_Class  clazz,
-                              FTC_Cache       *acache );
+  /* try to flush `count' old nodes from the cache; return the number
+   * of really flushed nodes
+   */
+  FT_EXPORT( FT_UInt )
+  FTC_Manager_FlushN( FTC_Manager  manager,
+                      FT_UInt      count );
 
 
-  /* can be called to increment a node's reference count */
-  FT_EXPORT( void )
-  FTC_Node_Ref( FTC_Node     node,
-                FTC_Manager  manager );
+  /* this must be used internally for the moment */
+  FT_EXPORT( FT_Error )
+  FTC_Manager_RegisterCache( FTC_Manager      manager,
+                             FTC_CacheClass   clazz,
+                             FTC_Cache       *acache );
 
+ /* */
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_Node_Unref                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Decrement a cache node's internal reference count.  When the count */
-  /*    reaches 0, it is not destroyed but becomes eligible for subsequent */
-  /*    cache flushes.                                                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    node    :: The cache node handle.                                  */
-  /*                                                                       */
-  /*    manager :: The cache manager handle.                               */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FTC_Node_Unref( FTC_Node     node,
-                  FTC_Manager  manager );
+#define FTC_SCALER_COMPARE( a, b )                \
+    ( (a)->face_id      == (b)->face_id      &&   \
+      (a)->width        == (b)->width        &&   \
+      (a)->height       == (b)->height       &&   \
+      ((a)->pixel != 0) == ((b)->pixel != 0) &&   \
+      ( (a)->pixel ||                             \
+        ( (a)->x_res == (b)->x_res &&             \
+          (a)->y_res == (b)->y_res ) ) )
+
+#define FTC_SCALER_HASH( q )                                 \
+    ( FTC_FACE_ID_HASH( (q)->face_id ) +                     \
+      (q)->width + (q)->height*7 +                           \
+      ( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
 
  /* */
 
 FT_END_HEADER
 
-
 #endif /* __FTCMANAG_H__ */
 
 

reactos/lib/freetype/include/freetype/cache
ftcsbits.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcsbits.h	15 Feb 2004 21:45:31 -0000	1.3
+++ ftcsbits.h	10 May 2004 17:48:27 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    A small-bitmap cache (specification).                                */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,251 +22,72 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-#include FT_CACHE_IMAGE_H
+#include FT_CACHE_INTERNAL_GLYPH_H
 
 
 FT_BEGIN_HEADER
 
+#define FTC_SBIT_ITEMS_PER_NODE  16
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Section>                                                             */
-  /*    cache_subsystem                                                    */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    FTC_SBit                                                           */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A handle to a small bitmap descriptor.  See the @FTC_SBitRec       */
-  /*    structure for details.                                             */
-  /*                                                                       */
-  typedef struct FTC_SBitRec_*  FTC_SBit;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FTC_SBitRec                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A very compact structure used to describe a small glyph bitmap.    */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    width     :: The bitmap width in pixels.                           */
-  /*                                                                       */
-  /*    height    :: The bitmap height in pixels.                          */
-  /*                                                                       */
-  /*    left      :: The horizontal distance from the pen position to the  */
-  /*                 left bitmap border (a.k.a. `left side bearing', or    */
-  /*                 `lsb').                                               */
-  /*                                                                       */
-  /*    top       :: The vertical distance from the pen position (on the   */
-  /*                 baseline) to the upper bitmap border (a.k.a. `top     */
-  /*                 side bearing').  The distance is positive for upwards */
-  /*                 Y coordinates.                                        */
-  /*                                                                       */
-  /*    format    :: The format of the glyph bitmap (monochrome or gray).  */
-  /*                                                                       */
-  /*    max_grays :: Maximum gray level value (in the range 1 to 255).     */
-  /*                                                                       */
-  /*    pitch     :: The number of bytes per bitmap line.  May be positive */
-  /*                 or negative.                                          */
-  /*                                                                       */
-  /*    xadvance  :: The horizontal advance width in pixels.               */
-  /*                                                                       */
-  /*    yadvance  :: The vertical advance height in pixels.                */
-  /*                                                                       */
-  /*    buffer   :: A pointer to the bitmap pixels.                        */
-  /*                                                                       */
-  typedef struct  FTC_SBitRec_
+  typedef struct  FTC_SNodeRec_
   {
-    FT_Byte   width;
-    FT_Byte   height;
-    FT_Char   left;
-    FT_Char   top;
-
-    FT_Byte   format;
-    FT_Byte   max_grays;
-    FT_Short  pitch;
-    FT_Char   xadvance;
-    FT_Char   yadvance;
-
-    FT_Byte*  buffer;
-
-  } FTC_SBitRec;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    FTC_SBitCache                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A handle to a small bitmap cache.  These are special cache objects */
-  /*    used to store small glyph bitmaps (and anti-aliased pixmaps) in a  */
-  /*    much more efficient way than the traditional glyph image cache     */
-  /*    implemented by @FTC_ImageCache.                                    */
-  /*                                                                       */
-  typedef struct FTC_SBitCacheRec_*  FTC_SBitCache;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    FTC_SBit_Cache                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    DEPRECATED.  Use @FTC_SBitCache instead.                           */
-  /*                                                                       */
-  typedef FTC_SBitCache  FTC_SBit_Cache;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_SBitCache_New                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new cache to store small glyph bitmaps.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    manager :: A handle to the source cache manager.                   */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_SBitCache_New( FTC_Manager     manager,
-                     FTC_SBitCache  *acache );
+    FTC_GNodeRec  gnode;
+    FT_UInt       count;
+    FTC_SBitRec   sbits[FTC_SBIT_ITEMS_PER_NODE];
 
+  } FTC_SNodeRec, *FTC_SNode;
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_SBitCache_Lookup                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Looks up a given small glyph bitmap in a given sbit cache and      */
-  /*    "lock" it to prevent its flushing from the cache until needed      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    cache  :: A handle to the source sbit cache.                       */
-  /*                                                                       */
-  /*    type   :: A pointer to the glyph image type descriptor.            */
-  /*                                                                       */
-  /*    gindex :: The glyph index.                                         */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    sbit   :: A handle to a small bitmap descriptor.                   */
-  /*                                                                       */
-  /*    anode  :: Used to return the address of of the corresponding cache */
-  /*              node after incrementing its reference count (see note    */
-  /*              below).                                                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The small bitmap descriptor and its bit buffer are owned by the    */
-  /*    cache and should never be freed by the application.  They might    */
-  /*    as well disappear from memory on the next cache lookup, so don't   */
-  /*    treat them as persistent data.                                     */
-  /*                                                                       */
-  /*    The descriptor's `buffer' field is set to 0 to indicate a missing  */
-  /*    glyph bitmap.                                                      */
-  /*                                                                       */
-  /*    If "anode" is _not_ NULL, it receives the address of the cache     */
-  /*    node containing the bitmap, after increasing its reference count.  */
-  /*    This ensures that the node (as well as the image) will always be   */
-  /*    kept in the cache until you call @FTC_Node_Unref to "release" it.  */
-  /*                                                                       */
-  /*    If "anode" is NULL, the cache node is left unchanged, which means  */
-  /*    that the bitmap could be flushed out of the cache on the next      */
-  /*    call to one of the caching sub-system APIs.  Don't assume that it  */
-  /*    is persistent!                                                     */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_SBitCache_Lookup( FTC_SBitCache    cache,
-                        FTC_ImageType    type,
-                        FT_UInt          gindex,
-                        FTC_SBit        *sbit,
-                        FTC_Node        *anode );
 
+#define FTC_SNODE( x )         ( (FTC_SNode)( x ) )
+#define FTC_SNODE_GINDEX( x )  FTC_GNODE( x )->gindex
+#define FTC_SNODE_FAMILY( x )  FTC_GNODE( x )->family
 
-  /* */
+  typedef FT_UInt
+  (*FTC_SFamily_GetCountFunc)( FTC_Family   family,
+                               FTC_Manager  manager );
 
+  typedef FT_Error
+  (*FTC_SFamily_LoadGlyphFunc)( FTC_Family   family,
+                                FT_UInt      gindex,
+                                FTC_Manager  manager,
+                                FT_Face     *aface );
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_SBit_Cache_New                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    DEPRECATED.  Use @FTC_SBitCache_New instead.                       */
-  /*                                                                       */
-  /*    Creates a new cache to store small glyph bitmaps.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    manager :: A handle to the source cache manager.                   */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    acache  :: A handle to the new sbit cache.  NULL in case of error. */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FTC_SBit_Cache_New( FTC_Manager      manager,
-                      FTC_SBit_Cache  *acache );
+  typedef struct  FTC_SFamilyClassRec_
+  {
+    FTC_MruListClassRec        clazz;
+    FTC_SFamily_GetCountFunc   family_get_count;
+    FTC_SFamily_LoadGlyphFunc  family_load_glyph;
+
+  } FTC_SFamilyClassRec;
+
+  typedef const FTC_SFamilyClassRec*  FTC_SFamilyClass;
 
+#define FTC_SFAMILY_CLASS( x )  ((FTC_SFamilyClass)(x))
+
+#define FTC_CACHE__SFAMILY_CLASS( x )  \
+          FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class )
+
+
+  FT_EXPORT( void )
+  FTC_SNode_Free( FTC_SNode  snode,
+                  FTC_Cache  cache );
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FTC_SBit_Cache_Lookup                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    DEPRECATED.  Use @FTC_SBitCache_Lookup instead.                    */
-  /*                                                                       */
-  /*    Looks up a given small glyph bitmap in a given sbit cache.         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    cache  :: A handle to the source sbit cache.                       */
-  /*                                                                       */
-  /*    desc   :: A pointer to the glyph image descriptor.                 */
-  /*                                                                       */
-  /*    gindex :: The glyph index.                                         */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    sbit   :: A handle to a small bitmap descriptor.                   */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The small bitmap descriptor and its bit buffer are owned by the    */
-  /*    cache and should never be freed by the application.  They might    */
-  /*    as well disappear from memory on the next cache lookup, so don't   */
-  /*    treat them as persistent data.                                     */
-  /*                                                                       */
-  /*    The descriptor's `buffer' field is set to 0 to indicate a missing  */
-  /*    glyph bitmap.                                                      */
-  /*                                                                       */
   FT_EXPORT( FT_Error )
-  FTC_SBit_Cache_Lookup( FTC_SBit_Cache   cache,
-                         FTC_Image_Desc*  desc,
-                         FT_UInt          gindex,
-                         FTC_SBit        *sbit );
+  FTC_SNode_New( FTC_SNode   *psnode,
+                 FTC_GQuery   gquery,
+                 FTC_Cache    cache );
+
+  FT_EXPORT( FT_ULong )
+  FTC_SNode_Weight( FTC_SNode  inode );
 
 
+  FT_EXPORT( FT_Bool )
+  FTC_SNode_Compare( FTC_SNode   snode,
+                     FTC_GQuery  gquery,
+                     FTC_Cache   cache );
+
+  /* */
+
 FT_END_HEADER
 
 #endif /* __FTCSBITS_H__ */

reactos/lib/freetype/include/freetype/cache
ftlru.h removed after 1.1
diff -N ftlru.h
--- ftlru.h	1 Apr 2003 08:38:32 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,202 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftlru.h                                                                */
-/*                                                                         */
-/*    Simple LRU list-cache (specification).                               */
-/*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* An LRU is a list that cannot hold more than a certain number of       */
-  /* elements (`max_elements').  All elements in the list are sorted in    */
-  /* least-recently-used order, i.e., the `oldest' element is at the tail  */
-  /* of the list.                                                          */
-  /*                                                                       */
-  /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'),   */
-  /* the list is searched for an element with the corresponding key.  If   */
-  /* it is found, the element is moved to the head of the list and is      */
-  /* returned.                                                             */
-  /*                                                                       */
-  /* If no corresponding element is found, the lookup routine will try to  */
-  /* obtain a new element with the relevant key.  If the list is already   */
-  /* full, the oldest element from the list is discarded and replaced by a */
-  /* new one; a new element is added to the list otherwise.                */
-  /*                                                                       */
-  /* Note that it is possible to pre-allocate the element list nodes.      */
-  /* This is handy if `max_elements' is sufficiently small, as it saves    */
-  /* allocations/releases during the lookup process.                       */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*********                                                       *********/
-  /*********             WARNING, THIS IS BETA CODE.               *********/
-  /*********                                                       *********/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-#ifndef __FTLRU_H__
-#define __FTLRU_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
-  /* generic list key type */
-  typedef FT_Pointer  FT_LruKey;
-
-  /* a list list handle */
-  typedef struct FT_LruListRec_*  FT_LruList;
-
-  /* a list class handle */
-  typedef const struct FT_LruList_ClassRec_*  FT_LruList_Class;
-
-  /* a list node handle */
-  typedef struct FT_LruNodeRec_*  FT_LruNode;
-
-  /* the list node structure */
-  typedef struct  FT_LruNodeRec_
-  {
-    FT_LruNode  next;
-    FT_LruKey   key;
-
-  } FT_LruNodeRec;
-
-
-  /* the list structure */
-  typedef struct  FT_LruListRec_
-  {
-    FT_Memory         memory;
-    FT_LruList_Class  clazz;
-    FT_LruNode        nodes;
-    FT_UInt           max_nodes;
-    FT_UInt           num_nodes;
-    FT_Pointer        data;
-
-  } FT_LruListRec;
-
-
-  /* initialize a list list */
-  typedef FT_Error
-  (*FT_LruList_InitFunc)( FT_LruList  list );
-
-  /* finalize a list list */
-  typedef void
-  (*FT_LruList_DoneFunc)( FT_LruList  list );
-
-  /* this method is used to initialize a new list element node */
-  typedef FT_Error
-  (*FT_LruNode_InitFunc)( FT_LruNode  node,
-                          FT_LruKey   key,
-                          FT_Pointer  data );
-
-  /* this method is used to finalize a given list element node */
-  typedef void
-  (*FT_LruNode_DoneFunc)( FT_LruNode  node,
-                          FT_Pointer  data );
-
-  /* If defined, this method is called when the list if full        */
-  /* during the lookup process -- it is used to change the contents */
-  /* of a list element node instead of calling `done_element()',    */
-  /* then `init_element()'.  Set it to 0 for default behaviour.     */
-  typedef FT_Error
-  (*FT_LruNode_FlushFunc)( FT_LruNode  node,
-                           FT_LruKey   new_key,
-                           FT_Pointer  data );
-
-  /* If defined, this method is used to compare a list element node */
-  /* with a given key during a lookup.  If set to 0, the `key'      */
-  /* fields will be directly compared instead.                      */
-  typedef FT_Bool
-  (*FT_LruNode_CompareFunc)( FT_LruNode  node,
-                             FT_LruKey   key,
-                             FT_Pointer  data );
-
-  /* A selector is used to indicate whether a given list element node */
-  /* is part of a selection for FT_LruList_Remove_Selection().  The   */
-  /* functrion must return true (i.e., non-null) to indicate that the */
-  /* node is part of it.                                              */
-  typedef FT_Bool
-  (*FT_LruNode_SelectFunc)( FT_LruNode  node,
-                            FT_Pointer  data,
-                            FT_Pointer  list_data );
-
-  /* LRU class */
-  typedef struct  FT_LruList_ClassRec_
-  {
-    FT_UInt                 list_size;
-    FT_LruList_InitFunc     list_init;      /* optional */
-    FT_LruList_DoneFunc     list_done;      /* optional */
-
-    FT_UInt                 node_size;
-    FT_LruNode_InitFunc     node_init;     /* MANDATORY */
-    FT_LruNode_DoneFunc     node_done;     /* optional  */
-    FT_LruNode_FlushFunc    node_flush;    /* optional  */
-    FT_LruNode_CompareFunc  node_compare;  /* optional  */
-
-  } FT_LruList_ClassRec;
-
-
-  /* The following functions must be exported in the case where */
-  /* applications would want to write their own cache classes.  */
-
-  FT_EXPORT( FT_Error )
-  FT_LruList_New( FT_LruList_Class  clazz,
-                  FT_UInt           max_elements,
-                  FT_Pointer        user_data,
-                  FT_Memory         memory,
-                  FT_LruList       *alist );
-
-  FT_EXPORT( void )
-  FT_LruList_Reset( FT_LruList  list );
-
-  FT_EXPORT( void )
-  FT_LruList_Destroy ( FT_LruList  list );
-
-  FT_EXPORT( FT_Error )
-  FT_LruList_Lookup( FT_LruList  list,
-                     FT_LruKey   key,
-                     FT_LruNode *anode );
-
-  FT_EXPORT( void )
-  FT_LruList_Remove( FT_LruList  list,
-                     FT_LruNode  node );
-
-  FT_EXPORT( void )
-  FT_LruList_Remove_Selection( FT_LruList             list,
-                               FT_LruNode_SelectFunc  select_func,
-                               FT_Pointer             select_data );
-
- /* */
-
-FT_END_HEADER
-
-
-#endif /* __FTLRU_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/config
ftconfig.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftconfig.h	15 Feb 2004 21:45:32 -0000	1.4
+++ ftconfig.h	10 May 2004 17:48:27 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    ANSI-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,24 +58,37 @@
   /*************************************************************************/
 
 
-  /* The number of bytes in an `int' type.  */
+  /* There are systems (like the Texas Instruments 'C54x) where a `char' */
+  /* has 16 bits.  ANSI C says that sizeof(char) is always 1.  Since an  */
+  /* `int' has 16 bits also for this system, sizeof(int) gives 1 which   */
+  /* is probably unexpected.                                             */
+  /*                                                                     */
+  /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a      */
+  /* `char' type.                                                        */
+
+#ifndef FT_CHAR_BIT
+#define FT_CHAR_BIT  CHAR_BIT
+#endif
+
+
+  /* The size of an `int' type.  */
 #if   FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT  4
+#define FT_SIZEOF_INT  (32 / FT_CHAR_BIT)
 #elif FT_UINT_MAX == 0xFFFFU
-#define FT_SIZEOF_INT  2
+#define FT_SIZEOF_INT  (16 / FT_CHAR_BIT)
 #elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
-#define FT_SIZEOF_INT  8
+#define FT_SIZEOF_INT  (64 / FT_CHAR_BIT)
 #else
-#error "Unsupported number of bytes in `int' type!"
+#error "Unsupported size of `int' type!"
 #endif
 
-  /* The number of bytes in a `long' type.  */
+  /* The size of a `long' type.  */
 #if   FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG  4
+#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)
 #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
-#define FT_SIZEOF_LONG  8
+#define FT_SIZEOF_LONG  (64 / FT_CHAR_BIT)
 #else
-#error "Unsupported number of bytes in `long' type!"
+#error "Unsupported size of `long' type!"
 #endif
 
 
@@ -123,12 +136,12 @@
   typedef signed short    FT_Int16;
   typedef unsigned short  FT_UInt16;
 
-#if FT_SIZEOF_INT == 4
+#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
 
   typedef signed int      FT_Int32;
   typedef unsigned int    FT_UInt32;
 
-#elif FT_SIZEOF_LONG == 4
+#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
 
   typedef signed long     FT_Int32;
   typedef unsigned long   FT_UInt32;
@@ -137,13 +150,13 @@
 #error "no 32bit type found -- please check your configuration files"
 #endif
 
-  /* now, lookup for an integer type that is at least 32 bits */
-#if FT_SIZEOF_INT >= 4
+  /* look up an integer type that is at least 32 bits */
+#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
 
   typedef int            FT_Fast;
   typedef unsigned int   FT_UFast;
 
-#elif FT_SIZEOF_LONG >= 4
+#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
 
   typedef long           FT_Fast;
   typedef unsigned long  FT_UFast;
@@ -153,7 +166,7 @@
 
   /* determine whether we have a 64-bit int type for platforms without */
   /* Autoconf                                                          */
-#if FT_SIZEOF_LONG == 8
+#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
 
   /* FT_LONG64 must be defined if a 64-bit type is available */
 #define FT_LONG64
@@ -189,7 +202,12 @@
 #define FT_LONG64
 #define FT_INT64  long long int
 
-#endif /* FT_SIZEOF_LONG == 8 */
+#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
+
+
+#define FT_BEGIN_STMNT  do {
+#define FT_END_STMNT    } while ( 0 )
+#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
 
 
   /*************************************************************************/

reactos/lib/freetype/include/freetype/config
ftheader.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftheader.h	15 Feb 2004 21:45:32 -0000	1.5
+++ ftheader.h	10 May 2004 17:48:27 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Build macros of the FreeType 2 library.                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -150,6 +150,7 @@
 #define FT_CONFIG_MODULES_H  <freetype/config/ftmodule.h>
 #endif
 
+
   /* public headers */
 
   /*************************************************************************/
@@ -281,7 +282,7 @@
   /*    A macro used in #include statements to name the file containing    */
   /*    the module management API of FreeType 2.                           */
   /*                                                                       */
-#define FT_MODULE_H  <freetype/ftmodule.h>
+#define FT_MODULE_H  <freetype/ftmodapi.h>
 
 
   /*************************************************************************/
@@ -376,6 +377,18 @@
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
+  /*    FT_LZW_H                                                           */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    A macro used in #include statements to name the file containing    */
+  /*    the definitions of an API to support for LZW-compressed files.     */
+  /*                                                                       */
+#define FT_LZW_H  <freetype/ftlzw.h>
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @macro:                                                               */
   /*    FT_WINFONTS_H                                                      */
   /*                                                                       */
   /* @description:                                                         */
@@ -384,6 +397,7 @@
   /*                                                                       */
 #define FT_WINFONTS_H   <freetype/ftwinfnt.h>
 
+
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
@@ -433,7 +447,10 @@
   /*    see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need  */
   /*    to store small glyph bitmaps, as it will use less memory.          */
   /*                                                                       */
-#define FT_CACHE_IMAGE_H  <freetype/cache/ftcimage.h>
+  /*    This macro is deprecated.  Simply include @FT_CACHE_H to have all  */
+  /*    glyph image-related cache declarations.                            */
+  /*                                                                       */
+#define FT_CACHE_IMAGE_H  FT_CACHE_H
 
 
   /*************************************************************************/
@@ -450,7 +467,10 @@
   /*    in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,  */
   /*    including scalable outlines.                                       */
   /*                                                                       */
-#define FT_CACHE_SMALL_BITMAPS_H  <freetype/cache/ftcsbits.h>
+  /*    This macro is deprecated.  Simply include @FT_CACHE_H to have all  */
+  /*    small bitmaps-related cache declarations.                          */
+  /*                                                                       */
+#define FT_CACHE_SMALL_BITMAPS_H  FT_CACHE_H
 
 
   /*************************************************************************/
@@ -462,7 +482,10 @@
   /*    A macro used in #include statements to name the file containing    */
   /*    the `charmap' API of the FreeType 2 cache sub-system.              */
   /*                                                                       */
-#define FT_CACHE_CHARMAP_H  <freetype/cache/ftccmap.h>
+  /*    This macro is deprecated.  Simply include @FT_CACHE_H to have all  */
+  /*    charmap-based cache declarations.                                  */
+  /*                                                                       */
+#define FT_CACHE_CHARMAP_H     FT_CACHE_H
 
 
   /*************************************************************************/
@@ -508,26 +531,30 @@
 
   /* */
 
-#define FT_TRIGONOMETRY_H          <freetype/fttrigon.h>
-#define FT_STROKER_H               <freetype/ftstroke.h>
-#define FT_SYNTHESIS_H             <freetype/ftsynth.h>
-#define FT_ERROR_DEFINITIONS_H     <freetype/fterrdef.h>
+#define FT_TRIGONOMETRY_H       <freetype/fttrigon.h>
+#define FT_STROKER_H            <freetype/ftstroke.h>
+#define FT_SYNTHESIS_H          <freetype/ftsynth.h>
+#define FT_ERROR_DEFINITIONS_H  <freetype/fterrdef.h>
+
+#define FT_CACHE_MANAGER_H  <freetype/cache/ftcmanag.h>
 
-#define FT_CACHE_MANAGER_H         <freetype/cache/ftcmanag.h>
+#define FT_CACHE_INTERNAL_MRU_H      <freetype/cache/ftcmru.h>
+#define FT_CACHE_INTERNAL_MANAGER_H  <freetype/cache/ftcmanag.h>
+#define FT_CACHE_INTERNAL_CACHE_H    <freetype/cache/ftccache.h>
+#define FT_CACHE_INTERNAL_GLYPH_H    <freetype/cache/ftcglyph.h>
+#define FT_CACHE_INTERNAL_IMAGE_H    <freetype/cache/ftcimage.h>
+#define FT_CACHE_INTERNAL_SBITS_H    <freetype/cache/ftcsbits.h>
 
-#define FT_CACHE_INTERNAL_LRU_H    <freetype/cache/ftlru.h>
-#define FT_CACHE_INTERNAL_GLYPH_H  <freetype/cache/ftcglyph.h>
-#define FT_CACHE_INTERNAL_CACHE_H  <freetype/cache/ftccache.h>
 
-#define FT_XFREE86_H               <freetype/ftxf86.h>
+#define FT_XFREE86_H              <freetype/ftxf86.h>
 
-#define FT_INCREMENTAL_H           <freetype/ftincrem.h>
+#define FT_INCREMENTAL_H          <freetype/ftincrem.h>
 
-#define FT_TRUETYPE_UNPATENTED_H   <freetype/ttunpat.h>
+#define FT_TRUETYPE_UNPATENTED_H  <freetype/ttunpat.h>
 
   /* now include internal headers definitions from <freetype/internal/...> */
 
-#define  FT_INTERNAL_INTERNAL_H    <freetype/internal/internal.h>
+#define  FT_INTERNAL_INTERNAL_H  <freetype/internal/internal.h>
 #include FT_INTERNAL_INTERNAL_H
 
 

reactos/lib/freetype/include/freetype/config
ftoption.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- ftoption.h	15 Feb 2004 21:45:32 -0000	1.7
+++ ftoption.h	10 May 2004 17:48:27 -0000	1.8
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -97,16 +97,30 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* LZW-compressed file support.                                          */
+  /*                                                                       */
+  /*   FreeType now handles font files that have been compressed with the  */
+  /*   'compress' program.  This is mostly used to parse many of the PCF   */
+  /*   files that come with various X11 distributions.  The implementation */
+  /*   uses NetBSD's `zopen' to partially uncompress the file on the fly   */
+  /*   (see src/lzw/ftgzip.c).                                             */
+  /*                                                                       */
+  /*   Define this macro if you want to enable this `feature'.             */
+  /*                                                                       */
+#define FT_CONFIG_OPTION_USE_LZW
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Gzip-compressed file support.                                         */
   /*                                                                       */
   /*   FreeType now handles font files that have been compressed with the  */
   /*   'gzip' program.  This is mostly used to parse many of the PCF files */
   /*   that come with XFree86.  The implementation uses `zlib' to          */
-  /*   partially uncompress the file on the fly (see src/base/ftgzip.c).   */
+  /*   partially uncompress the file on the fly (see src/gzip/ftgzip.c).   */
   /*                                                                       */
-  /*   Define this macro if you want to enable this "feature".  Note that  */
-  /*   this will however force you to link the zlib to any program that    */
-  /*   also uses FreeType.                                                 */
+  /*   Define this macro if you want to enable this `feature'.  See also   */
+  /*   the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below.                       */
   /*                                                                       */
 #define FT_CONFIG_OPTION_USE_ZLIB
 
@@ -116,7 +130,7 @@
   /* ZLib library selection                                                */
   /*                                                                       */
   /*   This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined.  */
-  /*   It allows FreeType's "ftgzip" component to link to the system's     */
+  /*   It allows FreeType's `ftgzip' component to link to the system's     */
   /*   installation of the ZLib library.  This is useful on systems like   */
   /*   Unix or VMS where it generally is already available.                */
   /*                                                                       */
@@ -232,6 +246,29 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* Guessing methods to access embedded resource forks                    */
+  /*                                                                       */
+  /*   Enable extra Mac fonts support on non-Mac platforms (e.g.           */
+  /*   GNU/Linux).                                                         */
+  /*                                                                       */
+  /*   Resource forks which include fonts data are stored sometimes in     */
+  /*   locations which users or developers don't expected.  In some cases, */
+  /*   resource forks start with some offset from the head of a file.  In  */
+  /*   other cases, the actual resource fork is stored in file different   */
+  /*   from what the user specifies.  If this option is activated,         */
+  /*   FreeType tries to guess whether such offsets or different file      */
+  /*   names must be used.                                                 */
+  /*                                                                       */
+  /*   Note that normal, direct access of resource forks is controlled via */
+  /*   the FT_CONFIG_OPTION_MAC_FONTS option.                              */
+  /*                                                                       */
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
+#endif
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Allow the use of FT_Incremental_Interface to load typefaces that      */
   /* contain no glyph data, but supply it via a callback function.         */
   /* This allows FreeType to be used with the PostScript language, using   */
@@ -411,10 +448,7 @@
   /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook               */
   /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived                  */
   /*                                                                       */
-  /* XXX: WARNING: THIS DOESN'T WORK AS ADVERTISED YET. PLEASE DO NOT      */
-  /*      DEFINE FOR THE MOMENT..                                          */
-  /*                                                                       */
-/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
+#define TT_CONFIG_OPTION_UNPATENTED_HINTING
 
 
   /*************************************************************************/

reactos/lib/freetype/include/freetype/config
ftstdlib.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftstdlib.h	15 Feb 2004 21:45:32 -0000	1.4
+++ ftstdlib.h	10 May 2004 17:48:27 -0000	1.5
@@ -5,7 +5,7 @@
 /*    ANSI-specific library and header configuration file (specification   */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -73,24 +73,27 @@
 
 #include <ctype.h>
 
-#define ft_isalnum  isalnum
-#define ft_isupper  isupper
-#define ft_islower  islower
-#define ft_xdigit   isxdigit
+#define ft_isalnum   isalnum
+#define ft_isupper   isupper
+#define ft_islower   islower
+#define ft_isdigit   isdigit
+#define ft_isxdigit  isxdigit
 
 
 #include <string.h>
 
-#define ft_strlen   strlen
+#define ft_memcmp   memcmp
+#define ft_memcpy   memcpy
+#define ft_memmove  memmove
+#define ft_memset   memset
 #define ft_strcat   strcat
 #define ft_strcmp   strcmp
-#define ft_strncmp  strncmp
-#define ft_memcpy   memcpy
 #define ft_strcpy   strcpy
+#define ft_strlen   strlen
+#define ft_strncmp  strncmp
 #define ft_strncpy  strncpy
-#define ft_memset   memset
-#define ft_memmove  memmove
-#define ft_memcmp   memcmp
+#define ft_strrchr  strrchr
+
 
 #include <stdio.h>
 
@@ -109,7 +112,7 @@
 #define ft_qsort  qsort
 #define ft_exit   exit    /* only used to exit from unhandled exceptions */
 
-#define ft_atoi   atoi
+#define ft_atol   atol
 
 
   /**********************************************************************/

reactos/lib/freetype/include/freetype/internal
ftrfork.h added at 1.1
diff -N ftrfork.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftrfork.h	10 May 2004 17:48:28 -0000	1.1
@@ -0,0 +1,184 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftrfork.h                                                              */
+/*                                                                         */
+/*    Embedded resource forks accessor (specification).                    */
+/*                                                                         */
+/*  Copyright 2004 by                                                      */
+/*  Masatake YAMATO and Redhat K.K.                                        */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+/***************************************************************************/
+/* Development of the code in this file is support of                      */
+/* Information-technology Promotion Agency, Japan.                         */
+/***************************************************************************/
+
+
+#ifndef __FTRFORK_H__
+#define __FTRFORK_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+  /* Number of guessing rules supported in `FT_Raccess_Guess'.            */
+  /* Don't forget to increment the number if you add a new guessing rule. */
+#define FT_RACCESS_N_RULES  8
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Raccess_Guess                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Guess a file name and offset where the actual resource fork is     */
+  /*    stored.  The macro FT_RACCESS_N_RULES holds the number of          */
+  /*    guessing rules;  the guessed result for the Nth rule is            */
+  /*    represented as a triplet: a new file name (new_names[N]), a file   */
+  /*    offset (offsets[N]), and an error code (errors[N]).                */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library ::                                                         */
+  /*      A FreeType library instance.                                     */
+  /*                                                                       */
+  /*    stream ::                                                          */
+  /*      A file stream containing the resource fork.                      */
+  /*                                                                       */
+  /*    base_name ::                                                       */
+  /*      The (base) file name of the resource fork used for some          */
+  /*      guessing rules.                                                  */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    new_names ::                                                       */
+  /*      An array of guessed file names in which the resource forks may   */
+  /*      exist.  If `new_names[N]' is NULL, the guessed file name is      */
+  /*      equal to `base_name'.                                            */
+  /*                                                                       */
+  /*    offsets ::                                                         */
+  /*      An array of guessed file offsets.  `offsets[N]' holds the file   */
+  /*      offset of the possible start of the resource fork in file        */
+  /*      `new_names[N]'.                                                  */
+  /*                                                                       */
+  /*    errors ::                                                          */
+  /*      An array of FreeType error codes.  `errors[N]' is the error      */
+  /*      code of Nth guessing rule function.  If `errors[N]' is not       */
+  /*      FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless.      */
+  /*                                                                       */
+  FT_BASE( void )
+  FT_Raccess_Guess( FT_Library  library,
+                    FT_Stream   stream,
+                    char*       base_name,
+                    char**      new_names,
+                    FT_Long*    offsets,
+                    FT_Error*   errors );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Raccess_Get_HeaderInfo                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Get the information from the header of resource fork.  The         */
+  /*    information includes the file offset where the resource map        */
+  /*    starts, and the file offset where the resource data starts.        */
+  /*    `FT_Raccess_Get_DataOffsets' requires these two data.              */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library ::                                                         */
+  /*      A FreeType library instance.                                     */
+  /*                                                                       */
+  /*    stream ::                                                          */
+  /*      A file stream containing the resource fork.                      */
+  /*                                                                       */
+  /*    rfork_offset ::                                                    */
+  /*      The file offset where the resource fork starts.                  */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    map_offset ::                                                      */
+  /*      The file offset where the resource map starts.                   */
+  /*                                                                       */
+  /*    rdata_pos ::                                                       */
+  /*      The file offset where the resource data starts.                  */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  FT_Err_Ok means success.                     */
+  /*                                                                       */
+  FT_BASE( FT_Error )
+  FT_Raccess_Get_HeaderInfo( FT_Library  library,
+                             FT_Stream   stream,
+                             FT_Long     rfork_offset,
+                             FT_Long    *map_offset,
+                             FT_Long    *rdata_pos );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Raccess_Get_DataOffsets                                         */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Get the data offsets for a tag in a resource fork.  Offsets are    */
+  /*    stored in an array because, in some cases, resources in a resource */
+  /*    fork have the same tag.                                            */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library ::                                                         */
+  /*      A FreeType library instance.                                     */
+  /*                                                                       */
+  /*    stream ::                                                          */
+  /*      A file stream containing the resource fork.                      */
+  /*                                                                       */
+  /*    map_offset ::                                                      */
+  /*      The file offset where the resource map starts.                   */
+  /*                                                                       */
+  /*    rdata_pos ::                                                       */
+  /*      The file offset where the resource data starts.                  */
+  /*                                                                       */
+  /*    tag ::                                                             */
+  /*      The resource tag.                                                */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    offsets ::                                                         */
+  /*      The stream offsets for the resource data specified by `tag'.     */
+  /*      This array is allocated by the function, so you have to call     */
+  /*      @FT_Free after use.                                              */
+  /*                                                                       */
+  /*    count ::                                                           */
+  /*      The length of offsets array.                                     */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  FT_Err_Ok means success.                     */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    Normally you should use `FT_Raccess_Get_HeaderInfo' to get the     */
+  /*    value for `map_offset' and `rdata_pos'.                            */
+  /*                                                                       */
+  FT_BASE( FT_Error )
+  FT_Raccess_Get_DataOffsets( FT_Library  library,
+                              FT_Stream   stream,
+                              FT_Long     map_offset,
+                              FT_Long     rdata_pos,
+                              FT_Long     tag,
+                              FT_Long   **offsets,
+                              FT_Long    *count );
+
+
+FT_END_HEADER
+
+#endif /* __FTRFORK_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal
ftserv.h 1.2 -> 1.3
diff -N ftserv.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftserv.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,260 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftserv.h                                                               */
+/*                                                                         */
+/*    The FreeType services (specification only).                          */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /*  Each module can export one or more `services'.  Each service is      */
+  /*  identified by a constant string and modeled by a pointer; the latter */
+  /*  generally corresponds to a structure containing function pointers.   */
+  /*                                                                       */
+  /*  Note that a service's data cannot be a mere function pointer because */
+  /*  in C it is possible that function pointers might be implemented      */
+  /*  differently than data pointers (e.g. 48 bits instead of 32).         */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#ifndef __FTSERV_H__
+#define __FTSERV_H__
+
+
+FT_BEGIN_HEADER
+
+
+  /*
+   * @macro:
+   *   FT_FACE_FIND_SERVICE
+   *
+   * @description:
+   *   This macro is used to look up a service from a face's driver module.
+   *
+   * @input:
+   *   face ::
+   *     The source face handle.
+   *
+   *   id ::
+   *     A string describing the service as defined in the service's
+   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
+   *     `multi-masters').  It is automatically prefixed with
+   *     `FT_SERVICE_ID_'.
+   *
+   * @output:
+   *   ptr ::
+   *     A variable that receives the service pointer.  Will be NULL
+   *     if not found.
+   */
+#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \
+  FT_BEGIN_STMNT                                                            \
+    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );               \
+    /* the strange cast is to allow C++ compilation */                      \
+    FT_Pointer*  Pptr   = (FT_Pointer*) &(ptr);                             \
+                                                                            \
+                                                                            \
+    *Pptr = NULL;                                                           \
+    if ( module->clazz->get_interface )                                     \
+      *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
+  FT_END_STMNT
+
+
+  /*
+   * @macro:
+   *   FT_FACE_FIND_GLOBAL_SERVICE
+   *
+   * @description:
+   *   This macro is used to look up a service from all modules.
+   *
+   * @input:
+   *   face ::
+   *     The source face handle.
+   *
+   *   id ::
+   *     A string describing the service as defined in the service's
+   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
+   *     `multi-masters').  It is automatically prefixed with
+   *     `FT_SERVICE_ID_'.
+   *
+   * @output:
+   *   ptr ::
+   *     A variable that receives the service pointer.  Will be NULL
+   *     if not found.
+   */
+#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
+  FT_BEGIN_STMNT                                                   \
+    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );      \
+    /* the strange cast is to allow C++ compilation */             \
+    FT_Pointer*  Pptr   = (FT_Pointer*) &(ptr);                    \
+                                                                   \
+                                                                   \
+    *Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
+  FT_END_STMNT
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****         S E R V I C E   D E S C R I P T O R S                 *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*
+   *  The following structure is used to _describe_ a given service
+   *  to the library.  This is useful to build simple static service lists.
+   */
+  typedef struct  FT_ServiceDescRec_
+  {
+    const char*  serv_id;     /* service name         */
+    const void*  serv_data;   /* service pointer/data */
+
+  } FT_ServiceDescRec;
+
+  typedef const FT_ServiceDescRec*  FT_ServiceDesc;
+
+
+  /*
+   *  Parse a list of FT_ServiceDescRec descriptors and look for
+   *  a specific service by ID.  Note that the last element in the
+   *  array must be { NULL, NULL }, and that the function should
+   *  return NULL if the service isn't available.
+   *
+   *  This function can be used by modules to implement their
+   *  `get_service' method.
+   */
+  FT_BASE( FT_Pointer )
+  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,
+                          const char*     service_id );
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****             S E R V I C E S   C A C H E                       *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*
+   *  This structure is used to store a cache for several frequently used
+   *  services.  It is the type of `face->internal->services'.  You
+   *  should only use FT_FACE_LOOKUP_SERVICE to access it.
+   *
+   *  All fields should have the type FT_Pointer to relax compilation
+   *  dependencies.  We assume the developer isn't completely stupid.
+   *
+   *  Each field must be named `service_XXXX' where `XXX' corresponds to
+   *  the correct FT_SERVICE_ID_XXXX macro.  See the definition of
+   *  FT_FACE_LOOKUP_SERVICE below how this is implemented.
+   *
+   */
+  typedef struct  FT_ServiceCacheRec_
+  {
+    FT_Pointer  service_POSTSCRIPT_FONT_NAME;
+    FT_Pointer  service_MULTI_MASTERS;
+    FT_Pointer  service_GLYPH_DICT;
+    FT_Pointer  service_PFR_METRICS;
+    FT_Pointer  service_WINFNT;
+
+  } FT_ServiceCacheRec, *FT_ServiceCache;
+
+
+  /*
+   *  A magic number used within the services cache.
+   */
+#define FT_SERVICE_UNAVAILABLE  ((FT_Pointer)-2)  /* magic number */
+
+
+  /*
+   * @macro:
+   *   FT_FACE_LOOKUP_SERVICE
+   *
+   * @description:
+   *   This macro is used to lookup a service from a face's driver module
+   *   using its cache.
+   *
+   * @input:
+   *   face::
+   *     The source face handle containing the cache.
+   *
+   *   field ::
+   *     The field name in the cache.
+   *
+   *   id ::
+   *     The service ID.
+   *
+   * @output:
+   *   ptr ::
+   *     A variable receiving the service data.  NULL if not available.
+   */
+#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                  \
+  FT_BEGIN_STMNT                                                 \
+    /* the strange cast is to allow C++ compilation */           \
+    FT_Pointer*  pptr = (FT_Pointer*)&(ptr);                     \
+    FT_Pointer   svc;                                            \
+                                                                 \
+                                                                 \
+    svc = FT_FACE(face)->internal->services. service_ ## id ;    \
+    if ( svc == FT_SERVICE_UNAVAILABLE )                         \
+      svc = NULL;                                                \
+    else if ( svc == NULL )                                      \
+    {                                                            \
+      FT_FACE_FIND_SERVICE( face, svc, id );                     \
+                                                                 \
+      FT_FACE(face)->internal->services. service_ ## id =        \
+        (FT_Pointer)( svc != NULL ? svc                          \
+                                  : FT_SERVICE_UNAVAILABLE );    \
+    }                                                            \
+    *pptr = svc;                                                 \
+  FT_END_STMNT
+
+
+  /*
+   *  A macro used to define new service structure types.
+   */
+
+#define FT_DEFINE_SERVICE( name )            \
+  typedef struct FT_Service_ ## name ## Rec_ \
+    FT_Service_ ## name ## Rec ;             \
+  typedef struct FT_Service_ ## name ## Rec_ \
+    const * FT_Service_ ## name ;            \
+  struct FT_Service_ ## name ## Rec_
+
+  /* */
+
+  /*
+   *  The header files containing the services.
+   */
+
+#define FT_SERVICE_MULTIPLE_MASTERS_H  <freetype/internal/services/svmm.h>
+#define FT_SERVICE_POSTSCRIPT_NAME_H   <freetype/internal/services/svpostnm.h>
+#define FT_SERVICE_POSTSCRIPT_CMAPS_H  <freetype/internal/services/svpscmap.h>
+#define FT_SERVICE_POSTSCRIPT_INFO_H   <freetype/internal/services/svpsinfo.h>
+#define FT_SERVICE_GLYPH_DICT_H        <freetype/internal/services/svgldict.h>
+#define FT_SERVICE_BDF_H               <freetype/internal/services/svbdf.h>
+#define FT_SERVICE_XFREE86_NAME_H      <freetype/internal/services/svxf86nm.h>
+#define FT_SERVICE_SFNT_H              <freetype/internal/services/svsfnt.h>
+#define FT_SERVICE_PFR_H               <freetype/internal/services/svpfr.h>
+#define FT_SERVICE_WINFNT_H            <freetype/internal/services/svwinfnt.h>
+#define FT_SERVICE_TT_CMAP_H           <freetype/internal/services/svttcmap.h>
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FTSERV_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal
ftcalc.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcalc.h	15 Feb 2004 21:45:32 -0000	1.3
+++ ftcalc.h	10 May 2004 17:48:28 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (specification).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,7 +27,8 @@
 FT_BEGIN_HEADER
 
 
-  FT_EXPORT( FT_Int32 )  FT_SqrtFixed( FT_Int32  x );
+  FT_EXPORT( FT_Int32 )
+  FT_SqrtFixed( FT_Int32  x );
 
 
 #define SQRT_32( x )  FT_Sqrt32( x )
@@ -59,6 +60,39 @@
   /*************************************************************************/
 
 
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_MulDiv_No_Round                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A very simple function used to perform the computation `(a*b)/c'   */
+  /*    (without rounding) with maximal accuracy (it uses a 64-bit         */
+  /*    intermediate integer whenever necessary).                          */
+  /*                                                                       */
+  /*    This function isn't necessarily as fast as some processor specific */
+  /*    operations, but is at least completely portable.                   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    a :: The first multiplier.                                         */
+  /*    b :: The second multiplier.                                        */
+  /*    c :: The divisor.                                                  */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The result of `(a*b)/c'.  This function never traps when trying to */
+  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */
+  /*    on the signs of `a' and `b'.                                       */
+  /*                                                                       */
+  FT_BASE( FT_Long )
+  FT_MulDiv_No_Round( FT_Long  a,
+                      FT_Long  b,
+                      FT_Long  c );
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
 #define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )
 #define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )
 #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )

reactos/lib/freetype/include/freetype/internal
ftdebug.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftdebug.h	1 Apr 2003 08:38:33 -0000	1.1
+++ ftdebug.h	10 May 2004 17:48:28 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Debugging and logging component (specification).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,6 +27,7 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
+#include FT_FREETYPE_H
 
 
 FT_BEGIN_HEADER
@@ -98,6 +99,53 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Trace_Get_Count                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return the number of available trace components.                   */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The number of trace components.  0 if FreeType 2 is not built with */
+  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function may be useful if you want to access elements of      */
+  /*    the internal `ft_trace_levels' array by an index.                  */
+  /*                                                                       */
+  FT_EXPORT( FT_Int )
+  FT_Trace_Get_Count( void );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Trace_Get_Name                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Return the name of a trace component.                              */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    The index of the trace component.                                  */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The name of the trace component.  This is a statically allocated   */
+  /*    C string, so do not free it after use.  NULL if FreeType 2 is not  */
+  /*    built with FT_DEBUG_LEVEL_TRACE definition.                        */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    Use @FT_Trace_Get_Count to get the number of available trace       */
+  /*    components.                                                        */
+  /*                                                                       */
+  /*    This function may be useful if you want to control FreeType 2's    */
+  /*    debug level in your appliaciton.                                   */
+  /*                                                                       */
+  FT_EXPORT( const char * )
+  FT_Trace_Get_Name( FT_Int  idx );
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* You need two opening resp. closing parentheses!                       */
   /*                                                                       */
   /* Example: FT_TRACE0(( "Value is %i", foo ))                            */

reactos/lib/freetype/include/freetype/internal
ftdriver.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftdriver.h	15 Feb 2004 21:45:32 -0000	1.4
+++ ftdriver.h	10 May 2004 17:48:28 -0000	1.5
@@ -155,11 +155,15 @@
   /*                        add data from AFM or PFM files on a Type 1     */
   /*                        face, or a CIDMap on a CID-keyed face.         */
   /*                                                                       */
-  /*    get_advances     :: A function handle used to return the advances  */
-  /*                        of 'count' glyphs, starting at `index'.  the   */
-  /*                        `vertical' flags must be set when vertical     */
-  /*                        advances are queried.  The advances buffer is  */
-  /*                        caller-allocated.                              */
+  /*    get_advances     :: A function handle used to return advance       */
+  /*                        widths of 'count' glyphs (in font units),      */
+  /*                        starting at `first'.  The `vertical' flag must */
+  /*                        be set to get vertical advance heights.  The   */
+  /*                        `advances' buffer is caller-allocated.         */
+  /*                        Currently not implemented.  The idea of this   */
+  /*                        function is to be able to perform              */
+  /*                        device-independent text layout without loading */
+  /*                        a single glyph image.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Most function pointers, with the exception of `load_glyph' and     */

reactos/lib/freetype/include/freetype/internal
ftgloadr.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftgloadr.h	15 Feb 2004 21:45:32 -0000	1.4
+++ ftgloadr.h	10 May 2004 17:48:28 -0000	1.5
@@ -110,15 +110,15 @@
   FT_BASE( void )
   FT_GlyphLoader_Rewind( FT_GlyphLoader  loader );
 
-  /* check that there is enough room to add 'n_points' and 'n_contours' */
-  /* to the glyph loader                                                */
+  /* check that there is enough space to add `n_points' and `n_contours' */
+  /* to the glyph loader                                                 */
   FT_BASE( FT_Error )
   FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,
                               FT_UInt         n_points,
                               FT_UInt         n_contours );
 
-  /* check that there is enough room to add 'n_subs' sub-glyphs to */
-  /* a glyph loader                                                */
+  /* check that there is enough space to add `n_subs' sub-glyphs to */
+  /* a glyph loader                                                 */
   FT_BASE( FT_Error )
   FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,
                                  FT_UInt         n_subs );

reactos/lib/freetype/include/freetype/internal
ftmemory.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftmemory.h	15 Feb 2004 21:45:32 -0000	1.4
+++ ftmemory.h	10 May 2004 17:48:28 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType memory management macros (specification).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -180,6 +180,12 @@
 
 #define FT_ZERO( p )                FT_MEM_ZERO( p, sizeof ( *(p) ) )
 
+#define FT_ARRAY_COPY( dest, source, count )                       \
+          FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) )
+
+#define FT_ARRAY_MOVE( dest, source, count )                       \
+          FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) )
+
 
   /*************************************************************************/
   /*                                                                       */

reactos/lib/freetype/include/freetype/internal
ftobjs.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftobjs.h	15 Feb 2004 21:45:32 -0000	1.5
+++ ftobjs.h	10 May 2004 17:48:28 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -34,7 +34,7 @@
 #include FT_INTERNAL_GLYPH_LOADER_H
 #include FT_INTERNAL_DRIVER_H
 #include FT_INTERNAL_AUTOHINT_H
-#include FT_INTERNAL_OBJECT_H
+#include FT_INTERNAL_SERVICE_H
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 #include FT_INCREMENTAL_H
@@ -64,19 +64,21 @@
   /*************************************************************************/
   /*                                                                       */
   /* The min and max functions missing in C.  As usual, be careful not to  */
-  /* write things like MIN( a++, b++ ) to avoid side effects.              */
+  /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */
   /*                                                                       */
-#ifndef MIN
-#define MIN( a, b )  ( (a) < (b) ? (a) : (b) )
-#endif
+#define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
+#define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
 
-#ifndef MAX
-#define MAX( a, b )  ( (a) > (b) ? (a) : (b) )
-#endif
+#define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
 
-#ifndef ABS
-#define ABS( a )     ( (a) < 0 ? -(a) : (a) )
-#endif
+
+#define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )
+#define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )
+#define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )
+
+#define FT_PIX_FLOOR( x )     ( (x) & ~63 )
+#define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )
+#define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )
 
 
   /*************************************************************************/
@@ -271,51 +273,52 @@
   /*    FreeType.                                                          */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    max_points       :: The maximal number of points used to store the */
-  /*                        vectorial outline of any glyph in this face.   */
-  /*                        If this value cannot be known in advance, or   */
-  /*                        if the face isn't scalable, this should be set */
-  /*                        to 0.  Only relevant for scalable formats.     */
-  /*                                                                       */
-  /*    max_contours     :: The maximal number of contours used to store   */
-  /*                        the vectorial outline of any glyph in this     */
-  /*                        face.  If this value cannot be known in        */
-  /*                        advance, or if the face isn't scalable, this   */
-  /*                        should be set to 0.  Only relevant for         */
-  /*                        scalable formats.                              */
-  /*                                                                       */
-  /*    transform_matrix :: A 2x2 matrix of 16.16 coefficients used to     */
-  /*                        transform glyph outlines after they are loaded */
-  /*                        from the font.  Only used by the convenience   */
-  /*                        functions.                                     */
-  /*                                                                       */
-  /*    transform_delta  :: A translation vector used to transform glyph   */
-  /*                        outlines after they are loaded from the font.  */
-  /*                        Only used by the convenience functions.        */
-  /*                                                                       */
-  /*    transform_flags  :: Some flags used to classify the transform.     */
-  /*                        Only used by the convenience functions.        */
-  /*                                                                       */
-  /*    postscript_name  :: Postscript font name for this face.            */
+  /*    max_points ::                                                      */
+  /*      The maximal number of points used to store the vectorial outline */
+  /*      of any glyph in this face.  If this value cannot be known in     */
+  /*      advance, or if the face isn't scalable, this should be set to 0. */
+  /*      Only relevant for scalable formats.                              */
+  /*                                                                       */
+  /*    max_contours ::                                                    */
+  /*      The maximal number of contours used to store the vectorial       */
+  /*      outline of any glyph in this face.  If this value cannot be      */
+  /*      known in advance, or if the face isn't scalable, this should be  */
+  /*      set to 0.  Only relevant for scalable formats.                   */
+  /*                                                                       */
+  /*    transform_matrix ::                                                */
+  /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */
+  /*      outlines after they are loaded from the font.  Only used by the  */
+  /*      convenience functions.                                           */
+  /*                                                                       */
+  /*    transform_delta ::                                                 */
+  /*      A translation vector used to transform glyph outlines after they */
+  /*      are loaded from the font.  Only used by the convenience          */
+  /*      functions.                                                       */
+  /*                                                                       */
+  /*    transform_flags ::                                                 */
+  /*      Some flags used to classify the transform.  Only used by the     */
+  /*      convenience functions.                                           */
+  /*                                                                       */
+  /*    services ::                                                        */
+  /*      A cache for frequently used services.  It should be only         */
+  /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */
   /*                                                                       */
   /*    incremental_interface ::                                           */
-  /*                        If non-null, the interface through             */
-  /*                        which glyph data and metrics are loaded        */
-  /*                        incrementally for faces that do not provide    */
-  /*                        all of this data when first opened.            */
-  /*                        This field exists only if                      */
-  /*                        @FT_CONFIG_OPTION_INCREMENTAL is defined.      */
+  /*      If non-null, the interface through which glyph data and metrics  */
+  /*      are loaded incrementally for faces that do not provide all of    */
+  /*      this data when first opened.  This field exists only if          */
+  /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   /*                                                                       */
   typedef struct  FT_Face_InternalRec_
   {
-    FT_UShort    max_points;
-    FT_Short     max_contours;
+    FT_UShort           max_points;
+    FT_Short            max_contours;
 
-    FT_Matrix    transform_matrix;
-    FT_Vector    transform_delta;
-    FT_Int       transform_flags;
+    FT_Matrix           transform_matrix;
+    FT_Vector           transform_delta;
+    FT_Int              transform_flags;
 
-    const char*  postscript_name;
+    FT_ServiceCacheRec  services;
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
     FT_Incremental_InterfaceRec*  incremental_interface;
@@ -466,6 +469,10 @@
   FT_Get_Module_Interface( FT_Library   library,
                            const char*  mod_name );
 
+  FT_BASE( FT_Pointer )
+  ft_module_get_service( FT_Module    module,
+                         const char*  service_id );
+
  /* */
 
 
@@ -704,6 +711,12 @@
   /*    generic          :: Client data variable.  Used to extend the      */
   /*                        Library class by higher levels and clients.    */
   /*                                                                       */
+  /*    version_major    :: The major version number of the library.       */
+  /*                                                                       */
+  /*    version_minor    :: The minor version number of the library.       */
+  /*                                                                       */
+  /*    version_patch    :: The current patch level of the library.        */
+  /*                                                                       */
   /*    num_modules      :: The number of modules currently registered     */
   /*                        within this library.  This is set to 0 for new */
   /*                        libraries.  New modules are added through the  */
@@ -754,8 +767,6 @@
 
     FT_DebugHook_Func  debug_hooks[4];
 
-    FT_MetaClassRec    meta_class;
-
   } FT_LibraryRec;
 
 

reactos/lib/freetype/include/freetype/internal
ftstream.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftstream.h	1 Apr 2003 08:38:33 -0000	1.1
+++ ftstream.h	10 May 2004 17:48:28 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Stream handling (specification).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -315,6 +315,17 @@
 #endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
 
 
+  /* create a new (input) stream from an FT_Open_Args structure */
+  FT_BASE( FT_Error )
+  FT_Stream_New( FT_Library           library,
+                 const FT_Open_Args*  args,
+                 FT_Stream           *astream );
+
+  /* free a stream */
+  FT_BASE( void )
+  FT_Stream_Free( FT_Stream  stream,                    
+                  FT_Int     external );
+
   /* initialize a stream for reading in-memory data */
   FT_BASE( void )
   FT_Stream_OpenMemory( FT_Stream       stream,

reactos/lib/freetype/include/freetype/internal
fttrace.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- fttrace.h	1 Apr 2003 08:38:33 -0000	1.1
+++ fttrace.h	10 May 2004 17:48:28 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2004 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -16,12 +16,12 @@
 /***************************************************************************/
 
 
-/* definitions of trace levels for FreeType 2 */
+  /* definitions of trace levels for FreeType 2 */
 
-/* the first level must always be `trace_any' */
+  /* the first level must always be `trace_any' */
 FT_TRACE_DEF( any )
 
-/* base components */
+  /* base components */
 FT_TRACE_DEF( calc )      /* calculations            (ftcalc.c)   */
 FT_TRACE_DEF( memory )    /* memory manager          (ftobjs.c)   */
 FT_TRACE_DEF( stream )    /* stream manager          (ftstream.c) */
@@ -35,14 +35,15 @@
 FT_TRACE_DEF( raster )    /* monochrome rasterizer   (ftraster.c) */
 FT_TRACE_DEF( smooth )    /* anti-aliasing raster    (ftgrays.c)  */
 FT_TRACE_DEF( mm )        /* MM interface            (ftmm.c)     */
+FT_TRACE_DEF( raccess )   /* resource fork accessor  (ftrfork.c)  */
 
 /* Cache sub-system */
-FT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc..) */
+FT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */
 
 /* SFNT driver components */
-FT_TRACE_DEF( sfobjs )    /*  SFNT object handler     (sfobjs.c)   */
-FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)    */
-FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)    */
+FT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */
+FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
+FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */
 FT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */
 FT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */
 

reactos/lib/freetype/include/freetype/internal
internal.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- internal.h	15 Feb 2004 21:45:32 -0000	1.3
+++ internal.h	10 May 2004 17:48:28 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Internal header files (specification only).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,26 +27,18 @@
 #define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>
 #define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>
 #define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>
-#define FT_INTERNAL_EXTENSION_H           <freetype/internal/ftextend.h>
 #define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
 #define FT_INTERNAL_CALC_H                <freetype/internal/ftcalc.h>
 #define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdriver.h>
-#define FT_INTERNAL_EXTEND_H              <freetype/internal/ftextend.h>
 #define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>
 #define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>
 #define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>
-#define FT_INTERNAL_HASH_H                <freetype/internal/fthash.h>
-#define FT_INTERNAL_OBJECT_H              <freetype/internal/ftobject.h>
+#define FT_INTERNAL_SERVICE_H             <freetype/internal/ftserv.h>
+#define FT_INTERNAL_RFORK_H               <freetype/internal/ftrfork.h>
 
 #define FT_INTERNAL_TRUETYPE_TYPES_H      <freetype/internal/tttypes.h>
 #define FT_INTERNAL_TYPE1_TYPES_H         <freetype/internal/t1types.h>
-#define FT_INTERNAL_TYPE42_TYPES_H        <freetype/internal/t42types.h>
-#define FT_INTERNAL_CFF_TYPES_H           <freetype/internal/cfftypes.h>
-#define FT_INTERNAL_FNT_TYPES_H           <freetype/internal/fnttypes.h>
-#define FT_INTERNAL_BDF_TYPES_H           <freetype/internal/bdftypes.h>
-#define FT_INTERNAL_PFR_H                 <freetype/internal/pfr.h>
 
-#define FT_INTERNAL_POSTSCRIPT_NAMES_H    <freetype/internal/psnames.h>
 #define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>
 #define FT_INTERNAL_POSTSCRIPT_HINTS_H    <freetype/internal/pshints.h>
 #define FT_INTERNAL_POSTSCRIPT_GLOBALS_H  <freetype/internal/psglobal.h>

reactos/lib/freetype/include/freetype/internal
psaux.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- psaux.h	15 Feb 2004 21:45:32 -0000	1.4
+++ psaux.h	10 May 2004 17:48:28 -0000	1.5
@@ -24,6 +24,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
 FT_BEGIN_HEADER
@@ -123,7 +124,7 @@
     FT_Int             max_elems;
     FT_Int             num_elems;
     FT_Byte**          elements;       /* addresses of table elements */
-    FT_Int*            lengths;        /* lengths of table elements   */
+    FT_PtrDist*        lengths;        /* lengths of table elements   */
 
     FT_Memory          memory;
     PS_Table_FuncsRec  funcs;
@@ -329,18 +330,20 @@
     void
     (*skip_spaces)( PS_Parser  parser );
     void
-    (*skip_alpha)( PS_Parser  parser );
+    (*skip_PS_token)( PS_Parser  parser );
 
     FT_Long
     (*to_int)( PS_Parser  parser );
     FT_Fixed
     (*to_fixed)( PS_Parser  parser,
                  FT_Int     power_ten );
+
     FT_Error
     (*to_bytes)( PS_Parser  parser,
                  FT_Byte*   bytes,
-                 FT_Int     max_bytes,
-                 FT_Int*    pnum_bytes );
+                 FT_Long    max_bytes,
+                 FT_Long*   pnum_bytes,
+                 FT_Bool    delimiters );
 
     FT_Int
     (*to_coord_array)( PS_Parser  parser,
@@ -648,14 +651,14 @@
     T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];
     T1_Decoder_Zone      zone;
 
-    PSNames_Service      psnames;      /* for seac */
+    FT_Service_PsCMaps   psnames;      /* for seac */
     FT_UInt              num_glyphs;
     FT_Byte**            glyph_names;
 
     FT_Int               lenIV;        /* internal for sub routine calls */
     FT_UInt              num_subrs;
     FT_Byte**            subrs;
-    FT_Int*              subrs_len;    /* array of subrs length (optional) */
+    FT_PtrDist*          subrs_len;    /* array of subrs length (optional) */
 
     FT_Matrix            font_matrix;
     FT_Vector            font_offset;

reactos/lib/freetype/include/freetype/internal
sfnt.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- sfnt.h	15 Feb 2004 21:45:32 -0000	1.5
+++ sfnt.h	10 May 2004 17:48:28 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level `sfnt' driver interface (specification).                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -125,11 +125,6 @@
   (*TT_Done_Face_Func)( TT_Face  face );
 
 
-  typedef FT_Module_Interface
-  (*SFNT_Get_Interface_Func)( FT_Module    module,
-                              const char*  func_interface );
-
-
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
@@ -248,6 +243,76 @@
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
+  /*    TT_Find_SBit_Image_Func                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Checks whether an embedded bitmap (an `sbit') exists for a given   */
+  /*    glyph, at a given strike.                                          */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face          :: The target face object.                           */
+  /*                                                                       */
+  /*    glyph_index   :: The glyph index.                                  */
+  /*                                                                       */
+  /*    strike_index  :: The current strike index.                         */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    arange        :: The SBit range containing the glyph index.        */
+  /*                                                                       */
+  /*    astrike       :: The SBit strike containing the glyph index.       */
+  /*                                                                       */
+  /*    aglyph_offset :: The offset of the glyph data in `EBDT' table.     */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.  Returns                    */
+  /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */
+  /*    glyph.                                                             */
+  /*                                                                       */
+  typedef FT_Error
+  (*TT_Find_SBit_Image_Func)( TT_Face          face,
+                              FT_UInt          glyph_index,
+                              FT_ULong         strike_index,
+                              TT_SBit_Range   *arange,
+                              TT_SBit_Strike  *astrike,
+                              FT_ULong        *aglyph_offset );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    TT_Load_SBit_Metrics_Func                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Gets the big metrics for a given embedded bitmap.                  */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    stream      :: The input stream.                                   */
+  /*                                                                       */
+  /*    range       :: The SBit range containing the glyph.                */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    big_metrics :: A big SBit metrics structure for the glyph.         */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    The stream cursor must be positioned at the glyph's offset within  */
+  /*    the `EBDT' table before the call.                                  */
+  /*                                                                       */
+  /*    If the image format uses variable metrics, the stream cursor is    */
+  /*    positioned just after the metrics header in the `EBDT' table on    */
+  /*    function exit.                                                     */
+  /*                                                                       */
+  typedef FT_Error
+  (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,
+                                TT_SBit_Range    range,
+                                TT_SBit_Metrics  metrics );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <FuncType>                                                            */
   /*    TT_Load_SBit_Image_Func                                            */
   /*                                                                       */
   /* <Description>                                                         */
@@ -255,20 +320,27 @@
   /*    returns its metrics.                                               */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    face        :: The target face object.                             */
+  /*    face ::                                                            */
+  /*      The target face object.                                          */
   /*                                                                       */
-  /*    x_ppem      :: The horizontal resolution in points per EM.         */
+  /*    strike_index ::                                                    */
+  /*      The strike index.                                                */
   /*                                                                       */
-  /*    y_ppem      :: The vertical resolution in points per EM.           */
+  /*    glyph_index ::                                                     */
+  /*      The current glyph index.                                         */
   /*                                                                       */
-  /*    glyph_index :: The current glyph index.                            */
+  /*    load_flags ::                                                      */
+  /*      The current load flags.                                          */
   /*                                                                       */
-  /*    stream      :: The input stream.                                   */
+  /*    stream ::                                                          */
+  /*      The input stream.                                                */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    amap        :: The target pixmap.                                  */
+  /*    amap ::                                                            */
+  /*      The target pixmap.                                               */
   /*                                                                       */
-  /*    ametrics    :: A big sbit metrics structure for the glyph image.   */
+  /*    ametrics ::                                                        */
+  /*      A big sbit metrics structure for the glyph image.                */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.  Returns an error if no     */
@@ -312,8 +384,8 @@
   /*                                                                       */
   typedef FT_Error
   (*TT_Set_SBit_Strike_Func)( TT_Face    face,
-                              FT_Int     x_ppem,
-                              FT_Int     y_ppem,
+                              FT_UInt    x_ppem,
+                              FT_UInt    y_ppem,
                               FT_ULong  *astrike_index );
 
 
@@ -369,57 +441,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <FuncType>                                                            */
-  /*    TT_CharMap_Load_Func                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given TrueType character map into memory.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the parent face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the current stream object.                   */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    cmap   :: A pointer to a cmap object.                              */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The function assumes that the stream is already in use (i.e.,      */
-  /*    opened).  In case of error, all partially allocated tables are     */
-  /*    released.                                                          */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_CharMap_Load_Func)( TT_Face       face,
-                           TT_CMapTable  cmap,
-                           FT_Stream     input );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    TT_CharMap_Free_Func                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Destroys a character mapping table.                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A handle to the parent face object.                        */
-  /*                                                                       */
-  /*    cmap :: A handle to a cmap object.                                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  typedef FT_Error
-  (*TT_CharMap_Free_Func)( TT_Face       face,
-                           TT_CMapTable  cmap );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
   /*    TT_Load_Table_Func                                                 */
   /*                                                                       */
   /* <Description>                                                         */
@@ -459,22 +480,6 @@
 
   /*************************************************************************/
   /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    SFNT_Load_Table_Func                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given SFNT table into memory.                              */
-  /*                                                                       */
-  typedef FT_Error
-  (*SFNT_Load_Table_Func)( FT_Face    face,
-                           FT_ULong   tag,
-                           FT_Long    offset,
-                           FT_Byte*   buffer,
-                           FT_ULong*  length );
-
-
-  /*************************************************************************/
-  /*                                                                       */
   /* <Struct>                                                              */
   /*    SFNT_Interface                                                     */
   /*                                                                       */
@@ -492,7 +497,7 @@
     TT_Init_Face_Func            init_face;
     TT_Load_Face_Func            load_face;
     TT_Done_Face_Func            done_face;
-    SFNT_Get_Interface_Func      get_interface;
+    FT_Module_Requester          get_interface;
 
     TT_Load_Any_Func             load_any;
     TT_Load_SFNT_HeaderRec_Func  load_sfnt_header;
@@ -524,6 +529,8 @@
     /* see `ttsbit.h' */
     TT_Set_SBit_Strike_Func      set_sbit_strike;
     TT_Load_Table_Func           load_sbits;
+    TT_Find_SBit_Image_Func      find_sbit_image;
+    TT_Load_SBit_Metrics_Func    load_sbit_metrics;
     TT_Load_SBit_Image_Func      load_sbit_image;
     TT_Free_Table_Func           free_sbits;
 
@@ -531,10 +538,6 @@
     TT_Get_PS_Name_Func          get_psname;
     TT_Free_Table_Func           free_psnames;
 
-    /* see `ttcmap.h' */
-    TT_CharMap_Load_Func         load_charmap;
-    TT_CharMap_Free_Func         free_charmap;
-
   } SFNT_Interface;
 
 

reactos/lib/freetype/include/freetype/internal
t1types.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1types.h	15 Feb 2004 21:45:32 -0000	1.4
+++ t1types.h	10 May 2004 17:48:28 -0000	1.5
@@ -5,7 +5,7 @@
 /*    Basic Type1/Type2 type definitions and interface (specification      */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -23,8 +23,9 @@
 
 #include <ft2build.h>
 #include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
 FT_BEGIN_HEADER
@@ -101,21 +102,21 @@
 
     FT_Int           num_subrs;
     FT_Byte**        subrs;
-    FT_Int*          subrs_len;
+    FT_PtrDist*      subrs_len;
 
     FT_Int           num_glyphs;
     FT_String**      glyph_names;       /* array of glyph names       */
     FT_Byte**        charstrings;       /* array of glyph charstrings */
-    FT_Int*          charstrings_len;
+    FT_PtrDist*      charstrings_len;
 
-    FT_Byte*         paint_type;
+    FT_Byte          paint_type;
     FT_Byte          font_type;
     FT_Matrix        font_matrix;
     FT_Vector        font_offset;
     FT_BBox          font_bbox;
     FT_Long          font_id;
 
-    FT_Fixed*        stroke_width;
+    FT_Fixed         stroke_width;
 
   } T1_FontRec, *T1_Font;
 
@@ -141,17 +142,6 @@
   /*************************************************************************/
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* This structure/class is defined here because it is common to the      */
-  /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */
-  /*                                                                       */
-  /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
-  /* are not shared between font drivers, and are thus defined normally in */
-  /* `ttobjs.h'.                                                           */
-  /*                                                                       */
-  /*************************************************************************/
-
   typedef struct T1_FaceRec_*   T1_Face;
   typedef struct CID_FaceRec_*  CID_Face;
 
@@ -169,7 +159,7 @@
 
     /* support for Multiple Masters fonts */
     PS_Blend       blend;
-    
+
     /* since FT 2.1 - interface to PostScript hinter */
     const void*    pshinter;
 
@@ -183,8 +173,10 @@
     void*            psaux;
     CID_FaceInfoRec  cid;
     void*            afm_data;
+    FT_Byte*         binary_data; /* used if hex data has been converted */
+    FT_Stream        cid_stream;
     CID_Subrs        subrs;
-    
+
     /* since FT 2.1 - interface to PostScript hinter */
     void*            pshinter;
 

reactos/lib/freetype/include/freetype/internal
tttypes.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- tttypes.h	15 Feb 2004 21:45:32 -0000	1.4
+++ tttypes.h	10 May 2004 17:48:28 -0000	1.5
@@ -108,41 +108,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
-  /*    TT_TableDirRec                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure models a TrueType table directory.  It is used to   */
-  /*    access the various tables of the font face.                        */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    version       :: The version number; starts with 0x00010000.       */
-  /*                                                                       */
-  /*    numTables     :: The number of tables.                             */
-  /*                                                                       */
-  /*    searchRange   :: Unused.                                           */
-  /*                                                                       */
-  /*    entrySelector :: Unused.                                           */
-  /*                                                                       */
-  /*    rangeShift    :: Unused.                                           */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This structure is only used during font opening.                   */
-  /*                                                                       */
-  typedef struct  TT_TableDirRec_
-  {
-    FT_Fixed   version;        /* should be 0x10000 */
-    FT_UShort  numTables;      /* number of tables  */
-
-    FT_UShort  searchRange;    /* These parameters are only used  */
-    FT_UShort  entrySelector;  /* for a dichotomy search in the   */
-    FT_UShort  rangeShift;     /* directory.  We ignore them.     */
-
-  } TT_TableDirRec;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
   /*    TT_TableRec                                                        */
   /*                                                                       */
   /* <Description>                                                         */
@@ -171,61 +136,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
-  /*    TT_CMapDirRec                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure describes the directory of the `cmap' table,        */
-  /*    containing the font's character mappings table.                    */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    tableVersionNumber :: The version number.                          */
-  /*                                                                       */
-  /*    numCMaps           :: The number of charmaps in the font.          */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This structure is only used during font loading.                   */
-  /*                                                                       */
-  typedef struct  TT_CMapDirRec_
-  {
-    FT_UShort  tableVersionNumber;
-    FT_UShort  numCMaps;
-
-  } TT_CMapDirRec, *TT_CMapDir;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_CMapDirEntryRec                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure describes a charmap in a TrueType font.             */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    platformID :: An ID used to specify for which platform this        */
-  /*                  charmap is defined (FreeType manages all platforms). */
-  /*                                                                       */
-  /*    encodingID :: A platform-specific ID used to indicate which source */
-  /*                  encoding is used in this charmap.                    */
-  /*                                                                       */
-  /*    offset     :: The offset of the charmap relative to the start of   */
-  /*                  the `cmap' table.                                    */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This structure is only used during font loading.                   */
-  /*                                                                       */
-  typedef struct  TT_CMapDirEntryRec_
-  {
-    FT_UShort  platformID;
-    FT_UShort  platformEncodingID;
-    FT_Long    offset;
-
-  } TT_CMapDirEntryRec, *TT_CMapDirEntry;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
   /*    TT_LongMetricsRec                                                  */
   /*                                                                       */
   /* <Description>                                                         */
@@ -913,201 +823,6 @@
   /*************************************************************************/
   /***                                                                   ***/
   /***                                                                   ***/
-  /***                  TRUETYPE CHARMAPS SUPPORT                        ***/
-  /***                                                                   ***/
-  /***                                                                   ***/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  /* format 0 */
-
-  typedef struct  TT_CMap0_
-  {
-    FT_ULong  language;       /* for Mac fonts (originally ushort) */
-
-    FT_Byte*  glyphIdArray;
-
-  } TT_CMap0Rec, *TT_CMap0;
-
-
-  /* format 2 */
-
-  typedef struct  TT_CMap2SubHeaderRec_
-  {
-    FT_UShort  firstCode;      /* first valid low byte         */
-    FT_UShort  entryCount;     /* number of valid low bytes    */
-    FT_Short   idDelta;        /* delta value to glyphIndex    */
-    FT_UShort  idRangeOffset;  /* offset from here to 1st code */
-
-  } TT_CMap2SubHeaderRec, *TT_CMap2SubHeader;
-
-
-  typedef struct  TT_CMap2Rec_
-  {
-    FT_ULong            language;     /* for Mac fonts (originally ushort) */
-
-    FT_UShort*          subHeaderKeys;  /* high byte mapping table     */
-                                        /* value = subHeader index * 8 */
-    TT_CMap2SubHeader   subHeaders;
-    FT_UShort*          glyphIdArray;
-    FT_UShort           numGlyphId;   /* control value */
-
-  } TT_CMap2Rec, *TT_CMap2;
-
-
-  /* format 4 */
-
-  typedef struct  TT_CMap4Segment_
-  {
-    FT_UShort  endCount;
-    FT_UShort  startCount;
-    FT_Short   idDelta;
-    FT_UShort  idRangeOffset;
-
-  } TT_CMap4SegmentRec, *TT_CMap4Segment;
-
-
-  typedef struct  TT_CMap4Rec_
-  {
-    FT_ULong         language;       /* for Mac fonts (originally ushort) */
-
-    FT_UShort        segCountX2;     /* number of segments * 2            */
-    FT_UShort        searchRange;    /* these parameters can be used      */
-    FT_UShort        entrySelector;  /* for a binary search               */
-    FT_UShort        rangeShift;
-
-    TT_CMap4Segment  segments;
-    FT_UShort*       glyphIdArray;
-    FT_UShort        numGlyphId;     /* control value */
-
-    TT_CMap4Segment  last_segment;   /* last used segment; this is a small  */
-                                     /* cache to potentially increase speed */
-  } TT_CMap4Rec, *TT_CMap4;
-
-
-  /* format 6 */
-
-  typedef struct  TT_CMap6_
-  {
-    FT_ULong    language;       /* for Mac fonts (originally ushort)     */
-
-    FT_UShort   firstCode;      /* first character code of subrange      */
-    FT_UShort   entryCount;     /* number of character codes in subrange */
-
-    FT_UShort*  glyphIdArray;
-
-  } TT_CMap6Rec, *TT_CMap6;
-
-
-  /* auxiliary table for format 8 and 12 */
-
-  typedef struct  TT_CMapGroupRec_
-  {
-    FT_ULong  startCharCode;
-    FT_ULong  endCharCode;
-    FT_ULong  startGlyphID;
-
-  } TT_CMapGroupRec, *TT_CMapGroup;
-
-
-  /* FreeType handles format 8 and 12 identically.  It is not necessary to
-     cover mixed 16bit and 32bit codes since FreeType always uses FT_ULong
-     for input character codes -- converting Unicode surrogates to 32bit
-     character codes must be done by the application.                      */
-
-  typedef struct  TT_CMap8_12Rec_
-  {
-    FT_ULong      language;        /* for Mac fonts */
-
-    FT_ULong      nGroups;
-    TT_CMapGroup  groups;
-
-    TT_CMapGroup  last_group;      /* last used group; this is a small    */
-                                   /* cache to potentially increase speed */
-  } TT_CMap8_12Rec, *TT_CMap8_12;
-
-
-  /* format 10 */
-
-  typedef struct  TT_CMap10Rec_
-  {
-    FT_ULong    language;           /* for Mac fonts */
-
-    FT_ULong    startCharCode;      /* first character covered */
-    FT_ULong    numChars;           /* number of characters covered */
-
-    FT_UShort*  glyphs;
-
-  } TT_CMap10Rec, *TT_CMap10;
-
-
-  typedef struct TT_CMapTableRec_*  TT_CMapTable;
-
-
-  typedef FT_UInt
-  (*TT_CharMap_Func)( TT_CMapTable  charmap,
-                      FT_ULong      char_code );
-
-  typedef FT_ULong
-  (*TT_CharNext_Func)( TT_CMapTable  charmap,
-                       FT_ULong      char_code );
-
-
-  /* charmap table */
-  typedef struct  TT_CMapTableRec_
-  {
-    FT_UShort  platformID;
-    FT_UShort  platformEncodingID;
-    FT_UShort  format;
-    FT_ULong   length;          /* must be ulong for formats 8, 10, and 12 */
-
-    FT_Bool    loaded;
-    FT_ULong   offset;
-
-    union
-    {
-      TT_CMap0Rec     cmap0;
-      TT_CMap2Rec     cmap2;
-      TT_CMap4Rec     cmap4;
-      TT_CMap6Rec     cmap6;
-      TT_CMap8_12Rec  cmap8_12;
-      TT_CMap10Rec    cmap10;
-    } c;
-
-    TT_CharMap_Func   get_index;
-    TT_CharNext_Func  get_next_char;
-
-  } TT_CMapTableRec;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_CharMapRec                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The TrueType character map object type.                            */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    root :: The parent character map structure.                        */
-  /*                                                                       */
-  /*    cmap :: The used character map.                                    */
-  /*                                                                       */
-  typedef struct  TT_CharMapRec_
-  {
-    FT_CharMapRec    root;
-    TT_CMapTableRec  cmap;
-
-  } TT_CharMapRec;
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /***                                                                   ***/
-  /***                                                                   ***/
   /***                  ORIGINAL TT_FACE CLASS DEFINITION                ***/
   /***                                                                   ***/
   /***                                                                   ***/
@@ -1121,9 +836,8 @@
   /* This structure/class is defined here because it is common to the      */
   /* following formats: TTF, OpenType-TT, and OpenType-CFF.                */
   /*                                                                       */
-  /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
-  /* are not shared between font drivers, and are thus defined in          */
-  /* `ttobjs.h'.                                                           */
+  /* Note, however, that the classes TT_Size and TT_GlyphSlot are not      */
+  /* shared between font drivers, and are thus defined in `ttobjs.h'.      */
   /*                                                                       */
   /*************************************************************************/
 
@@ -1145,17 +859,6 @@
   typedef struct TT_FaceRec_*  TT_Face;
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
-  /*    TT_CharMap                                                         */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A handle to a TrueType character mapping object.                   */
-  /*                                                                       */
-  typedef struct TT_CharMapRec_*  TT_CharMap;
-
-
   /* a function type used for the truetype bytecode interpreter hooks */
   typedef FT_Error
   (*TT_Interpreter)( void*  exec_context );
@@ -1341,15 +1044,6 @@
   /*    cmap_size            :: The size in bytes of the `cmap_table'      */
   /*                            described above.                           */
   /*                                                                       */
-  /*    num_charmaps         :: The number of character mappings in the    */
-  /*                            font.                                      */
-  /*                                                                       */
-  /*    charmaps             :: The array of charmap objects for this font */
-  /*                            file.  Note that this field is a typeless  */
-  /*                            pointer.  The Reason is that the format of */
-  /*                            charmaps varies with the underlying font   */
-  /*                            format and cannot be determined here.      */
-  /*                                                                       */
   /*    goto_table           :: A function called by each TrueType table   */
   /*                            loader to position a stream's cursor to    */
   /*                            the start of a given table according to    */
@@ -1375,10 +1069,9 @@
   /*                            It must be called after the header was     */
   /*                            read, and before the `forget'.             */
   /*                                                                       */
-  /*    sfnt                 :: A pointer to the SFNT `driver' interface.  */
+  /*    sfnt                 :: A pointer to the SFNT service.             */
   /*                                                                       */
-  /*    psnames              :: A pointer to the `PSNames' module          */
-  /*                            interface.                                 */
+  /*    psnames              :: A pointer to the PostScript names service. */
   /*                                                                       */
   /*    hdmx                 :: The face's horizontal device metrics       */
   /*                            (`hdmx' table).  This table is optional in */
@@ -1497,14 +1190,15 @@
     TT_Loader_ReadGlyphFunc   read_simple_glyph;
     TT_Loader_ReadGlyphFunc   read_composite_glyph;
 
-    /* a typeless pointer to the SFNT_Interface table used to load     */
-    /* the basic TrueType tables in the face object                    */
+    /* a typeless pointer to the SFNT_Interface table used to load */
+    /* the basic TrueType tables in the face object                */
     void*                 sfnt;
 
-    /* a typeless pointer to the PSNames_Interface table used to       */
-    /* handle glyph names <-> unicode & Mac values                     */
+    /* a typeless pointer to the FT_Service_PsCMapsRec table used to */
+    /* handle glyph names <-> unicode & Mac values                   */
     void*                 psnames;
 
+
     /***********************************************************************/
     /*                                                                     */
     /* Optional TrueType/OpenType tables                                   */
@@ -1576,6 +1270,8 @@
 
     FT_Generic            extra;
 
+    const char*           postscript_name;
+
   } TT_FaceRec;
 
 
@@ -1646,11 +1342,15 @@
     FT_BBox          bbox;
     FT_Int           left_bearing;
     FT_Int           advance;
+    FT_Int           top_bearing;
+    FT_Int           vadvance;
     FT_Int           linear;
     FT_Bool          linear_def;
     FT_Bool          preserve_pps;
     FT_Vector        pp1;
     FT_Vector        pp2;
+    FT_Vector        pp3;
+    FT_Vector        pp4;
 
     FT_ULong         glyf_offset;
 

reactos/lib/freetype/include/freetype/internal
bdftypes.h removed after 1.2
diff -N bdftypes.h
--- bdftypes.h	18 Apr 2003 10:44:15 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
-/*  bdftypes.h
-
-  FreeType font driver for bdf fonts
-
-  Copyright (C) 2001, 2002 by
-  Francesco Zappa Nardelli
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef __BDFTYPES_H__
-#define __BDFTYPES_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_BDF_H
-
-
-FT_BEGIN_HEADER
-
-
-  typedef struct  BDF_Public_FaceRec_
-  {
-    FT_FaceRec  root;
-
-    char*       charset_encoding;
-    char*       charset_registry;
-
-  } BDF_Public_FaceRec, *BDF_Public_Face;
-
-
-  typedef FT_Error  (*BDF_GetPropertyFunc)( FT_Face           face,
-                                            const char*       prop_name,
-                                            BDF_PropertyRec  *aproperty );
-
-FT_END_HEADER
-
-
-#endif  /* __BDFTYPES_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal
cfftypes.h removed after 1.2
diff -N cfftypes.h
--- cfftypes.h	21 Jan 2004 19:23:46 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,256 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  cfftypes.h                                                             */
-/*                                                                         */
-/*    Basic OpenType/CFF type definitions and interface (specification     */
-/*    only).                                                               */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __CFFTYPES_H__
-#define __CFFTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    CFF_IndexRec                                                       */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A structure used to model a CFF Index table.                       */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    stream      :: The source input stream.                            */
-  /*                                                                       */
-  /*    count       :: The number of elements in the index.                */
-  /*                                                                       */
-  /*    off_size    :: The size in bytes of object offsets in index.       */
-  /*                                                                       */
-  /*    data_offset :: The position of first data byte in the index's      */
-  /*                   bytes.                                              */
-  /*                                                                       */
-  /*    offsets     :: A table of element offsets in the index.            */
-  /*                                                                       */
-  /*    bytes       :: If the index is loaded in memory, its bytes.        */
-  /*                                                                       */
-  typedef struct  CFF_IndexRec_
-  {
-    FT_Stream  stream;
-    FT_UInt    count;
-    FT_Byte    off_size;
-    FT_ULong   data_offset;
-
-    FT_ULong*  offsets;
-    FT_Byte*   bytes;
-
-  } CFF_IndexRec, *CFF_Index;
-
-
-  typedef struct  CFF_EncodingRec_
-  {
-    FT_UInt     format;
-    FT_ULong    offset;
-
-    FT_UInt     count;
-    FT_UShort   sids [256];  /* avoid dynamic allocations */
-    FT_UShort   codes[256];
-
-  } CFF_EncodingRec, *CFF_Encoding;
-
-
-  typedef struct  CFF_CharsetRec_
-  {
-
-    FT_UInt     format;
-    FT_ULong    offset;
-
-    FT_UShort*  sids;
-
-  } CFF_CharsetRec, *CFF_Charset;
-
-
-  typedef struct  CFF_FontRecDictRec_
-  {
-    FT_UInt    version;
-    FT_UInt    notice;
-    FT_UInt    copyright;
-    FT_UInt    full_name;
-    FT_UInt    family_name;
-    FT_UInt    weight;
-    FT_Bool    is_fixed_pitch;
-    FT_Fixed   italic_angle;
-    FT_Fixed   underline_position;
-    FT_Fixed   underline_thickness;
-    FT_Int     paint_type;
-    FT_Int     charstring_type;
-    FT_Matrix  font_matrix;
-    FT_UShort  units_per_em;
-    FT_Vector  font_offset;
-    FT_ULong   unique_id;
-    FT_BBox    font_bbox;
-    FT_Pos     stroke_width;
-    FT_ULong   charset_offset;
-    FT_ULong   encoding_offset;
-    FT_ULong   charstrings_offset;
-    FT_ULong   private_offset;
-    FT_ULong   private_size;
-    FT_Long    synthetic_base;
-    FT_UInt    embedded_postscript;
-    FT_UInt    base_font_name;
-    FT_UInt    postscript;
-
-    /* these should only be used for the top-level font dictionary */
-    FT_UInt    cid_registry;
-    FT_UInt    cid_ordering;
-    FT_ULong   cid_supplement;
-
-    FT_Long    cid_font_version;
-    FT_Long    cid_font_revision;
-    FT_Long    cid_font_type;
-    FT_Long    cid_count;
-    FT_ULong   cid_uid_base;
-    FT_ULong   cid_fd_array_offset;
-    FT_ULong   cid_fd_select_offset;
-    FT_UInt    cid_font_name;
-
-  } CFF_FontRecDictRec, *CFF_FontRecDict;
-
-
-  typedef struct  CFF_PrivateRec_
-  {
-    FT_Byte   num_blue_values;
-    FT_Byte   num_other_blues;
-    FT_Byte   num_family_blues;
-    FT_Byte   num_family_other_blues;
-
-    FT_Pos    blue_values[14];
-    FT_Pos    other_blues[10];
-    FT_Pos    family_blues[14];
-    FT_Pos    family_other_blues[10];
-
-    FT_Fixed  blue_scale;
-    FT_Pos    blue_shift;
-    FT_Pos    blue_fuzz;
-    FT_Pos    standard_width;
-    FT_Pos    standard_height;
-
-    FT_Byte   num_snap_widths;
-    FT_Byte   num_snap_heights;
-    FT_Pos    snap_widths[13];
-    FT_Pos    snap_heights[13];
-    FT_Bool   force_bold;
-    FT_Fixed  force_bold_threshold;
-    FT_Int    lenIV;
-    FT_Int    language_group;
-    FT_Fixed  expansion_factor;
-    FT_Long   initial_random_seed;
-    FT_ULong  local_subrs_offset;
-    FT_Pos    default_width;
-    FT_Pos    nominal_width;
-
-  } CFF_PrivateRec, *CFF_Private;
-
-
-  typedef struct  CFF_FDSelectRec_
-  {
-    FT_Byte   format;
-    FT_UInt   range_count;
-
-    /* that's the table, taken from the file `as is' */
-    FT_Byte*  data;
-    FT_UInt   data_size;
-
-    /* small cache for format 3 only */
-    FT_UInt   cache_first;
-    FT_UInt   cache_count;
-    FT_Byte   cache_fd;
-
-  } CFF_FDSelectRec, *CFF_FDSelect;
-
-
-  /* A SubFont packs a font dict and a private dict together.  They are */
-  /* needed to support CID-keyed CFF fonts.                             */
-  typedef struct  CFF_SubFontRec_
-  {
-    CFF_FontRecDictRec  font_dict;
-    CFF_PrivateRec      private_dict;
-
-    CFF_IndexRec        local_subrs_index;
-    FT_UInt             num_local_subrs;
-    FT_Byte**           local_subrs;
-
-  } CFF_SubFontRec, *CFF_SubFont;
-
-
-  /* maximum number of sub-fonts in a CID-keyed file */
-#define CFF_MAX_CID_FONTS  16
-
-
-  typedef struct  CFF_FontRec_
-  {
-    FT_Stream        stream;
-    FT_Memory        memory;
-    FT_UInt          num_faces;
-    FT_UInt          num_glyphs;
-
-    FT_Byte          version_major;
-    FT_Byte          version_minor;
-    FT_Byte          header_size;
-    FT_Byte          absolute_offsize;
-
-
-    CFF_IndexRec     name_index;
-    CFF_IndexRec     top_dict_index;
-    CFF_IndexRec     string_index;
-    CFF_IndexRec     global_subrs_index;
-
-    CFF_EncodingRec  encoding;
-    CFF_CharsetRec   charset;
-
-    CFF_IndexRec     charstrings_index;
-    CFF_IndexRec     font_dict_index;
-    CFF_IndexRec     private_index;
-    CFF_IndexRec     local_subrs_index;
-
-    FT_String*       font_name;
-    FT_UInt          num_global_subrs;
-    FT_Byte**        global_subrs;
-
-    CFF_SubFontRec   top_font;
-    FT_UInt          num_subfonts;
-    CFF_SubFont      subfonts[CFF_MAX_CID_FONTS];
-
-    CFF_FDSelectRec  fd_select;
-
-    /* interface to PostScript hinter */
-    void*            pshinter;
-
-    /* interface to Postscript Names service */
-    void*            psnames;
-
-  } CFF_FontRec, *CFF_Font;
-
-
-FT_END_HEADER
-
-#endif /* __CFFTYPES_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal
fnttypes.h removed after 1.3
diff -N fnttypes.h
--- fnttypes.h	21 Jan 2004 19:23:46 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  fnttypes.h                                                             */
-/*                                                                         */
-/*    Basic Windows FNT/FON type definitions and interface (specification  */
-/*    only).                                                               */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __FNTTYPES_H__
-#define __FNTTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_WINFONTS_H
-
-
-FT_BEGIN_HEADER
-
-
-  typedef struct  WinMZ_HeaderRec_
-  {
-    FT_UShort  magic;
-    /* skipped content */
-    FT_UShort  lfanew;
-
-  } WinMZ_HeaderRec;
-
-
-  typedef struct  WinNE_HeaderRec_
-  {
-    FT_UShort  magic;
-    /* skipped content */
-    FT_UShort  resource_tab_offset;
-    FT_UShort  rname_tab_offset;
-
-  } WinNE_HeaderRec;
-
-
-  typedef struct  WinNameInfoRec_
-  {
-    FT_UShort  offset;
-    FT_UShort  length;
-    FT_UShort  flags;
-    FT_UShort  id;
-    FT_UShort  handle;
-    FT_UShort  usage;
-
-  } WinNameInfoRec;
-
-
-  typedef struct  WinResourceInfoRec_
-  {
-    FT_UShort  type_id;
-    FT_UShort  count;
-
-  } WinResourceInfoRec;
-
-
-#define WINFNT_MZ_MAGIC  0x5A4D
-#define WINFNT_NE_MAGIC  0x454E
-
-
-  typedef struct  FNT_FontRec_
-  {
-    FT_ULong             offset;
-    FT_Int               size_shift;
-
-    FT_WinFNT_HeaderRec  header;
-
-    FT_Byte*             fnt_frame;
-    FT_ULong             fnt_size;
-
-  } FNT_FontRec, *FNT_Font;
-
-
-  typedef struct  FNT_FaceRec_
-  {
-    FT_FaceRec     root;
-    FNT_Font       font;
-
-    FT_CharMap     charmap_handle;
-    FT_CharMapRec  charmap;  /* a single charmap per face */
-
-  } FNT_FaceRec, *FNT_Face;
-
-
-FT_END_HEADER
-
-#endif /* __FNTTYPES_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal
ftcore.h removed after 1.1
diff -N ftcore.h
--- ftcore.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,185 +0,0 @@
-#ifndef __FT_CORE_H__
-#define __FT_CORE_H__
-
-#include <ft2build.h>
-#include FT_TYPES_H
-#include FT_SYSTEM_MEMORY_H
-
-FT_BEGIN_HEADER
-
- /**************************************************************************/
- /**************************************************************************/
- /*****                                                                *****/
- /*****                  C L E A N U P   S T A C K                     *****/
- /*****                                                                *****/
- /**************************************************************************/
- /**************************************************************************/
-
-
- /************************************************************************
-  *
-  * @functype: FT_CleanupFunc
-  *
-  * @description:
-  *   a function used to cleanup a given item on the cleanup stack
-  *
-  * @input:
-  *   item      :: target item pointer
-  *   item_data :: optional argument to cleanup routine
-  */
-  typedef void  (*FT_CleanupFunc)( FT_Pointer  item,
-                                   FT_Pointer  item_data );
-
-
-
- /************************************************************************
-  *
-  * @type: FT_XHandler
-  *
-  * @description:
-  *   handle to an exception-handler structure for the FreeType
-  *   exception sub-system
-  *
-  * @note:
-  *   exception handlers are allocated on the stack within a
-  *   @FT_XTRY macro. Do not try to access them directly.
-  */
-  typedef struct FT_XHandlerRec_*  FT_XHandler;
-
-
-/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
-/* this must be a small power of 2 whenever possible..                  */
-/*                                                                      */
-/* with a value of 5, we have a byte size of 64 bytes per chunk..       */
-/*                                                                      */
-#define  FT_CLEANUP_CHUNK_SIZE   5
-
-
-
-  typedef struct FT_CleanupItemRec_
-  {
-    FT_Pointer      item;
-    FT_CleanupFunc  item_func;
-    FT_Pointer      item_data;
-
-  } FT_CleanupItemRec;
-
-
-  typedef struct FT_CleanupChunkRec_*   FT_CleanupChunk;
-
-  typedef struct FT_CleanupChunkRec_
-  {
-    FT_CleanupChunk    link;
-    FT_CleanupItemRec  items[ FT_CLEANUP_CHUNK_SIZE ];
-
-  } FT_CleanupChunkRec;
-
-
-  typedef struct FT_CleanupStackRec_
-  {
-    FT_CleanupItem     top;
-    FT_CleanupItem     limit;
-    FT_CleanupChunk    chunk;
-    FT_CleanupChunkRec chunk_0;  /* avoids stupid dynamic allocation */
-    FT_Memory          memory;
-
-  } FT_CleanupStackRec, *FT_CleanupStack;
-
-
-  FT_BASE( void )
-  ft_cleanup_stack_push( FT_CleanupStack  stack,
-                         FT_Pointer       item,
-                         FT_CleanupFunc   item_func,
-                         FT_Pointer       item_data );
-
-  FT_BASE( void )
-  ft_cleanup_stack_pop( FT_CleanupStack   stack,
-                        FT_Int            destroy );
-
-  FT_BASE( FT_CleanupItem )
-  ft_cleanup_stack_peek( FT_CleanupStack  stack );
-
-  FT_BASE( void )
-  ft_cleanup_throw( FT_CleanupStack  stack,
-                    FT_Error         error );
-
-
-
- /**************************************************************************/
- /**************************************************************************/
- /*****                                                                *****/
- /*****                 M E M O R Y   M A N A G E R                    *****/
- /*****                                                                *****/
- /**************************************************************************/
- /**************************************************************************/
-
-  typedef struct FT_MemoryRec_
-  {
-    FT_Memory_AllocFunc     mem_alloc;   /* shortcut to funcs->mem_alloc */
-    FT_Memory_FreeFunc      mem_free;    /* shortcut to funcs->mem_free  */
-    FT_Pointer              mem_data;
-    const FT_Memory_Funcs   mem_funcs;
-
-    FT_CleanupStackRec      cleanup_stack;
-    FT_Pointer              meta_class;
-
-  } FT_MemoryRec;
-
-
-#define  FT_MEMORY(x)  ((FT_Memory)(x))
-#define  FT_MEMORY__ALLOC(x)       FT_MEMORY(x)->mem_alloc
-#define  FT_MEMORY__FREE(x)        FT_MEMORY(x)->mem_free
-#define  FT_MEMORY__REALLOC(x)     FT_MEMORY(x)->mem_funcs->mem_realloc
-#define  FT_MEMORY__CLEANUP(x)     (&FT_MEMORY(x)->cleanup_stack)
-#define  FT_MEMORY__META_CLASS(x)  ((FT_MetaClass)(FT_MEMORY(x)->meta_class))
-
-
- /**************************************************************************/
- /**************************************************************************/
- /*****                                                                *****/
- /*****             E X C E P T I O N   H A N D L I N G                *****/
- /*****                                                                *****/
- /**************************************************************************/
- /**************************************************************************/
-
-
- /************************************************************************
-  *
-  * @struct: FT_XHandlerRec
-  *
-  * @description:
-  *   exception handler structure
-  *
-  * @fields:
-  *   previous   :: previous handler in chain.
-  *   jum_buffer :: processor state used by setjmp/longjmp to implement
-  *                 exception control transfer
-  *   error      :: exception error code
-  *   mark       :: top of cleanup stack when @FT_XTRY is used
-  */
-  typedef struct FT_XHandlerRec_
-  {
-    FT_XHandler        previous;
-    ft_jmp_buf         jump_buffer;
-    volatile FT_Error  error;
-    FT_Pointer         mark;
-
-  } FT_XHandlerRec;
-
-  FT_BASE( void )
-  ft_xhandler_enter( FT_XHandler  xhandler,
-                     FT_Memory    memory );
-
-  FT_BASE( void )
-  ft_xhandler_exit( FT_XHandler  xhandler );
-
-
-
-
-
-
-
-
-FT_END_HEADER
-
-#endif /* __FT_CORE_H__ */

reactos/lib/freetype/include/freetype/internal
ftexcept.h removed after 1.1
diff -N ftexcept.h
--- ftexcept.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-#ifndef __FT_EXCEPT_H__
-#define __FT_EXCEPT_H__
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-
-FT_BEGIN_HEADER
-
-
-
- /* I can't find a better place for this for now */
-
-<<<<<<< ftexcept.h
-=======
-
-/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
-/* this must be a small power of 2 whenever possible..                  */
-/*                                                                      */
-/* with a value of 5, we have a byte size of 64 bytes per chunk..       */
-/*                                                                      */
-#define  FT_CLEANUP_CHUNK_SIZE   5
-
-
-
-  typedef struct FT_CleanupItemRec_
-  {
-    FT_Pointer      item;
-    FT_CleanupFunc  item_func;
-    FT_Pointer      item_data;
-
-  } FT_CleanupItemRec;
-
-  typedef struct FT_CleanupChunkRec_*   FT_CleanupChunk;
-  
-  typedef struct FT_CleanupChunkRec_
-  {
-    FT_CleanupChunk    link;
-    FT_CleanupItemRec  items[ FT_CLEANUP_CHUNK_SIZE ];
-
-  } FT_CleanupChunkRec;
-
-
-  typedef struct FT_CleanupStackRec_
-  {
-    FT_CleanupItem     top;
-    FT_CleanupItem     limit;
-    FT_CleanupChunk    chunk;
-    FT_CleanupChunkRec chunk_0;  /* avoids stupid dynamic allocation */
-    FT_Memory          memory;
-
-  } FT_CleanupStackRec, *FT_CleanupStack;
-
-
-  FT_BASE( void )
-  ft_cleanup_stack_push( FT_CleanupStack  stack,
-                         FT_Pointer       item,
-                         FT_CleanupFunc   item_func,
-                         FT_Pointer       item_data );
-
-  FT_BASE( void )
-  ft_cleanup_stack_pop( FT_CleanupStack   stack,
-                        FT_Int            destroy );
-
-  FT_BASE( FT_CleanupItem )
-  ft_cleanup_stack_peek( FT_CleanupStack  stack );
-
-  FT_BASE( void )
-  ft_xhandler_enter( FT_XHandler  xhandler,
-                     FT_Memory    memory );                         
-
-  FT_BASE( void )
-  ft_xhandler_exit( FT_XHandler  xhandler );
-
-
-  FT_BASE( void )
-  ft_cleanup_throw( FT_CleanupStack  stack,
-                    FT_Error         error );
-
->>>>>>> 1.2
-FT_END_HEADER
-
-#endif /* __FT_EXCEPT_H__ */

reactos/lib/freetype/include/freetype/internal
fthash.h removed after 1.1
diff -N fthash.h
--- fthash.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,502 +0,0 @@
-/******************************************************************
- *
- *  fthash.h  - fast dynamic hash tables
- *
- *  Copyright 2002 by
- *  David Turner, Robert Wilhelm, and Werner Lemberg
- *
- *  This file is part of the FreeType project, and may only be used,
- *  modified, and distributed under the terms of the FreeType project
- *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
- *  this file you indicate that you have read the license and
- *  understand and accept it fully.
- *
- *
- *  This header is used to define dynamic hash tables as described
- *  by the article "Main-Memory Linear Hashing - Some Enhancements
- *  of Larson's Algorithm" by Mikael Petterson.
- *
- *  Basically, linear hashing prevents big "stalls" during
- *  resizes of the buckets array by only splitting one bucket
- *  at a time. This ensures excellent response time even when
- *  the table is frequently resized..
- *
- *
- *  Note that the use of the FT_Hash type is rather unusual in order
- *  to be as generic and efficient as possible. See the comments in the
- *  following definitions for more details.
- */
-
-#ifndef __FT_HASH_H__
-#define __FT_HASH_H__
-
-#include <ft2build.h>
-#include FT_TYPES_H
-
-FT_BEGIN_HEADER
-
- /***********************************************************
-  *
-  * @type: FT_Hash
-  *
-  * @description:
-  *   handle to a @FT_HashRec structure used to model a
-  *   dynamic hash table
-  */
-  typedef struct FT_HashRec_*      FT_Hash;
-
-
- /***********************************************************
-  *
-  * @type: FT_HashNode
-  *
-  * @description:
-  *   handle to a @FT_HashNodeRec structure used to model a
-  *   single node of a hash table
-  */
-  typedef struct FT_HashNodeRec_*  FT_HashNode;
-
-
- /***********************************************************
-  *
-  * @type: FT_HashLookup
-  *
-  * @description:
-  *   handle to a @FT_HashNode pointer. This is returned by
-  *   the @ft_hash_lookup function and can later be used by
-  *   @ft_hash_add or @ft_hash_remove
-  */
-  typedef FT_HashNode*     FT_HashLookup;
-
-
- /***********************************************************
-  *
-  * @type: FT_Hash_EqualFunc
-  *
-  * @description:
-  *   a function used to compare two nodes of the hash table
-  *
-  * @input:
-  *   node1 :: handle to first node
-  *   node2 :: handle to second node
-  *
-  * @return:
-  *   1 iff the 'keys' in 'node1' and 'node2' are identical.
-  *   0 otherwise.
-  */
-  typedef FT_Int  (*FT_Hash_EqualFunc)( FT_HashNode  node1,
-                                        FT_HashNode  node2 );
-
-
- /***********************************************************
-  *
-  * @struct: FT_HashRec
-  *
-  * @description:
-  *   a structure used to model a dynamic hash table.
-  *
-  * @fields:
-  *   memory       :: memory manager used to allocate
-  *                   the buckets array and the hash nodes
-  *
-  *   buckets      :: array of hash buckets
-  *
-  *   node_size    :: size of node in bytes
-  *   node_compare :: a function used to compare two nodes
-  *   node_hash    :: a function used to compute the hash
-  *                   value of a given node
-  *   p            ::
-  *   mask         ::
-  *   slack        ::
-  *
-  * @note:
-  *   'p', 'mask' and 'slack' are control values managed by
-  *   the hash table. Do not try to interpret them directly.
-  *
-  *   You can grab the hash table size by calling
-  *   '@ft_hash_get_size'.
-  */
-  typedef struct FT_HashRec_
-  {
-    FT_HashNode*         buckets;
-    FT_UInt              p;
-    FT_UInt              mask;  /* really maxp-1 */
-    FT_Long              slack;
-    FT_Hash_EqualFunc    node_equal;
-    FT_Memory            memory;
-
-  } FT_HashRec;
-
-
- /***********************************************************
-  *
-  * @struct: FT_HashNodeRec
-  *
-  * @description:
-  *   a structure used to model the root fields of a dynamic
-  *   hash table node.
-  *
-  *   it's up to client applications to "sub-class" this
-  *   structure to add relevant (key,value) definitions
-  *
-  * @fields:
-  *   link :: pointer to next node in bucket's collision list
-  *   hash :: 32-bit hash value for this node
-  *
-  * @note:
-  *   it's up to client applications to "sub-class" this structure
-  *   to add relevant (key,value) type definitions. For example,
-  *   if we want to build a "string -> int" mapping, we could use
-  *   something like:
-  *
-  *   {
-  *     typedef struct MyNodeRec_
-  *     {
-  *       FT_HashNodeRec  hnode;
-  *       const char*     key;
-  *       int             value;
-  *
-  *     } MyNodeRec, *MyNode;
-  *   }
-  *
-  */
-  typedef struct FT_HashNodeRec_
-  {
-    FT_HashNode  link;
-    FT_UInt32    hash;
-
-  } FT_HashNodeRec;
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_init
-  *
-  * @description:
-  *   initialize a dynamic hash table
-  *
-  * @input:
-  *   table      :: handle to target hash table structure
-  *   node_equal :: node comparison function
-  *   memory     :: memory manager handle used to allocate the
-  *                 buckets array within the hash table
-  *
-  * @return:
-  *   error code. 0 means success
-  *
-  * @note:
-  *   the node comparison function should only compare node _keys_
-  *   and ignore values !! with good hashing computation (which the
-  *   user must perform itself), the comparison function should be
-  *   pretty seldom called.
-  *
-  *   here is a simple example:
-  *
-  *   {
-  *     static int my_equal( MyNode  node1,
-  *                          MyNode  node2 )
-  *     {
-  *       // compare keys of 'node1' and 'node2'
-  *       return (strcmp( node1->key, node2->key ) == 0);
-  *     }
-  *
-  *     ....
-  *
-  *     ft_hash_init( &hash, (FT_Hash_EqualFunc) my_compare, memory );
-  *     ....
-  *   }
-  */
-  FT_BASE( FT_Error )
-  ft_hash_init( FT_Hash              table,
-                FT_Hash_EqualFunc  compare,
-                FT_Memory            memory );
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_lookup
-  *
-  * @description:
-  *   search a hash table to find a node corresponding to a given
-  *   key.
-  *
-  * @input:
-  *   table   :: handle to target hash table structure
-  *   keynode :: handle to a reference hash node that will be
-  *              only used for key comparisons with the table's
-  *              elements
-  *
-  * @return:
-  *   a pointer-to-hash-node value, which must be used as followed:
-  *
-  *   - if '*result' is NULL, the key wasn't found in the hash
-  *     table. The value of 'result' can be used to add new elements
-  *     through @ft_hash_add however..
-  *
-  *   - if '*result' is not NULL, it's a handle to the first table
-  *     node that corresponds to the search key. The value of 'result'
-  *     can be used to remove this element through @ft_hash_remove
-  *
-  * @note:
-  *   here is an example:
-  *
-  *   {
-  *     // maps a string to an integer with a hash table
-  *     // returns -1 in case of failure
-  *     //
-  *     int  my_lookup( FT_Hash      table,
-  *                     const char*  key )
-  *     {
-  *       MyNode*    pnode;
-  *       MyNodeRec  noderec;
-  *
-  *       // set-up key node. It's 'hash' and 'key' fields must
-  *       // be set correctly.. we ignore 'link' and 'value'
-  *       //
-  *       noderec.hnode.hash = strhash( key );
-  *       noderec.key        = key;
-  *
-  *       // perform search - return value
-  *       //
-  *       pnode = (MyNode) ft_hash_lookup( table, &noderec );
-  *       if ( *pnode )
-  *       {
-  *         // we found it
-  *         return (*pnode)->value;
-  *       }
-  *       return -1;
-  *     }
-  *   }
-  */
-  FT_BASE_DEF( FT_HashLookup )
-  ft_hash_lookup( FT_Hash      table,
-                  FT_HashNode  keynode );
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_add
-  *
-  * @description:
-  *   add a new node to a dynamic hash table. the user must
-  *   call @ft_hash_lookup and allocate a new node before calling
-  *   this function.
-  *
-  * @input:
-  *   table    :: hash table handle
-  *   lookup   :: pointer-to-hash-node value returned by @ft_hash_lookup
-  *   new_node :: handle to new hash node. All its fields must be correctly
-  *               set, including 'hash'.
-  *
-  * @return:
-  *   error code. 0 means success
-  *
-  * @note:
-  *   this function should always be used _after_ a call to @ft_hash_lookup
-  *   that returns a pointer to a NULL  handle. Here's an example:
-  *
-  *   {
-  *     // sets the value corresponding to a given string key
-  *     //
-  *     void  my_set( FT_Hash      table,
-  *                   const char*  key,
-  *                   int          value )
-  *     {
-  *       MyNode*    pnode;
-  *       MyNodeRec  noderec;
-  *       MyNode     node;
-  *
-  *       // set-up key node. It's 'hash' and 'key' fields must
-  *       // be set correctly..
-  *       noderec.hnode.hash = strhash( key );
-  *       noderec.key        = key;
-  *
-  *       // perform search - return value
-  *       pnode = (MyNode) ft_hash_lookup( table, &noderec );
-  *       if ( *pnode )
-  *       {
-  *         // we found it, simply replace the value in the node
-  *         (*pnode)->value = value;
-  *         return;
-  *       }
-  *
-  *       // allocate a new node - and set it up
-  *       node = (MyNode) malloc( sizeof(*node) );
-  *       if ( node == NULL ) .....
-  *
-  *       node->hnode.hash = noderec.hnode.hash;
-  *       node->key        = key;
-  *       node->value      = value;
-  *
-  *       // add it to the hash table
-  *       error = ft_hash_add( table, pnode, node );
-  *       if (error) ....
-  *     }
-  */
-  FT_BASE( FT_Error )
-  ft_hash_add( FT_Hash        table,
-               FT_HashLookup  lookup,
-               FT_HashNode    new_node );
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_remove
-  *
-  * @description:
-  *   try to remove the node corresponding to a given key from
-  *   a hash table. This must be called after @ft_hash_lookup
-  *
-  * @input:
-  *   table   :: hash table handle
-  *   lookup  :: pointer-to-hash-node value returned by @ft_hash_lookup
-  *
-  * @note:
-  *   this function doesn't free the node itself !! Here's an example:
-  *
-  *   {
-  *     // sets the value corresponding to a given string key
-  *     //
-  *     void  my_remove( FT_Hash      table,
-  *                      const char*  key )
-  *     {
-  *       MyNodeRec  noderec;
-  *       MyNode     node;
-  *
-  *       noderec.hnode.hash = strhash(key);
-  *       noderec.key        = key;
-  *       node               = &noderec;
-  *
-  *       pnode = ft_hash_lookup( table, &noderec );
-  *       node  = *pnode;
-  *       if ( node != NULL )
-  *       {
-  *         error = ft_hash_remove( table, pnode );
-  *         if ( !error )
-  *           free( node );
-  *       }
-  *     }
-  *   }
-  */
-  FT_BASE( FT_Error )
-  ft_hash_remove( FT_Hash        table,
-                  FT_HashLookup  lookup );
-
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_get_size
-  *
-  * @description:
-  *   return the number of elements in a given hash table
-  *
-  * @input:
-  *   table   :: handle to target hash table structure
-  *
-  * @return:
-  *   number of elements. 0 if empty
-  */
-  FT_BASE( FT_UInt )
-  ft_hash_get_size( FT_Hash  table );
-
-
-
- /****************************************************************
-  *
-  * @functype: FT_Hash_ForeachFunc
-  *
-  * @description:
-  *   a function used to iterate over all elements of a given
-  *   hash table
-  *
-  * @input:
-  *   node :: handle to target @FT_HashNodeRec node structure
-  *   data :: optional argument to iteration routine
-  *
-  * @also:  @ft_hash_foreach
-  */
-  typedef void  (*FT_Hash_ForeachFunc)( const FT_HashNode  node,
-                                        const FT_Pointer   data );
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_foreach
-  *
-  * @description:
-  *   parse over all elements in a hash table
-  *
-  * @input:
-  *   table        :: handle to target hash table structure
-  *   foreach_func :: iteration routine called for each element
-  *   foreach_data :: optional argument to the iteration routine
-  *
-  * @note:
-  *   this function is often used to release all elements from a
-  *   hash table. See the example given for @ft_hash_done
-  */
-  FT_BASE( void )
-  ft_hash_foreach( FT_Hash              table,
-                   FT_Hash_ForeachFunc  foreach_func,
-                   const FT_Pointer     foreach_data );
-
-
-
- /****************************************************************
-  *
-  * @function: ft_hash_done
-  *
-  * @description:
-  *   finalize a given hash table
-  *
-  * @input:
-  *   table     :: handle to target hash table structure
-  *   node_func :: optional iteration function pointer. this
-  *                can be used to destroy all nodes explicitely
-  *   node_data :: optional argument to the node iterator
-  *
-  * @note:
-  *   this function simply frees the hash table's buckets.
-  *   you probably will need to call @ft_hash_foreach to
-  *   destroy all its elements before @ft_hash_done, as in
-  *   the following example:
-  *
-  *   {
-  *     static void  my_node_clear( const MyNode  node )
-  *     {
-  *       free( node );
-  *     }
-  *
-  *     static void  my_done( FT_Hash  table )
-  *     {
-  *       ft_hash_done( table, (FT_Hash_ForeachFunc) my_node_clear, NULL );
-  *     }
-  *   }
-  */
-  FT_BASE( void )
-  ft_hash_done( FT_Hash              table,
-                FT_Hash_ForeachFunc  item_func,
-                const FT_Pointer     item_data );
-
- /* */
-
- /* compute bucket index from hash value in a dynamic hash table */
- /* this is only used to break encapsulation to speed lookups in */
- /* the FreeType cache manager !!                                */
- /*                                                              */
-
-#define  FT_HASH_COMPUTE_INDEX(_table,_hash,_index)                  \
-             {                                                       \
-               FT_UInt  _mask  = (_table)->mask;                     \
-               FT_UInt  _hash0 = (_hash);                            \
-                                                                     \
-               (_index) = (FT_UInt)( (_hash0) & _mask ) );           \
-               if ( (_index) < (_table)->p )                         \
-                 (_index) = (FT_uInt)( (_hash0) & ( 2*_mask+1 ) );   \
-             }
-
-
-FT_END_HEADER
-
-#endif /* __FT_HASH_H__ */

reactos/lib/freetype/include/freetype/internal
ftobject.h removed after 1.1
diff -N ftobject.h
--- ftobject.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,533 +0,0 @@
-#ifndef __FT_OBJECT_H__
-#define __FT_OBJECT_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-FT_BEGIN_HEADER
-
- /**************************************************************
-  *
-  * @type: FT_Object
-  *
-  * @description:
-  *   handle to a FreeType Object. See @FT_ObjectRec
-  */
-  typedef struct FT_ObjectRec_*        FT_Object;
-
-
- /**************************************************************
-  *
-  * @type: FT_Class
-  *
-  * @description:
-  *   handle to a constant class handle to a FreeType Object.
-  *
-  *   Note that a class is itself a @FT_Object and are dynamically
-  *   allocated on the heap.
-  *
-  * @also:
-  *  @FT_ClassRec, @FT_Object, @FT_ObjectRec, @FT_Type, @FT_TypeRec
-  */
-  typedef const struct FT_ClassRec_*   FT_Class;
-
-
- /**************************************************************
-  *
-  * @type: FT_Type
-  *
-  * @description:
-  *   handle to a constant structure (of type @FT_TypeRec) used
-  *   to describe a given @FT_Class type to the FreeType object
-  *   sub-system.
-  */
-  typedef const struct FT_TypeRec_*    FT_Type;
-
-
-
- /**************************************************************
-  *
-  * @struct: FT_ObjectRec
-  *
-  * @description:
-  *   a structure describing the root fields of all @FT_Object
-  *   class instances in FreeType
-  *
-  * @fields:
-  *   clazz     :: handle to the object's class
-  *   ref_count :: object's reference count. Starts at 1
-  */
-  typedef struct FT_ObjectRec_
-  {
-    FT_Class  clazz;
-    FT_Int    ref_count;
-
-  } FT_ObjectRec;
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT (x)
-  *
-  * @description:
-  *   a useful macro to type-cast anything to a @FT_Object
-  *   handle. No check performed..
-  */
-#define  FT_OBJECT(x)    ((FT_Object)(x))
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT_P (x)
-  *
-  * @description:
-  *   a useful macro to type-cast anything to a pointer to
-  *   @FT_Object handle.
-  */
-#define  FT_OBJECT_P(x)  ((FT_Object*)(x))
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT__CLASS (obj)
-  *
-  * @description:
-  *   a useful macro to return the class of any object
-  */
-#define  FT_OBJECT__CLASS(x)      FT_OBJECT(x)->clazz
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT__REF_COUNT (obj)
-  *
-  * @description:
-  *   a useful macro to return the reference count of any object
-  */
-#define  FT_OBJECT__REF_COUNT(x)  FT_OBJECT(x)->ref_count
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT__MEMORY (obj)
-  *
-  * @description:
-  *   a useful macro to return a handle to the memory manager
-  *   used to allocate a given object
-  */
-#define  FT_OBJECT__MEMORY(x)     FT_CLASS__MEMORY(FT_OBJECT(x)->clazz)
-
-
- /**************************************************************
-  *
-  * @macro: FT_OBJECT__LIBRARY (obj)
-  *
-  * @description:
-  *   a useful macro to return a handle to the library handle
-  *   that owns the object
-  */
-#define  FT_OBJECT__LIBRARY(x)    FT_CLASS__LIBRARY(FT_OBJECT(x)->clazz)
-
-
- /**************************************************************
-  *
-  * @functype: FT_Object_InitFunc
-  *
-  * @description:
-  *   a function used to initialize a new object
-  *
-  * @input:
-  *   object    :: target object handle
-  *   init_data :: optional pointer to initialization data
-  *
-  * @return:
-  *   error code. 0 means success
-  */
-  typedef FT_Error  (*FT_Object_InitFunc)( FT_Object   object,
-                                           FT_Pointer  init_data );
-
- /**************************************************************
-  *
-  * @functype: FT_Object_DoneFunc
-  *
-  * @description:
-  *   a function used to finalize a given object
-  *
-  * @input:
-  *   object    :: handle to target object
-  */
-  typedef void  (*FT_Object_DoneFunc)( FT_Object   object );
-
-
- /**************************************************************
-  *
-  * @struct: FT_ClassRec
-  *
-  * @description:
-  *   a structure used to describe a given object class within
-  *   FreeType
-  *
-  * @fields:
-  *   object   :: root @FT_ObjectRec fields, since each class is
-  *               itself an object. (it's an instance of the
-  *               "metaclass", a special object of the FreeType
-  *               object sub-system.)
-  *
-  *   magic    :: a 32-bit magic number used for decoding
-  *   super    :: pointer to super class
-  *   type     :: the @FT_Type descriptor of this class
-  *   memory   :: the current memory manager handle
-  *   library  :: the current library handle
-  *   info     :: an opaque pointer to class-specific information
-  *               managed by the FreeType object sub-system
-  *
-  *   class_done :: the class destructor function
-  *
-  *   obj_size :: size of class instances in bytes
-  *   obj_init :: class instance constructor
-  *   obj_done :: class instance destructor
-  */
-  typedef struct FT_ClassRec_
-  {
-    FT_ObjectRec        object;
-    FT_UInt32           magic;
-    FT_Class            super;
-    FT_Type             type;
-    FT_Memory           memory;
-    FT_Library          library;
-    FT_Pointer          info;
-
-    FT_Object_DoneFunc  class_done;
-
-    FT_UInt             obj_size;
-    FT_Object_InitFunc  obj_init;
-    FT_Object_DoneFunc  obj_done;
-
-  } FT_ClassRec;
-
-
- /**************************************************************
-  *
-  * @macro: FT_CLASS (x)
-  *
-  * @description:
-  *   a useful macro to convert anything to a class handle
-  *   without checks
-  */
-#define  FT_CLASS(x)    ((FT_Class)(x))
-
-
- /**************************************************************
-  *
-  * @macro: FT_CLASS_P (x)
-  *
-  * @description:
-  *   a useful macro to convert anything to a pointer to a class
-  *   handle without checks
-  */
-#define  FT_CLASS_P(x)  ((FT_Class*)(x))
-
-
- /**************************************************************
-  *
-  * @macro: FT_CLASS__MEMORY (clazz)
-  *
-  * @description:
-  *   a useful macro to return the memory manager handle of a
-  *   given class
-  */
-#define  FT_CLASS__MEMORY(x)   FT_CLASS(x)->memory
-
-
- /**************************************************************
-  *
-  * @macro: FT_CLASS__LIBRARY (clazz)
-  *
-  * @description:
-  *   a useful macro to return the library handle of a
-  *   given class
-  */
-#define  FT_CLASS__LIBRARY(x)  FT_CLASS(x)->library
-
-
-
- /**************************************************************
-  *
-  * @macro: FT_CLASS__TYPE (clazz)
-  *
-  * @description:
-  *   a useful macro to return the type of a given class
-  *   given class
-  */
-#define  FT_CLASS__TYPE(x)     FT_CLASS(x)->type
-
- /* */
-#define  FT_CLASS__INFO(x)     FT_CLASS(x)->info
-#define  FT_CLASS__MAGIC(x)    FT_CLASS(x)->magic
-
-
- /**************************************************************
-  *
-  * @struct: FT_TypeRec
-  *
-  * @description:
-  *   a structure used to describe a given class to the FreeType
-  *   object sub-system.
-  *
-  * @fields:
-  *   name       :: class name. only used for debugging
-  *   super      :: type of super-class. NULL if none
-  *
-  *   class_size :: size of class structure in bytes
-  *   class_init :: class constructor
-  *   class_done :: class finalizer
-  *
-  *   obj_size   :: instance size in bytes
-  *   obj_init   :: instance constructor. can be NULL
-  *   obj_done   :: instance destructor. can be NULL
-  *
-  * @note:
-  *   if 'obj_init' is NULL, the class will use it's parent
-  *   constructor, if any
-  *
-  *   if 'obj_done' is NULL, the class will use it's parent
-  *   finalizer, if any
-  *
-  *   the object sub-system allocates a new class, copies
-  *   the content of its super-class into the new structure,
-  *   _then_ calls 'clazz_init'.
-  *
-  *   'class_init' and 'class_done' can be NULL, in which case
-  *   the parent's class constructor and destructor wil be used
-  */
-  typedef struct FT_TypeRec_
-  {
-    const char*         name;
-    FT_Type             super;
-
-    FT_UInt             class_size;
-    FT_Object_InitFunc  class_init;
-    FT_Object_DoneFunc  class_done;
-
-    FT_UInt             obj_size;
-    FT_Object_InitFunc  obj_init;
-    FT_Object_DoneFunc  obj_done;
-
-  } FT_TypeRec;
-
-
- /**************************************************************
-  *
-  * @macro: FT_TYPE (x)
-  *
-  * @description:
-  *   a useful macro to convert anything to a class type handle
-  *   without checks
-  */
-#define  FT_TYPE(x)  ((FT_Type)(x))
-
-
- /**************************************************************
-  *
-  * @function: ft_object_check
-  *
-  * @description:
-  *   checks that a handle points to a valid @FT_Object
-  *
-  * @input:
-  *   obj :: handle/pointer
-  *
-  * @return:
-  *   1 iff the handle points to a valid object. 0 otherwise
-  */
-  FT_BASE( FT_Int )
-  ft_object_check( FT_Pointer  obj );
-
-
- /**************************************************************
-  *
-  * @function: ft_object_is_a
-  *
-  * @description:
-  *   checks that a handle points to a valid @FT_Object that
-  *   is an instance of a given class (or of any of its sub-classes)
-  *
-  * @input:
-  *   obj   :: handle/pointer
-  *   clazz :: class handle to check
-  *
-  * @return:
-  *   1 iff the handle points to a valid 'clazz' instance. 0
-  *   otherwise.
-  */
-  FT_BASE( FT_Int )
-  ft_object_is_a( FT_Pointer  obj,
-                  FT_Class    clazz );
-
-
- /**************************************************************
-  *
-  * @function: ft_object_create
-  *
-  * @description:
-  *   create a new object (class instance)
-  *
-  * @output:
-  *   aobject   :: new object handle. NULL in case of error
-  *
-  * @input:
-  *   clazz     :: object's class pointer
-  *   init_data :: optional pointer to initialization data
-  *
-  * @return:
-  *   error code. 0 means success
-  */
-  FT_BASE( FT_Error )
-  ft_object_create( FT_Object  *aobject,
-                    FT_Class    clazz,
-                    FT_Pointer  init_data );
-
-
- /**************************************************************
-  *
-  * @function: ft_object_create_from_type
-  *
-  * @description:
-  *   create a new object (class instance) from a @FT_Type
-  *
-  * @output:
-  *   aobject   :: new object handle. NULL in case of error
-  *
-  * @input:
-  *   type      :: object's type descriptor
-  *   init_data :: optional pointer to initialization data
-  *
-  * @return:
-  *   error code. 0 means success
-  *
-  * @note:
-  *   this function is slower than @ft_object_create
-  *
-  *   this is equivalent to calling @ft_class_from_type followed by
-  *   @ft_object_create
-  */
-  FT_BASE( FT_Error )
-  ft_object_create_from_type( FT_Object  *aobject,
-                              FT_Type     type,
-                              FT_Pointer  init_data,
-                              FT_Library  library );
-
-
-
- /**************************************************************
-  *
-  * @macro FT_OBJ_CREATE (object,class,init)
-  *
-  * @description:
-  *   a convenient macro used to create new objects. see
-  *   @ft_object_create for details
-  */
-#define  FT_OBJ_CREATE( _obj, _clazz, _init )   \
-               ft_object_create( FT_OBJECT_P(&(_obj)), _clazz, _init )
-
-
- /**************************************************************
-  *
-  * @macro FT_CREATE (object,class,init)
-  *
-  * @description:
-  *   a convenient macro used to create new objects. It also
-  *   sets an _implicit_ local variable named "error" to the error
-  *   code returned by the object constructor.
-  */
-#define  FT_CREATE( _obj, _clazz, _init )  \
-             FT_SET_ERROR( FT_OBJ_CREATE( _obj, _clazz, _init ) )
-
- /**************************************************************
-  *
-  * @macro FT_OBJ_CREATE_FROM_TYPE (object,type,init)
-  *
-  * @description:
-  *   a convenient macro used to create new objects. see
-  *   @ft_object_create_from_type for details
-  */
-#define  FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib )   \
-               ft_object_create_from_type( FT_OBJECT_P(&(_obj)), _type, _init, _lib )
-
-
- /**************************************************************
-  *
-  * @macro FT_CREATE_FROM_TYPE (object,type,init)
-  *
-  * @description:
-  *   a convenient macro used to create new objects. It also
-  *   sets an _implicit_ local variable named "error" to the error
-  *   code returned by the object constructor.
-  */
-#define  FT_CREATE_FROM_TYPE( _obj, _type, _init, _lib )  \
-             FT_SET_ERROR( FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) )
-
-
- /* */
-
- /**************************************************************
-  *
-  * @function: ft_class_from_type
-  *
-  * @description:
-  *   retrieves the class object corresponding to a given type
-  *   descriptor. The class is created when needed
-  *
-  * @output:
-  *   aclass  :: handle to corresponding class object. NULL in
-  *              case of error
-  *
-  * @input:
-  *   type    :: type descriptor handle
-  *   library :: library handle
-  *
-  * @return:
-  *   error code. 0 means success
-  */
-  FT_BASE( FT_Error )
-  ft_class_from_type( FT_Class   *aclass,
-                      FT_Type     type,
-                      FT_Library  library );
-
-
- /* */
-
-#include FT_INTERNAL_HASH_H
-
-  typedef struct FT_ClassHNodeRec_*  FT_ClassHNode;
-
-  typedef struct FT_ClassHNodeRec_
-  {
-    FT_HashNodeRec  hnode;
-    FT_Type         type;
-    FT_Class        clazz;
-
-  } FT_ClassHNodeRec;
-
-  typedef struct FT_MetaClassRec_
-  {
-    FT_ClassRec   clazz;         /* the meta-class is a class itself */
-    FT_HashRec    type_to_class; /* the type => class hash table */
-
-  } FT_MetaClassRec, *FT_MetaClass;
-
-
- /* initialize meta class */
-  FT_BASE( FT_Error )
-  ft_metaclass_init( FT_MetaClass  meta,
-                     FT_Library    library );
-
- /* finalize meta class - destroy all registered class objects */
-  FT_BASE( void )
-  ft_metaclass_done( FT_MetaClass  meta );
-
- /* */
-
-FT_END_HEADER
-
-#endif /* __FT_OBJECT_H__ */

reactos/lib/freetype/include/freetype/internal
pfr.h removed after 1.2
diff -N pfr.h
--- pfr.h	21 Jan 2004 19:23:46 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  pfr.h                                                                  */
-/*                                                                         */
-/*    Internal PFR service functions (specification only).                 */
-/*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __PFR_H__
-#define __PFR_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-  typedef FT_Error  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
-                                              FT_UInt   *aoutline,
-                                              FT_UInt   *ametrics,
-                                              FT_Fixed  *ax_scale,
-                                              FT_Fixed  *ay_scale );
-
-  typedef FT_Error  (*FT_PFR_GetKerningFunc)( FT_Face     face,
-                                              FT_UInt     left,
-                                              FT_UInt     right,
-                                              FT_Vector  *avector );
-
-  typedef FT_Error  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
-                                              FT_UInt   gindex,
-                                              FT_Pos   *aadvance );
-
-
-  typedef struct  FT_PFR_ServiceRec_
-  {
-    FT_PFR_GetMetricsFunc  get_metrics;
-    FT_PFR_GetKerningFunc  get_kerning;
-    FT_PFR_GetAdvanceFunc  get_advance;
-
-  } FT_PFR_ServiceRec, *FT_PFR_Service;
-
-#define FT_PFR_SERVICE_NAME  "pfr"
-
-
-FT_END_HEADER
-
-#endif /* __PFR_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal
psnames.h removed after 1.1
diff -N psnames.h
--- psnames.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,241 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  psnames.h                                                              */
-/*                                                                         */
-/*    High-level interface for the `PSNames' module (in charge of          */
-/*    various functions related to Postscript glyph names conversion).     */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __PSNAMES_H__
-#define __PSNAMES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Unicode_Value_Func                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the Unicode index corresponding to a     */
-  /*    given glyph name.                                                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    glyph_name :: The glyph name.                                      */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The Unicode character index resp. the non-Unicode value 0xFFFF if  */
-  /*    the glyph name has no known Unicode meaning.                       */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function is able to map several different glyph names to the  */
-  /*    same Unicode value, according to the rules defined in the Adobe    */
-  /*    Glyph List table.                                                  */
-  /*                                                                       */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
-  /*                                                                       */
-  typedef FT_UInt32
-  (*PS_Unicode_Value_Func)( const char*  glyph_name );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Unicode_Index_Func                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the glyph index corresponding to a given */
-  /*    Unicode value.                                                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    num_glyphs  :: The number of glyphs in the face.                   */
-  /*                                                                       */
-  /*    glyph_names :: An array of glyph name pointers.                    */
-  /*                                                                       */
-  /*    unicode     :: The Unicode value.                                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The glyph index resp. 0xFFFF if no glyph corresponds to this       */
-  /*    Unicode value.                                                     */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function is able to recognize several glyph names per Unicode */
-  /*    value, according to the Adobe Glyph List.                          */
-  /*                                                                       */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
-  /*                                                                       */
-  typedef FT_UInt
-  (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
-                            const char**  glyph_names,
-                            FT_ULong      unicode );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Macintosh_Name_Func                                             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the glyph name corresponding to an Apple */
-  /*    glyph name index.                                                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    name_index :: The index of the Mac name.                           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The glyph name, or 0 if the index is invalid.                      */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
-  /*                                                                       */
-  typedef const char*
-  (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
-
-
-  typedef const char*
-  (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
-
-
-  typedef struct  PS_UniMap_
-  {
-    FT_UInt  unicode;
-    FT_UInt  glyph_index;
-
-  } PS_UniMap;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    PS_Unicodes                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A simple table used to map Unicode values to glyph indices.  It is */
-  /*    built by the PS_Build_Unicodes table according to the glyphs       */
-  /*    present in a font file.                                            */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    num_codes :: The number of glyphs in the font that match a given   */
-  /*                 Unicode value.                                        */
-  /*                                                                       */
-  /*    unicodes  :: An array of unicode values, sorted in increasing      */
-  /*                 order.                                                */
-  /*                                                                       */
-  /*    gindex    :: An array of glyph indices, corresponding to each      */
-  /*                 Unicode value.                                        */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Use the function PS_Lookup_Unicode() to retrieve the glyph index   */
-  /*    corresponding to a given Unicode character code.                   */
-  /*                                                                       */
-  typedef struct  PS_Unicodes_
-  {
-    FT_UInt     num_maps;
-    PS_UniMap*  maps;
-
-  } PS_Unicodes;
-
-
-  typedef FT_Error
-  (*PS_Build_Unicodes_Func)( FT_Memory     memory,
-                             FT_UInt       num_glyphs,
-                             const char**  glyph_names,
-                             PS_Unicodes*  unicodes );
-
-  typedef FT_UInt
-  (*PS_Lookup_Unicode_Func)( PS_Unicodes*  unicodes,
-                             FT_UInt       unicode );
-
-  typedef FT_ULong
-  (*PS_Next_Unicode_Func)( PS_Unicodes*  unicodes,
-                           FT_ULong      unicode );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    PSNames_Interface                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure defines the PSNames interface.                      */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    unicode_value         :: A function used to convert a glyph name   */
-  /*                             into a Unicode character code.            */
-  /*                                                                       */
-  /*    build_unicodes        :: A function which builds up the Unicode    */
-  /*                             mapping table.                            */
-  /*                                                                       */
-  /*    lookup_unicode        :: A function used to return the glyph index */
-  /*                             corresponding to a given Unicode          */
-  /*                             character.                                */
-  /*                                                                       */
-  /*    macintosh_name        :: A function used to return the standard    */
-  /*                             Apple glyph Postscript name corresponding */
-  /*                             to a given string index (used by the      */
-  /*                             TrueType `post' table).                   */
-  /*                                                                       */
-  /*    adobe_std_strings     :: A function that returns a pointer to a    */
-  /*                             Adobe Standard String for a given SID.    */
-  /*                                                                       */
-  /*    adobe_std_encoding    :: A table of 256 unsigned shorts that maps  */
-  /*                             character codes in the Adobe Standard     */
-  /*                             Encoding to SIDs.                         */
-  /*                                                                       */
-  /*    adobe_expert_encoding :: A table of 256 unsigned shorts that maps  */
-  /*                             character codes in the Adobe Expert       */
-  /*                             Encoding to SIDs.                         */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    `unicode_value' and `unicode_index' will be set to 0 if the        */
-  /*    configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is           */
-  /*    undefined.                                                         */
-  /*                                                                       */
-  /*    `macintosh_name' will be set to 0 if the configuration macro       */
-  /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
-  /*                                                                       */
-  typedef struct  PSNames_Interface_
-  {
-    PS_Unicode_Value_Func      unicode_value;
-    PS_Build_Unicodes_Func     build_unicodes;
-    PS_Lookup_Unicode_Func     lookup_unicode;
-    PS_Macintosh_Name_Func     macintosh_name;
-
-    PS_Adobe_Std_Strings_Func  adobe_std_strings;
-    const unsigned short*      adobe_std_encoding;
-    const unsigned short*      adobe_expert_encoding;
-
-    PS_Next_Unicode_Func       next_unicode;
-
-  } PSNames_Interface;
-
-
-  typedef PSNames_Interface*  PSNames_Service;
-
-
-FT_END_HEADER
-
-#endif /* __PSNAMES_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal
t42types.h removed after 1.1
diff -N t42types.h
--- t42types.h	1 Apr 2003 08:38:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,55 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  t42types.h                                                             */
-/*                                                                         */
-/*    Type 42 font data types (specification only).                        */
-/*                                                                         */
-/*  Copyright 2002 by Roberto Alameda.                                     */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __T42TYPES_H__
-#define __T42TYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-
-FT_BEGIN_HEADER
-
-
-  typedef struct  T42_FaceRec_
-  {
-    FT_FaceRec     root;
-    T1_FontRec     type1;
-    const void*    psnames;
-    const void*    psaux;
-    const void*    afm_data;
-    FT_Byte*       ttf_data;
-    FT_ULong       ttf_size;
-    FT_Face        ttf_face;
-    FT_CharMapRec  charmaprecs[2];
-    FT_CharMap     charmaps[2];
-    PS_Unicodes    unicode_map;
-
-  } T42_FaceRec, *T42_Face;
-
-
-FT_END_HEADER
-
-#endif /* __T1TYPES_H__ */
-
-
-/* END */

reactos/lib/freetype/include/freetype/internal/services
svbdf.h 1.2 -> 1.3
diff -N svbdf.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svbdf.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,57 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svbdf.h                                                                */
+/*                                                                         */
+/*    The FreeType BDF services (specification).                           */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVBDF_H__
+#define __SVBDF_H__
+
+#include FT_BDF_H
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_BDF  "bdf"
+
+  typedef FT_Error
+  (*FT_BDF_GetCharsetIdFunc)( FT_Face       face,
+                              const char*  *acharset_encoding,
+                              const char*  *acharset_registry );
+
+  typedef FT_Error
+  (*FT_BDF_GetPropertyFunc)( FT_Face           face,
+                             const char*       prop_name,
+                             BDF_PropertyRec  *aproperty );
+
+
+  FT_DEFINE_SERVICE( BDF )
+  {
+    FT_BDF_GetCharsetIdFunc  get_charset_id;
+    FT_BDF_GetPropertyFunc   get_property;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVBDF_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svgldict.h 1.2 -> 1.3
diff -N svgldict.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svgldict.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,60 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svgldict.h                                                             */
+/*                                                                         */
+/*    The FreeType glyph dictionary services (specification).              */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVGLDICT_H__
+#define __SVGLDICT_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+  /*
+   *  A service used to retrieve glyph names, as well as to find the
+   *  index of a given glyph name in a font.
+   *
+   */
+
+#define FT_SERVICE_ID_GLYPH_DICT  "glyph-dict"
+
+
+  typedef FT_Error
+  (*FT_GlyphDict_GetNameFunc)( FT_Face     face,
+                               FT_UInt     glyph_index,
+                               FT_Pointer  buffer,
+                               FT_UInt     buffer_max );
+
+  typedef FT_UInt
+  (*FT_GlyphDict_NameIndexFunc)( FT_Face     face,
+                                 FT_String*  glyph_name );
+
+
+  FT_DEFINE_SERVICE( GlyphDict )
+  {
+    FT_GlyphDict_GetNameFunc    get_name;
+    FT_GlyphDict_NameIndexFunc  name_index;  /* optional */
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVGLDICT_H__ */

reactos/lib/freetype/include/freetype/internal/services
svmm.h 1.2 -> 1.3
diff -N svmm.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svmm.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,68 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svmm.h                                                                 */
+/*                                                                         */
+/*    The FreeType Multiple Masters services (specification).              */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVMM_H__
+#define __SVMM_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+  /*
+   *  A service used to manage multiple-masters data in a given face.
+   *
+   *  See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).
+   *
+   */
+
+#define FT_SERVICE_ID_MULTI_MASTERS  "multi-masters"
+
+
+  typedef FT_Error
+  (*FT_Get_MM_Func)( FT_Face           face,
+                     FT_Multi_Master*  master );
+
+  typedef FT_Error
+  (*FT_Set_MM_Design_Func)( FT_Face   face,
+                            FT_UInt   num_coords,
+                            FT_Long*  coords );
+
+  typedef FT_Error
+  (*FT_Set_MM_Blend_Func)( FT_Face   face,
+                           FT_UInt   num_coords,
+                           FT_Long*  coords );
+
+
+  FT_DEFINE_SERVICE( MultiMasters )
+  {
+    FT_Get_MM_Func         get_mm;
+    FT_Set_MM_Design_Func  set_mm_design;
+    FT_Set_MM_Blend_Func   set_mm_blend;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+#endif /* __SVMM_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svpfr.h 1.2 -> 1.3
diff -N svpfr.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svpfr.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,65 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpfr.h                                                                */
+/*                                                                         */
+/*    Internal PFR service functions (specification).                      */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVPFR_H__
+#define __SVPFR_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_PFR_METRICS  "pfr-metrics"
+
+
+  typedef FT_Error
+  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
+                            FT_UInt   *aoutline,
+                            FT_UInt   *ametrics,
+                            FT_Fixed  *ax_scale,
+                            FT_Fixed  *ay_scale );
+
+  typedef FT_Error
+  (*FT_PFR_GetKerningFunc)( FT_Face     face,
+                            FT_UInt     left,
+                            FT_UInt     right,
+                            FT_Vector  *avector );
+
+  typedef FT_Error
+  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
+                            FT_UInt   gindex,
+                            FT_Pos   *aadvance );
+
+
+  FT_DEFINE_SERVICE( PfrMetrics )
+  {
+    FT_PFR_GetMetricsFunc  get_metrics;
+    FT_PFR_GetKerningFunc  get_kerning;
+    FT_PFR_GetAdvanceFunc  get_advance;
+
+  };
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __SVPFR_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svpostnm.h 1.2 -> 1.3
diff -N svpostnm.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svpostnm.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,58 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpostnm.h                                                             */
+/*                                                                         */
+/*    The FreeType PostScript name services (specification).               */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVPOSTNM_H__
+#define __SVPOSTNM_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+  /*
+   *  A trivial service used to retrieve the PostScript name of a given
+   *  font when available.  The `get_name' field should never be NULL.
+   *
+   *  The correponding function can return NULL to indicate that the
+   *  PostScript name is not available.
+   *
+   *  The name is owned by the face and will be destroyed with it.
+   */
+
+#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME  "postscript-font-name"
+
+
+  typedef const char*
+  (*FT_PsName_GetFunc)( FT_Face  face );
+
+
+  FT_DEFINE_SERVICE( PsFontName )
+  {
+    FT_PsName_GetFunc  get_ps_font_name;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVPOSTNM_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svpscmap.h 1.2 -> 1.3
diff -N svpscmap.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svpscmap.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,113 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpscmap.h                                                             */
+/*                                                                         */
+/*    The FreeType PostScript charmap service (specification).             */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVPSCMAP_H__
+#define __SVPSCMAP_H__
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_POSTSCRIPT_CMAPS  "postscript-cmaps"
+
+
+  /*
+   *  Adobe glyph name to unicode value
+   */
+  typedef FT_UInt32
+  (*PS_Unicode_ValueFunc)( const char*  glyph_name );
+
+  /*
+   *  Unicode value to Adobe glyph name index.  0xFFFF if not found.
+   */
+  typedef FT_UInt
+  (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
+                            const char**  glyph_names,
+                            FT_ULong      unicode );
+
+  /*
+   *  Macintosh name id to glyph name.  NULL if invalid index.
+   */
+  typedef const char*
+  (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
+
+  /*
+   *  Adobe standard string ID to glyph name.  NULL if invalid index.
+   */
+  typedef const char*
+  (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
+
+  /*
+   *  Simple unicode -> glyph index charmap built from font glyph names
+   *  table.
+   */
+  typedef struct  PS_UniMap_
+  {
+    FT_UInt  unicode;
+    FT_UInt  glyph_index;
+
+  } PS_UniMap;
+
+
+  typedef struct  PS_Unicodes_
+  {
+    FT_UInt     num_maps;
+    PS_UniMap*  maps;
+
+  } PS_Unicodes;
+
+
+  typedef FT_Error
+  (*PS_Unicodes_InitFunc)( FT_Memory     memory,
+                           FT_UInt       num_glyphs,
+                           const char**  glyph_names,
+                           PS_Unicodes*  unicodes );
+
+  typedef FT_UInt
+  (*PS_Unicodes_CharIndexFunc)( PS_Unicodes*  unicodes,
+                                FT_UInt       unicode );
+
+  typedef FT_ULong
+  (*PS_Unicodes_CharNextFunc)( PS_Unicodes*  unicodes,
+                               FT_ULong      unicode );
+
+
+  FT_DEFINE_SERVICE( PsCMaps )
+  {
+    PS_Unicode_ValueFunc       unicode_value;
+
+    PS_Unicodes_InitFunc       unicodes_init;
+    PS_Unicodes_CharIndexFunc  unicodes_char_index;
+    PS_Unicodes_CharNextFunc   unicodes_char_next;
+
+    PS_Macintosh_Name_Func     macintosh_name;
+    PS_Adobe_Std_Strings_Func  adobe_std_strings;
+    const unsigned short*      adobe_std_encoding;
+    const unsigned short*      adobe_expert_encoding;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVPSCMAP_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svpsinfo.h 1.2 -> 1.3
diff -N svpsinfo.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svpsinfo.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,55 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpsinfo.h                                                             */
+/*                                                                         */
+/*    The FreeType PostScript info service (specification).                */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVPSINFO_H__
+#define __SVPSINFO_H__
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_POSTSCRIPT_INFO  "postscript-info"
+
+
+  typedef FT_Error
+  (*PS_GetFontInfoFunc)( FT_Face          face,
+                         PS_FontInfoRec*  afont_info );
+
+  typedef FT_Int
+  (*PS_HasGlyphNamesFunc)( FT_Face   face );
+
+
+  FT_DEFINE_SERVICE( PsInfo )
+  {
+    PS_GetFontInfoFunc    ps_get_font_info;
+    PS_HasGlyphNamesFunc  ps_has_glyph_names;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVPSINFO_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svsfnt.h 1.2 -> 1.3
diff -N svsfnt.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svsfnt.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,69 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svsfnt.h                                                               */
+/*                                                                         */
+/*    The FreeType PostScript name services (specification).               */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVSFNT_H__
+#define __SVSFNT_H__
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_TRUETYPE_TABLES_H
+
+
+FT_BEGIN_HEADER
+
+
+  /*
+   *  SFNT table loading service.
+   */
+
+#define FT_SERVICE_ID_SFNT_TABLE  "sfnt-table"
+
+
+  /*
+   * Used to implement FT_Load_Sfnt_Table().
+   */
+  typedef FT_Error
+  (*FT_SFNT_TableLoadFunc)( FT_Face    face,
+                            FT_ULong   tag,
+                            FT_Long    offset,
+                            FT_Byte*   buffer,
+                            FT_ULong*  length );
+
+  /*
+   * Used to implement FT_Get_Sfnt_Table().
+   */
+  typedef void*
+  (*FT_SFNT_TableGetFunc)( FT_Face      face,
+                           FT_Sfnt_Tag  tag );
+
+ 
+  FT_DEFINE_SERVICE( SFNT_Table )
+  {
+    FT_SFNT_TableLoadFunc  load_table;
+    FT_SFNT_TableGetFunc   get_table;
+  };
+
+  /* */
+
+ 
+FT_END_HEADER
+
+
+#endif /* __SVSFNT_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svttcmap.h 1.2 -> 1.3
diff -N svttcmap.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svttcmap.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,77 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svsttcmap.h                                                            */
+/*                                                                         */
+/*    The FreeType TrueType/sfnt cmap extra information service.           */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  Masatake YAMATO, Redhat K.K.                                           */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+/* Development of this service is support of 
+   Information-technology Promotion Agency, Japan. */
+
+#ifndef __SVTTCMAP_H__
+#define __SVTTCMAP_H__ 
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_TRUETYPE_TABLES_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    TT_CMapInfo                                                        */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A structure used to store TrueType/sfnt specific cmap information  */
+  /*    which is not covered by the generic @FT_CharMap structure.  This   */
+  /*    structure can be accessed with the @FT_Get_TT_CMap_Info function.  */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    language ::                                                        */
+  /*      The language ID used in Mac fonts.  Definitions of values are in */
+  /*      freetype/ttnameid.h.                                             */
+  /*                                                                       */
+  typedef struct  TT_CMapInfo_
+  {
+    FT_ULong language;
+
+  } TT_CMapInfo;
+
+
+  typedef FT_Error
+  (*TT_CMap_Info_GetFunc)( FT_CharMap    charmap,
+                           TT_CMapInfo  *cmap_info );
+
+
+  FT_DEFINE_SERVICE( TTCMaps )
+  {
+    TT_CMap_Info_GetFunc  get_cmap_info;
+  }; 
+  
+  /* */
+
+
+FT_END_HEADER
+
+#endif /* __SVTTCMAP_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svwinfnt.h 1.2 -> 1.3
diff -N svwinfnt.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svwinfnt.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,50 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svwinfnt.h                                                             */
+/*                                                                         */
+/*    The FreeType Windows FNT/FONT service (specification).               */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVWINFNT_H__
+#define __SVWINFNT_H__
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_WINFONTS_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_WINFNT  "winfonts"
+
+  typedef FT_Error
+  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,
+                              FT_WinFNT_HeaderRec  *aheader );
+
+
+  FT_DEFINE_SERVICE( WinFnt )
+  {
+    FT_WinFnt_GetHeaderFunc  get_header;
+  };
+
+  /* */
+
+
+FT_END_HEADER
+
+
+#endif /* __SVWINFNT_H__ */
+
+
+/* END */

reactos/lib/freetype/include/freetype/internal/services
svxf86nm.h 1.2 -> 1.3
diff -N svxf86nm.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ svxf86nm.h	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,55 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svxf86nm.h                                                             */
+/*                                                                         */
+/*    The FreeType XFree86 services (specification only).                  */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __SVXF86NM_H__
+#define __SVXF86NM_H__
+
+#include FT_INTERNAL_SERVICE_H
+
+
+FT_BEGIN_HEADER
+
+
+  /*
+   *  A trivial service used to return the name of a face's font driver,
+   *  according to the XFree86 nomenclature.  Note that the service data
+   *  is a simple constant string pointer.
+   */
+
+#define FT_SERVICE_ID_XF86_NAME  "xf86-driver-name"
+
+#define FT_XF86_FORMAT_TRUETYPE  "TrueType"
+#define FT_XF86_FORMAT_TYPE_1    "Type 1"
+#define FT_XF86_FORMAT_BDF       "BDF"
+#define FT_XF86_FORMAT_PCF       "PCF"
+#define FT_XF86_FORMAT_TYPE_42   "Type 42"
+#define FT_XF86_FORMAT_CID       "CID Type 1"
+#define FT_XF86_FORMAT_CFF       "CFF"
+#define FT_XF86_FORMAT_PFR       "PFR"
+#define FT_XF86_FORMAT_WINFNT    "Windows FNT"
+
+  /* */
+
+ 
+FT_END_HEADER
+
+
+#endif /* __SVXF86NM_H__ */
+
+
+/* END */

reactos/lib/freetype/src/autofit
Jamfile 1.2 -> 1.3
diff -N Jamfile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Jamfile	10 May 2004 17:48:28 -0000	1.3
@@ -0,0 +1,18 @@
+SubDir FT2_TOP src autofit ;
+
+{
+  local  _sources ;
+
+  if $(FT2_MULTI)
+  {
+    _sources = afangles afglobal afhints aflatin afloader afmodule afdummy ;
+  }
+  else
+  {
+    _sources = autofit ;
+  }
+
+  Library  $(FT2_LIB) : $(_sources).c ;
+}
+
+# end of src/autofir Jamfile

reactos/lib/freetype/src/autofit
afangles.c 1.2 -> 1.3
diff -N afangles.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afangles.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,214 @@
+#include "aftypes.h"
+
+  /* this table was generated for AF_ANGLE_PI = 256 */
+#define AF_ANGLE_MAX_ITERS  8
+#define AF_TRIG_MAX_ITERS   9
+
+  static const FT_Fixed
+  af_angle_arctan_table[9] =
+  {
+    90, 64, 38, 20, 10, 5, 3, 1, 1
+  };
+
+
+  static FT_Int
+  af_angle_prenorm( FT_Vector*  vec )
+  {
+    FT_Fixed  x, y, z;
+    FT_Int    shift;
+
+
+    x = vec->x;
+    y = vec->y;
+
+    z     = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y );
+    shift = 0;
+
+    if ( z < ( 1L << 27 ) )
+    {
+      do
+      {
+        shift++;
+        z <<= 1;
+      } while ( z < ( 1L << 27 ) );
+
+      vec->x = x << shift;
+      vec->y = y << shift;
+    }
+    else if ( z > ( 1L << 28 ) )
+    {
+      do
+      {
+        shift++;
+        z >>= 1;
+      } while ( z > ( 1L << 28 ) );
+
+      vec->x = x >> shift;
+      vec->y = y >> shift;
+      shift  = -shift;
+    }
+    return shift;
+  }
+
+
+  static void
+  af_angle_pseudo_polarize( FT_Vector*  vec )
+  {
+    FT_Fixed         theta;
+    FT_Fixed         yi, i;
+    FT_Fixed         x, y;
+    const FT_Fixed  *arctanptr;
+
+
+    x = vec->x;
+    y = vec->y;
+
+    /* Get the vector into the right half plane */
+    theta = 0;
+    if ( x < 0 )
+    {
+      x = -x;
+      y = -y;
+      theta = 2 * AF_ANGLE_PI2;
+    }
+
+    if ( y > 0 )
+      theta = - theta;
+
+    arctanptr = af_angle_arctan_table;
+
+    if ( y < 0 )
+    {
+      /* Rotate positive */
+      yi     = y + ( x << 1 );
+      x      = x - ( y << 1 );
+      y      = yi;
+      theta -= *arctanptr++;  /* Subtract angle */
+    }
+    else
+    {
+      /* Rotate negative */
+      yi     = y - ( x << 1 );
+      x      = x + ( y << 1 );
+      y      = yi;
+      theta += *arctanptr++;  /* Add angle */
+    }
+
+    i = 0;
+    do
+    {
+      if ( y < 0 )
+      {
+        /* Rotate positive */
+        yi     = y + ( x >> i );
+        x      = x - ( y >> i );
+        y      = yi;
+        theta -= *arctanptr++;
+      }
+      else
+      {
+        /* Rotate negative */
+        yi     = y - ( x >> i );
+        x      = x + ( y >> i );
+        y      = yi;
+        theta += *arctanptr++;
+      }
+    } while ( ++i < AF_TRIG_MAX_ITERS );
+
+    /* round theta */
+    if ( theta >= 0 )
+      theta = FT_PAD_ROUND( theta, 4 );
+    else
+      theta = - FT_PAD_ROUND( theta, 4 );
+
+    vec->x = x;
+    vec->y = theta;
+  }
+
+
+  /* documentation is in fttrigon.h */
+
+  FT_LOCAL_DEF( AF_Angle )
+  af_angle_atan( FT_Fixed  dx,
+                 FT_Fixed  dy )
+  {
+    FT_Vector  v;
+
+
+    if ( dx == 0 && dy == 0 )
+      return 0;
+
+    v.x = dx;
+    v.y = dy;
+    af_angle_prenorm( &v );
+    af_angle_pseudo_polarize( &v );
+
+    return v.y;
+  }
+
+
+
+  FT_LOCAL_DEF( AF_Angle )
+  af_angle_diff( AF_Angle  angle1,
+                 AF_Angle  angle2 )
+  {
+    AF_Angle  delta = angle2 - angle1;
+
+    delta %= AF_ANGLE_2PI;
+    if ( delta < 0 )
+      delta += AF_ANGLE_2PI;
+
+    if ( delta > AF_ANGLE_PI )
+      delta -= AF_ANGLE_2PI;
+
+    return delta;
+  }
+
+
+ /* well, this needs to be somewhere, right :-)
+  */
+
+  FT_LOCAL_DEF( void )
+  af_sort_pos( FT_UInt   count,
+               FT_Pos*   table )
+  {
+    FT_UInt  i, j;
+    FT_Pos   swap;
+
+
+    for ( i = 1; i < count; i++ )
+    {
+      for ( j = i; j > 0; j-- )
+      {
+        if ( table[j] > table[j - 1] )
+          break;
+
+        swap         = table[j];
+        table[j]     = table[j - 1];
+        table[j - 1] = swap;
+      }
+    }
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_sort_widths( FT_UInt   count,
+                  AF_Width  table )
+  {
+    FT_UInt      i, j;
+    AF_WidthRec  swap;
+
+
+    for ( i = 1; i < count; i++ )
+    {
+      for ( j = i; j > 0; j-- )
+      {
+        if ( table[j].org > table[j - 1].org )
+          break;
+
+        swap         = table[j];
+        table[j]     = table[j - 1];
+        table[j - 1] = swap;
+      }
+    }
+  }

reactos/lib/freetype/src/autofit
afdummy.c added at 1.1
diff -N afdummy.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afdummy.c	10 May 2004 17:48:29 -0000	1.1
@@ -0,0 +1,35 @@
+#include "afdummy.h"
+
+
+  static FT_Error
+  af_dummy_hints_init( AF_GlyphHints     hints,
+                       FT_Outline*       outline,
+                       AF_ScriptMetrics  metrics )
+  {
+    return af_glyph_hints_reset( hints,
+                                 &metrics->scaler,
+                                 metrics,
+                                 outline );
+  }
+
+  static FT_Error
+  af_dummy_hints_apply( AF_GlyphHints  hints,
+                        FT_Outline*    outline )
+  {
+    af_glyph_hints_save( hints, outline );
+  }
+
+
+  FT_LOCAL_DEF( const AF_ScriptClassRec )  af_dummy_script_class =
+  {
+    AF_SCRIPT_NONE,
+    NULL,
+
+    sizeof( AF_ScriptMetricsRec ),
+    (AF_Script_InitMetricsFunc)  NULL,
+    (AF_Script_ScaleMetricsFunc) NULL,
+    (AF_Script_DoneMetricsFunc)  NULL,
+
+    (AF_Script_InitHintsFunc)    af_dummy_hints_init,
+    (AF_Script_ApplyHintsFunc)   af_dummy_hints_apply
+  };

reactos/lib/freetype/src/autofit
afdummy.h added at 1.1
diff -N afdummy.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afdummy.h	10 May 2004 17:48:29 -0000	1.1
@@ -0,0 +1,18 @@
+#ifndef __AFDUMMY_H__
+#define __AFDUMMY_H__
+
+#include "aftypes.h"
+
+FT_BEGIN_HEADER
+
+ /* a dummy script metrics class used when no hinting should
+  * be performed. This is the default for non-latin glyphs !
+  */
+
+  FT_LOCAL( const AF_ScriptClassRec )    af_dummy_script_class;
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AFDUMMY_H__ */

reactos/lib/freetype/src/autofit
afglobal.c 1.2 -> 1.3
diff -N afglobal.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afglobal.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,236 @@
+#include "afglobal.h"
+#include "afdummy.h"
+#include "aflatin.h"
+
+ /* populate this list when you add new scripts
+  */
+  static AF_ScriptClass const   af_script_classes[] =
+  {
+    & af_dummy_script_class,
+    & af_latin_script_class,
+
+    NULL  /* do not remove */
+  };
+
+#define AF_SCRIPT_LIST_DEFAULT   0    /* index of default script in 'af_script_classes' */
+#define AF_SCRIPT_LIST_NONE      255  /* indicates an uncovered glyph                      */
+
+ /*
+  *  note that glyph_scripts[] is used to map each glyph into
+  *  an index into the 'af_script_classes' array.
+  *
+  */
+  typedef struct AF_FaceGlobalsRec_
+  {
+    FT_Face            face;
+    FT_UInt            glyph_count;    /* same as face->num_glyphs     */
+    FT_Byte*           glyph_scripts;
+
+    AF_ScriptMetrics   metrics[ AF_SCRIPT_MAX ];
+
+  } AF_FaceGlobalsRec;
+
+
+
+
+ /* this function is used to compute the script index of each glyph
+  * within a given face
+  */
+  static FT_Error
+  af_face_globals_compute_script_coverage( AF_FaceGlobals  globals )
+  {
+    FT_Error    error       = 0;
+    FT_Face     face        = globals->face;
+    FT_CharMap  old_charmap = face->charmap;
+    FT_Byte*    gscripts    = globals->glyph_scripts;
+    FT_UInt     ss;
+
+   /* the value 255 means "uncovered glyph"
+    */
+    FT_MEM_SET( globals->glyph_scripts,
+                AF_SCRIPT_LIST_NONE,
+                globals->glyph_count );
+
+    error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
+    if ( error )
+    {
+     /* ignore this error, we'll simply use Latin as the standard
+      * script. XXX: Shouldn't we rather disable hinting ??
+      */
+      error = 0;
+      goto Exit;
+    }
+
+   /* scan each script in a Unicode charmap
+    */
+    for ( ss = 0; af_script_classes[ss]; ss++ )
+    {
+      AF_ScriptClass      clazz = af_script_classes[ss];
+      AF_Script_UniRange  range;
+
+      if ( clazz->script_uni_ranges == NULL )
+        continue;
+
+     /* scan all unicode points in the range, and set the corresponding
+      * glyph script index
+      */
+      for ( range = clazz->script_uni_ranges; range->first != 0; range++ )
+      {
+        FT_ULong  charcode = range->first;
+        FT_UInt   gindex;
+
+        gindex = FT_Get_Char_Index( face, charcode );
+
+        if ( gindex != 0                               &&
+             gindex < globals->glyph_count             &&
+             gscripts[ gindex ] == AF_SCRIPT_LIST_NONE )
+        {
+          gscripts[ gindex ] = (FT_Byte) ss;
+        }
+        for (;;)
+        {
+          charcode = FT_Get_Next_Char( face, charcode, &gindex );
+
+          if ( gindex == 0 || charcode > range->last )
+            break;
+
+          if ( gindex < globals->glyph_count       &&
+               gscripts[ gindex ] == AF_SCRIPT_LIST_NONE )
+          {
+            gscripts[ gindex ] = (FT_Byte) ss;
+          }
+        }
+      }
+    }
+
+  Exit:
+   /* by default, all uncovered glyphs are set to the latin script
+    * XXX: shouldnt' we disable hinting or do something similar ?
+    */
+    {
+      FT_UInt  nn;
+
+      for ( nn = 0; nn < globals->glyph_count; nn++ )
+      {
+        if ( gscripts[ nn ] == AF_SCRIPT_LIST_NONE )
+          gscripts[ nn ] = AF_SCRIPT_LIST_DEFAULT;
+      }
+    }
+
+    FT_Set_Charmap( face, old_charmap );
+    return error;
+  }
+
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_face_globals_new( FT_Face          face,
+                       AF_FaceGlobals  *aglobals )
+  {
+    FT_Error        error;
+    FT_Memory       memory;
+    AF_FaceGlobals  globals;
+
+    memory = face->memory;
+
+    if ( !FT_ALLOC( globals, sizeof(*globals) +
+                             face->num_glyphs*sizeof(FT_Byte) ) )
+    {
+      globals->face          = face;
+      globals->glyph_count   = face->num_glyphs;
+      globals->glyph_scripts = (FT_Byte*)( globals+1 );
+
+      error = af_face_globals_compute_script_coverage( globals );
+      if ( error )
+      {
+        af_face_globals_free( globals );
+        globals = NULL;
+      }
+    }
+
+    *aglobals = globals;
+    return error;
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_face_globals_free( AF_FaceGlobals  globals )
+  {
+    if ( globals )
+    {
+      FT_Memory  memory = globals->face->memory;
+      FT_UInt    nn;
+
+      for ( nn = 0; nn < AF_SCRIPT_MAX; nn++ )
+      {
+        if ( globals->metrics[nn] )
+        {
+          AF_ScriptClass  clazz = af_script_classes[nn];
+
+          FT_ASSERT( globals->metrics[nn]->clazz == clazz );
+
+          if ( clazz->script_metrics_done )
+            clazz->script_metrics_done( globals->metrics[nn] );
+
+          FT_FREE( globals->metrics[nn] );
+        }
+      }
+
+      globals->glyph_count   = 0;
+      globals->glyph_scripts = NULL;  /* no need to free this one !! */
+      globals->face          = NULL;
+      FT_FREE( globals );
+    }
+  }
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_face_globals_get_metrics( AF_FaceGlobals     globals,
+                               FT_UInt            gindex,
+                               AF_ScriptMetrics  *ametrics )
+  {
+    AF_ScriptMetrics  metrics = NULL;
+    FT_UInt           index;
+    AF_ScriptClass    clazz;
+    FT_Error          error = 0;
+
+    if ( gindex >= globals->glyph_count )
+    {
+      error = FT_Err_Invalid_Argument;
+      goto Exit;
+    }
+
+    index   = globals->glyph_scripts[ gindex ];
+    clazz   = af_script_classes[ index ];
+    metrics = globals->metrics[ clazz->script ];
+    if ( metrics == NULL )
+    {
+     /* create the global metrics object when needed
+      */
+      FT_Memory  memory = globals->face->memory;
+
+      if ( FT_ALLOC( metrics, clazz->script_metrics_size ) )
+        goto Exit;
+
+      metrics->clazz = clazz;
+
+      if ( clazz->script_metrics_init )
+      {
+        error = clazz->script_metrics_init( metrics, globals->face );
+        if ( error )
+        {
+          if ( clazz->script_metrics_done )
+            clazz->script_metrics_done( metrics );
+
+          FT_FREE( metrics );
+          goto Exit;
+        }
+      }
+
+      globals->metrics[ clazz->script ] = metrics;
+    }
+
+  Exit:
+    *ametrics = metrics;
+    return error;
+  }

reactos/lib/freetype/src/autofit
afglobal.h 1.2 -> 1.3
diff -N afglobal.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afglobal.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,41 @@
+#ifndef __AF_GLOBAL_H__
+#define __AF_GLOBAL_H__
+
+#include "aftypes.h"
+
+FT_BEGIN_HEADER
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                F A C E   G L O B A L S                         *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+
+ /*
+  *  models the global hints data for a given face, decomposed into
+  *  script-specific items..
+  *
+  */
+  typedef struct AF_FaceGlobalsRec_*   AF_FaceGlobals;
+
+
+  FT_LOCAL( FT_Error )
+  af_face_globals_new( FT_Face          face,
+                       AF_FaceGlobals  *aglobals );
+
+  FT_LOCAL( FT_Error )
+  af_face_globals_get_metrics( AF_FaceGlobals     globals,
+                               FT_UInt            gindex,
+                               AF_ScriptMetrics  *ametrics );
+
+  FT_LOCAL( void )
+  af_face_globals_free( AF_FaceGlobals  globals );
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __AF_GLOBALS_H__ */

reactos/lib/freetype/src/autofit
afhints.c 1.2 -> 1.3
diff -N afhints.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afhints.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,986 @@
+#include "afhints.h"
+
+#ifdef AF_DEBUG
+
+#include <stdio.h>
+
+  static const char* af_dir_str( AF_Direction  dir )
+  {
+    const char*  result;
+
+    switch (dir)
+    {
+     case AF_DIR_UP: result = "up"; break;
+     case AF_DIR_DOWN: result = "down"; break;
+     case AF_DIR_LEFT: result = "left"; break;
+     case AF_DIR_RIGHT: result = "right"; break;
+     default: result = "none";
+    }
+    return result;
+  }
+
+#define  AF_INDEX_NUM(ptr,base)  ( (ptr) ? ((ptr)-(base)) : -1 )
+
+  void
+  af_glyph_hints_dump_points( AF_GlyphHints  hints )
+  {
+    AF_Point  points = hints->points;
+    AF_Point  limit  = points + hints->num_points;
+    AF_Point  point;
+
+    printf( "Table of points:\n" );
+    printf(   "  [ index |  xorg |  yorg |  xscale |  yscale |  xfit  |  yfit  |  flags ]\n" );
+    for ( point = points; point < limit; point++ )
+    {
+      printf( "  [ %5d | %5d | %5d | %-5.2f | %-5.2f | %-5.2f | %-5.2f | %c%c%c%c%c%c ]\n",
+              point - points,
+              point->fx,
+              point->fy,
+              point->ox/64.0,
+              point->oy/64.0,
+              point->x/64.0,
+              point->y/64.0,
+              (point->flags & AF_FLAG_WEAK_INTERPOLATION) ? 'w' : ' ',
+              (point->flags & AF_FLAG_INFLECTION)         ? 'i' : ' ',
+              (point->flags & AF_FLAG_EXTREMA_X)          ? '<' : ' ',
+              (point->flags & AF_FLAG_EXTREMA_Y)          ? 'v' : ' ',
+              (point->flags & AF_FLAG_ROUND_X)            ? '(' : ' ',
+              (point->flags & AF_FLAG_ROUND_Y)            ? 'u' : ' '
+            );
+    }
+    printf( "\n" );
+  }
+
+
+  /* A function used to dump the array of linked segments */
+  void
+  af_glyph_hints_dump_segments( AF_GlyphHints  hints )
+  {
+    AF_Point    points = hints->points;
+    FT_Int      dimension;
+
+    for ( dimension = 1; dimension >= 0; dimension-- )
+    {
+      AF_AxisHints  axis = &hints->axis[dimension];
+      AF_Segment    segments = axis->segments;
+      AF_Segment    limit    = segments + axis->num_segments;
+      AF_Segment    seg;
+
+
+      printf ( "Table of %s segments:\n",
+               dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" );
+      printf ( "  [ index |  pos |  dir  | link | serif |"
+               " numl | first | start ]\n" );
+
+      for ( seg = segments; seg < limit; seg++ )
+      {
+        printf ( "  [ %5d | %4d | %5s | %4d | %5d | %4d | %5d | %5d ]\n",
+                 seg - segments,
+                 (int)seg->pos,
+                 af_dir_str( seg->dir ),
+                 AF_INDEX_NUM( seg->link, segments ),
+                 AF_INDEX_NUM( seg->serif, segments ),
+                 (int)seg->num_linked,
+                 seg->first - points,
+                 seg->last - points );
+      }
+      printf( "\n" );
+    }
+  }
+
+
+  void
+  af_glyph_hints_dump_edges( AF_GlyphHints  hints )
+  {
+    FT_Int      dimension;
+
+    for ( dimension = 1; dimension >= 0; dimension-- )
+    {
+      AF_AxisHints  axis  = &hints->axis[ dimension ];
+      AF_Edge       edges = axis->edges;
+      AF_Edge       limit = edges + axis->num_edges;
+      AF_Edge       edge;
+
+     /* note: AF_DIMENSION_HORZ corresponds to _vertical_ edges
+      * since they have constant X coordinate
+      */
+      printf ( "Table of %s edges:\n",
+               dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" );
+      printf ( "  [ index |  pos |  dir  | link |"
+               " serif | blue | opos  |  pos  ]\n" );
+
+      for ( edge = edges; edge < limit; edge++ )
+      {
+        printf ( "  [ %5d | %4d | %5s | %4d | %5d |  %c  | %5.2f | %5.2f ]\n",
+                 edge - edges,
+                 (int)edge->fpos,
+                 af_dir_str( edge->dir ),
+                 AF_INDEX_NUM( edge->link, edges ),
+                 AF_INDEX_NUM( edge->serif, edges ),
+                 edge->blue_edge ? 'y' : 'n',
+                 edge->opos / 64.0,
+                 edge->pos / 64.0 );
+      }
+
+      printf( "\n" );
+    }
+  }
+
+
+
+#endif /* AF_DEBUG */
+
+
+  /* compute the direction value of a given vector */
+  FT_LOCAL_DEF( AF_Direction )
+  af_direction_compute( FT_Pos  dx,
+                        FT_Pos  dy )
+  {
+    AF_Direction  dir;
+    FT_Pos        ax = FT_ABS( dx );
+    FT_Pos        ay = FT_ABS( dy );
+
+
+    dir = AF_DIR_NONE;
+
+    /* atan(1/12) == 4.7 degrees */
+
+    /* test for vertical direction */
+    if ( ax * 12 < ay )
+    {
+      dir = dy > 0 ? AF_DIR_UP : AF_DIR_DOWN;
+    }
+    /* test for horizontal direction */
+    else if ( ay * 12 < ax )
+    {
+      dir = dx > 0 ? AF_DIR_RIGHT : AF_DIR_LEFT;
+    }
+
+    return dir;
+  }
+
+
+  /* compute all inflex points in a given glyph */
+  static void
+  af_glyph_hints_compute_inflections( AF_GlyphHints  hints )
+  {
+    AF_Point*  contour       = hints->contours;
+    AF_Point*  contour_limit = contour + hints->num_contours;
+
+
+    /* do each contour separately */
+    for ( ; contour < contour_limit; contour++ )
+    {
+      AF_Point   point = contour[0];
+      AF_Point   first = point;
+      AF_Point   start = point;
+      AF_Point   end   = point;
+      AF_Point   before;
+      AF_Point   after;
+      AF_Angle   angle_in, angle_seg, angle_out;
+      AF_Angle   diff_in, diff_out;
+      FT_Int     finished = 0;
+
+
+      /* compute first segment in contour */
+      first = point;
+
+      start = end = first;
+      do
+      {
+        end = end->next;
+        if ( end == first )
+          goto Skip;
+
+      } while ( end->fx == first->fx && end->fy == first->fy );
+
+      angle_seg = af_angle_atan( end->fx - start->fx,
+                                 end->fy - start->fy );
+
+      /* extend the segment start whenever possible */
+      before = start;
+      do
+      {
+        do
+        {
+          start  = before;
+          before = before->prev;
+          if ( before == first )
+            goto Skip;
+
+        } while ( before->fx == start->fx && before->fy == start->fy );
+
+        angle_in = af_angle_atan( start->fx - before->fx,
+                                  start->fy - before->fy );
+
+      } while ( angle_in == angle_seg );
+
+      first   = start;
+      diff_in = af_angle_diff( angle_in, angle_seg );
+
+      /* now, process all segments in the contour */
+      do
+      {
+        /* first, extend current segment's end whenever possible */
+        after = end;
+        do
+        {
+          do
+          {
+            end   = after;
+            after = after->next;
+            if ( after == first )
+              finished = 1;
+
+          } while ( end->fx == after->fx && end->fy == after->fy );
+
+          angle_out = af_angle_atan( after->fx - end->fx,
+                                     after->fy - end->fy );
+
+        } while ( angle_out == angle_seg );
+
+        diff_out = af_angle_diff( angle_seg, angle_out );
+
+        if ( ( diff_in ^ diff_out ) < 0 )
+        {
+          /* diff_in and diff_out have different signs, we have */
+          /* inflection points here...                          */
+          do
+          {
+            start->flags |= AF_FLAG_INFLECTION;
+            start = start->next;
+
+          } while ( start != end );
+
+          start->flags |= AF_FLAG_INFLECTION;
+        }
+
+        start     = end;
+        end       = after;
+        angle_seg = angle_out;
+        diff_in   = diff_out;
+
+      } while ( !finished );
+
+    Skip:
+      ;
+    }
+  }
+
+
+
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_init( AF_GlyphHints  hints,
+                       FT_Memory      memory )
+  {
+    FT_ZERO( hints );
+    hints->memory = memory;
+  }
+
+
+
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_done( AF_GlyphHints  hints )
+  {
+    if ( hints && hints->memory )
+    {
+      FT_Memory     memory = hints->memory;
+      AF_Dimension  dim;
+
+     /* note that we don't need to free the segment and edge
+      * buffers, since they're really within the hints->points array
+      */
+      for ( dim = 0; dim < 2; dim++ )
+      {
+        AF_AxisHints  axis = &hints->axis[ dim ];
+
+        axis->num_segments = 0;
+        axis->num_edges    = 0;
+        axis->segments     = NULL;
+        axis->edges        = NULL;
+      }
+
+      FT_FREE( hints->contours );
+      hints->max_contours = 0;
+      hints->num_contours = 0;
+
+      FT_FREE( hints->points );
+      hints->num_points = 0;
+      hints->max_points = 0;
+
+      hints->memory = NULL;
+    }
+  }
+
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_glyph_hints_reset( AF_GlyphHints     hints,
+                        AF_Scaler         scaler,
+                        AF_ScriptMetrics  metrics,
+                        FT_Outline*       outline )
+  {
+    FT_Error     error        = FT_Err_Ok;
+    AF_Point     points;
+    FT_UInt      old_max, new_max;
+    FT_Fixed     x_scale = scaler->x_scale;
+    FT_Fixed     y_scale = scaler->y_scale;
+    FT_Pos       x_delta = scaler->x_delta;
+    FT_Pos       y_delta = scaler->y_delta;
+    FT_Memory    memory  = hints->memory;
+
+    hints->metrics = metrics;
+
+    hints->scaler_flags = scaler->flags;
+    hints->other_flags  = 0;
+
+    hints->num_points    = 0;
+    hints->num_contours  = 0;
+
+    hints->axis[0].num_segments = 0;
+    hints->axis[0].num_edges    = 0;
+    hints->axis[1].num_segments = 0;
+    hints->axis[1].num_edges    = 0;
+
+   /* first of all, reallocate the contours array when necessary
+    */
+    new_max = (FT_UInt) outline->n_contours;
+    old_max = hints->max_contours;
+    if ( new_max > old_max )
+    {
+      new_max = (new_max + 3) & ~3;
+
+      if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) )
+        goto Exit;
+
+      hints->max_contours = new_max;
+    }
+
+   /* then, reallocate the points, segments & edges arrays if needed --
+    * note that we reserved two additional point positions, used to
+    * hint metrics appropriately
+    */
+    new_max = (FT_UInt)( outline->n_points + 2 );
+    old_max = hints->max_points;
+    if ( new_max > old_max )
+    {
+      FT_Byte*    items;
+      FT_ULong    off1, off2, off3;
+
+     /* we store in a single buffer the following arrays:
+      *
+      *  - an array of   N  AF_PointRec   items
+      *  - an array of 2*N  AF_SegmentRec items
+      *  - an array of 2*N  AF_EdgeRec    items
+      *
+      */
+
+      new_max = ( new_max + 2 + 7 ) & ~7;
+
+#define OFF_PAD2(x,y)   (((x)+(y)-1) & ~((y)-1))
+#define OFF_PADX(x,y)   ((((x)+(y)-1)/(y))*(y))
+#define OFF_PAD(x,y)    ( ((y) & ((y)-1)) ? OFF_PADX(x,y) : OFF_PAD2(x,y) )
+
+#undef  OFF_INCREMENT
+#define OFF_INCREMENT( _off, _type, _count )   \
+     ( OFF_PAD( _off, sizeof(_type) ) + (_count)*sizeof(_type))
+
+      off1 = OFF_INCREMENT( 0, AF_PointRec, new_max );
+      off2 = OFF_INCREMENT( off1, AF_SegmentRec, new_max*2 );
+      off3 = OFF_INCREMENT( off2, AF_EdgeRec, new_max*2 );
+
+      FT_FREE( hints->points );
+
+      if ( FT_ALLOC( items, off3 ) )
+      {
+        hints->max_points       = 0;
+        hints->axis[0].segments = NULL;
+        hints->axis[0].edges    = NULL;
+        hints->axis[1].segments = NULL;
+        hints->axis[1].edges    = NULL;
+        goto Exit;
+      }
+
+     /* readjust some pointers
+      */
+      hints->max_points       = new_max;
+      hints->points           = (AF_Point) items;
+
+      hints->axis[0].segments = (AF_Segment)( items + off1 );
+      hints->axis[1].segments = hints->axis[0].segments + new_max;
+
+      hints->axis[0].edges    = (AF_Edge)   ( items + off2 );
+      hints->axis[1].edges    = hints->axis[0].edges + new_max;
+    }
+
+    hints->num_points   = outline->n_points;
+    hints->num_contours = outline->n_contours;
+
+
+    /* We can't rely on the value of `FT_Outline.flags' to know the fill  */
+    /* direction used for a glyph, given that some fonts are broken (e.g. */
+    /* the Arphic ones).  We thus recompute it each time we need to.      */
+    /*                                                                    */
+    hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_UP;
+    hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_LEFT;
+
+    if ( FT_Outline_Get_Orientation( outline ) == FT_ORIENTATION_POSTSCRIPT )
+    {
+      hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_DOWN;
+      hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_RIGHT;
+    }
+
+    hints->x_scale = x_scale;
+    hints->y_scale = y_scale;
+    hints->x_delta = x_delta;
+    hints->y_delta = y_delta;
+
+    points = hints->points;
+    if ( hints->num_points == 0 )
+      goto Exit;
+
+    {
+      AF_Point  point;
+      AF_Point  point_limit = points + hints->num_points;
+
+
+      /* compute coordinates & bezier flags */
+      {
+        FT_Vector*  vec = outline->points;
+        char*       tag = outline->tags;
+
+
+        for ( point = points; point < point_limit; point++, vec++, tag++ )
+        {
+          point->fx = vec->x;
+          point->fy = vec->y;
+          point->ox = point->x = FT_MulFix( vec->x, x_scale ) + x_delta;
+          point->oy = point->y = FT_MulFix( vec->y, y_scale ) + y_delta;
+
+          switch ( FT_CURVE_TAG( *tag ) )
+          {
+          case FT_CURVE_TAG_CONIC:
+            point->flags = AF_FLAG_CONIC;
+            break;
+          case FT_CURVE_TAG_CUBIC:
+            point->flags = AF_FLAG_CUBIC;
+            break;
+          default:
+            point->flags = 0;
+            ;
+          }
+        }
+      }
+
+      /* compute `next' and `prev' */
+      {
+        FT_Int    contour_index;
+        AF_Point  prev;
+        AF_Point  first;
+        AF_Point  end;
+
+
+        contour_index = 0;
+
+        first = points;
+        end   = points + outline->contours[0];
+        prev  = end;
+
+        for ( point = points; point < point_limit; point++ )
+        {
+          point->prev = prev;
+          if ( point < end )
+          {
+            point->next = point + 1;
+            prev        = point;
+          }
+          else
+          {
+            point->next = first;
+            contour_index++;
+            if ( point + 1 < point_limit )
+            {
+              end   = points + outline->contours[contour_index];
+              first = point + 1;
+              prev  = end;
+            }
+          }
+        }
+      }
+
+      /* set-up the contours array */
+      {
+        AF_Point*  contour       = hints->contours;
+        AF_Point*  contour_limit = contour + hints->num_contours;
+        short*     end           = outline->contours;
+        short      idx           = 0;
+
+
+        for ( ; contour < contour_limit; contour++, end++ )
+        {
+          contour[0] = points + idx;
+          idx        = (short)( end[0] + 1 );
+        }
+      }
+
+      /* compute directions of in & out vectors */
+      {
+        for ( point = points; point < point_limit; point++ )
+        {
+          AF_Point   prev;
+          AF_Point   next;
+          FT_Pos     in_x, in_y, out_x, out_y;
+
+
+          prev   = point->prev;
+          in_x   = point->fx - prev->fx;
+          in_y   = point->fy - prev->fy;
+
+          point->in_dir = af_direction_compute( in_x, in_y );
+
+          next   = point->next;
+          out_x  = next->fx - point->fx;
+          out_y  = next->fy - point->fy;
+
+          point->out_dir = af_direction_compute( out_x, out_y );
+
+          if ( point->flags & ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) )
+          {
+          Is_Weak_Point:
+            point->flags |= AF_FLAG_WEAK_INTERPOLATION;
+          }
+          else if ( point->out_dir == point->in_dir )
+          {
+            AF_Angle  angle_in, angle_out, delta;
+
+
+            if ( point->out_dir != AF_DIR_NONE )
+              goto Is_Weak_Point;
+
+            angle_in  = af_angle_atan( in_x, in_y );
+            angle_out = af_angle_atan( out_x, out_y );
+            delta     = af_angle_diff( angle_in, angle_out );
+
+            if ( delta < 2 && delta > -2 )
+              goto Is_Weak_Point;
+          }
+          else if ( point->in_dir == -point->out_dir )
+            goto Is_Weak_Point;
+        }
+      }
+    }
+
+   /* compute inflection points
+    */
+    af_glyph_hints_compute_inflections( hints );
+
+  Exit:
+    return error;
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_save( AF_GlyphHints   hints,
+                       FT_Outline*     outline )
+  {
+    AF_Point    point = hints->points;
+    AF_Point    limit = point + hints->num_points;
+    FT_Vector*  vec   = outline->points;
+    char*       tag   = outline->tags;
+
+    for ( ; point < limit; point++, vec++, tag++ )
+    {
+      vec->x = (FT_Pos) point->x;
+      vec->y = (FT_Pos) point->y;
+
+      if ( point->flags & AF_FLAG_CONIC )
+        tag[0] = FT_CURVE_TAG_CONIC;
+      else if ( point->flags & AF_FLAG_CUBIC )
+        tag[0] = FT_CURVE_TAG_CUBIC;
+      else
+        tag[0] = FT_CURVE_TAG_ON;
+    }
+  }
+
+
+ /*
+  *
+  *  E D G E   P O I N T   G R I D - F I T T I N G
+  *
+  */
+
+
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_align_edge_points( AF_GlyphHints  hints,
+                                    AF_Dimension   dim )
+  {
+    AF_AxisHints  axis       = & hints->axis[ dim ];
+    AF_Edge       edges      = axis->edges;
+    AF_Edge       edge_limit = edges + axis->num_edges;
+    AF_Edge       edge;
+
+    for ( edge = edges; edge < edge_limit; edge++ )
+    {
+      /* move the points of each segment     */
+      /* in each edge to the edge's position */
+      AF_Segment  seg = edge->first;
+
+
+      do
+      {
+        AF_Point  point = seg->first;
+
+
+        for (;;)
+        {
+          if ( dim == AF_DIMENSION_HORZ )
+          {
+            point->x      = edge->pos;
+            point->flags |= AF_FLAG_TOUCH_X;
+          }
+          else
+          {
+            point->y      = edge->pos;
+            point->flags |= AF_FLAG_TOUCH_Y;
+          }
+
+          if ( point == seg->last )
+            break;
+
+          point = point->next;
+        }
+
+        seg = seg->edge_next;
+
+      } while ( seg != edge->first );
+    }
+  }
+
+
+ /*
+  *
+  *  S T R O N G   P O I N T   I N T E R P O L A T I O N
+  *
+  */
+
+
+  /* hint the strong points -- this is equivalent to the TrueType `IP' */
+  /* hinting instruction                                               */
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_align_strong_points( AF_GlyphHints  hints,
+                                      AF_Dimension   dim )
+  {
+    AF_Point      points      = hints->points;
+    AF_Point      point_limit = points + hints->num_points;
+    AF_AxisHints  axis        = &hints->axis[dim];
+    AF_Edge       edges       = axis->edges;
+    AF_Edge       edge_limit  = edges + axis->num_edges;
+    AF_Flags      touch_flag;
+
+
+    if ( dim == AF_DIMENSION_HORZ )
+      touch_flag = AF_FLAG_TOUCH_X;
+    else
+      touch_flag  = AF_FLAG_TOUCH_Y;
+
+    if ( edges < edge_limit )
+    {
+      AF_Point  point;
+      AF_Edge   edge;
+
+      for ( point = points; point < point_limit; point++ )
+      {
+        FT_Pos  u, ou, fu;  /* point position */
+        FT_Pos  delta;
+
+
+        if ( point->flags & touch_flag )
+          continue;
+
+        /* if this point is candidate to weak interpolation, we will  */
+        /* interpolate it after all strong points have been processed */
+        if (  ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) &&
+             !( point->flags & AF_FLAG_INFLECTION )         )
+          continue;
+
+        if ( dim == AF_DIMENSION_VERT )
+        {
+          u  = point->fy;
+          ou = point->oy;
+        }
+        else
+        {
+          u  = point->fx;
+          ou = point->ox;
+        }
+
+        fu = u;
+
+        /* is the point before the first edge? */
+        edge  = edges;
+        delta = edge->fpos - u;
+        if ( delta >= 0 )
+        {
+          u = edge->pos - ( edge->opos - ou );
+          goto Store_Point;
+        }
+
+        /* is the point after the last edge? */
+        edge  = edge_limit - 1;
+        delta = u - edge->fpos;
+        if ( delta >= 0 )
+        {
+          u = edge->pos + ( ou - edge->opos );
+          goto Store_Point;
+        }
+
+        {
+          FT_UInt  min, max, mid;
+          FT_Pos   fpos;
+
+
+          /* find enclosing edges */
+          min = 0;
+          max = edge_limit - edges;
+
+          while ( min < max )
+          {
+            mid  = ( max + min ) >> 1;
+            edge = edges + mid;
+            fpos = edge->fpos;
+
+            if ( u < fpos )
+              max = mid;
+            else if ( u > fpos )
+              min = mid + 1;
+            else
+            {
+              /* we are on the edge */
+              u = edge->pos;
+              goto Store_Point;
+            }
+          }
+
+          {
+            AF_Edge  before = edges + min - 1;
+            AF_Edge  after  = edges + min + 0;
+
+
+            /* assert( before && after && before != after ) */
+            if ( before->scale == 0 )
+              before->scale = FT_DivFix( after->pos - before->pos,
+                                         after->fpos - before->fpos );
+
+            u = before->pos + FT_MulFix( fu - before->fpos,
+                                         before->scale );
+          }
+        }
+
+
+      Store_Point:
+
+        /* save the point position */
+        if ( dim == AF_DIMENSION_HORZ )
+          point->x = u;
+        else
+          point->y = u;
+
+        point->flags |= touch_flag;
+      }
+    }
+  }
+
+
+ /*
+  *
+  *  W E A K   P O I N T   I N T E R P O L A T I O N
+  *
+  */
+
+  static void
+  af_iup_shift( AF_Point  p1,
+                AF_Point  p2,
+                AF_Point  ref )
+  {
+    AF_Point  p;
+    FT_Pos    delta = ref->u - ref->v;
+
+
+    for ( p = p1; p < ref; p++ )
+      p->u = p->v + delta;
+
+    for ( p = ref + 1; p <= p2; p++ )
+      p->u = p->v + delta;
+  }
+
+
+  static void
+  af_iup_interp( AF_Point  p1,
+                 AF_Point  p2,
+                 AF_Point  ref1,
+                 AF_Point  ref2 )
+  {
+    AF_Point  p;
+    FT_Pos    u;
+    FT_Pos    v1 = ref1->v;
+    FT_Pos    v2 = ref2->v;
+    FT_Pos    d1 = ref1->u - v1;
+    FT_Pos    d2 = ref2->u - v2;
+
+
+    if ( p1 > p2 )
+      return;
+
+    if ( v1 == v2 )
+    {
+      for ( p = p1; p <= p2; p++ )
+      {
+        u = p->v;
+
+        if ( u <= v1 )
+          u += d1;
+        else
+          u += d2;
+
+        p->u = u;
+      }
+      return;
+    }
+
+    if ( v1 < v2 )
+    {
+      for ( p = p1; p <= p2; p++ )
+      {
+        u = p->v;
+
+        if ( u <= v1 )
+          u += d1;
+        else if ( u >= v2 )
+          u += d2;
+        else
+          u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );
+
+        p->u = u;
+      }
+    }
+    else
+    {
+      for ( p = p1; p <= p2; p++ )
+      {
+        u = p->v;
+
+        if ( u <= v2 )
+          u += d2;
+        else if ( u >= v1 )
+          u += d1;
+        else
+          u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );
+
+        p->u = u;
+      }
+    }
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_glyph_hints_align_weak_points( AF_GlyphHints  hints,
+                                    AF_Dimension   dim )
+  {
+    AF_Point    points        = hints->points;
+    AF_Point    point_limit   = points + hints->num_points;
+    AF_Point*   contour       = hints->contours;
+    AF_Point*   contour_limit = contour + hints->num_contours;
+    AF_Flags    touch_flag;
+    AF_Point    point;
+    AF_Point    end_point;
+    AF_Point    first_point;
+
+
+    /* PASS 1: Move segment points to edge positions */
+
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      touch_flag = AF_FLAG_TOUCH_X;
+
+      for ( point = points; point < point_limit; point++ )
+      {
+        point->u = point->x;
+        point->v = point->ox;
+      }
+    }
+    else
+    {
+      touch_flag = AF_FLAG_TOUCH_Y;
+
+      for ( point = points; point < point_limit; point++ )
+      {
+        point->u = point->y;
+        point->v = point->oy;
+      }
+    }
+
+    point   = points;
+
+    for ( ; contour < contour_limit; contour++ )
+    {
+      point       = *contour;
+      end_point   = point->prev;
+      first_point = point;
+
+      while ( point <= end_point && !( point->flags & touch_flag ) )
+        point++;
+
+      if ( point <= end_point )
+      {
+        AF_Point  first_touched = point;
+        AF_Point  cur_touched   = point;
+
+
+        point++;
+        while ( point <= end_point )
+        {
+          if ( point->flags & touch_flag )
+          {
+            /* we found two successive touched points; we interpolate */
+            /* all contour points between them                        */
+            af_iup_interp( cur_touched + 1, point - 1,
+                           cur_touched, point );
+            cur_touched = point;
+          }
+          point++;
+        }
+
+        if ( cur_touched == first_touched )
+        {
+          /* this is a special case: only one point was touched in the */
+          /* contour; we thus simply shift the whole contour           */
+          af_iup_shift( first_point, end_point, cur_touched );
+        }
+        else
+        {
+          /* now interpolate after the last touched point to the end */
+          /* of the contour                                          */
+          af_iup_interp( cur_touched + 1, end_point,
+                         cur_touched, first_touched );
+
+          /* if the first contour point isn't touched, interpolate */
+          /* from the contour start to the first touched point     */
+          if ( first_touched > points )
+            af_iup_interp( first_point, first_touched - 1,
+                           cur_touched, first_touched );
+        }
+      }
+    }
+
+    /* now save the interpolated values back to x/y */
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      for ( point = points; point < point_limit; point++ )
+        point->x = point->u;
+    }
+    else
+    {
+      for ( point = points; point < point_limit; point++ )
+        point->y = point->u;
+    }
+  }

reactos/lib/freetype/src/autofit
afhints.h 1.2 -> 1.3
diff -N afhints.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afhints.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,246 @@
+#ifndef __AFHINTS_H__
+#define __AFHINTS_H__
+
+#include "aftypes.h"
+
+FT_BEGIN_HEADER
+
+ /*
+  *  The definition of outline glyph hints. These are shared by all
+  *  script analysis routines (until now)
+  *
+  */
+
+  typedef enum
+  {
+    AF_DIMENSION_HORZ = 0,  /* x coordinates, i.e. vertical segments & edges   */
+    AF_DIMENSION_VERT = 1,  /* y coordinates, i.e. horizontal segments & edges */
+
+    AF_DIMENSION_MAX  /* do not remove */
+
+  } AF_Dimension;
+
+
+  /* hint directions -- the values are computed so that two vectors are */
+  /* in opposite directions iff `dir1+dir2 == 0'                        */
+  typedef enum
+  {
+    AF_DIR_NONE  =  4,
+    AF_DIR_RIGHT =  1,
+    AF_DIR_LEFT  = -1,
+    AF_DIR_UP    =  2,
+    AF_DIR_DOWN  = -2
+
+  } AF_Direction;
+
+
+  /* point hint flags */
+  typedef enum
+  {
+    AF_FLAG_NONE    = 0,
+
+   /* point type flags */
+    AF_FLAG_CONIC   = (1 << 0),
+    AF_FLAG_CUBIC   = (1 << 1),
+    AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
+
+   /* point extremum flags */
+    AF_FLAG_EXTREMA_X = (1 << 2),
+    AF_FLAG_EXTREMA_Y = (1 << 3),
+
+   /* point roundness flags */
+    AF_FLAG_ROUND_X = (1 << 4),
+    AF_FLAG_ROUND_Y = (1 << 5),
+
+   /* point touch flags */
+    AF_FLAG_TOUCH_X = (1 << 6),
+    AF_FLAG_TOUCH_Y = (1 << 7),
+
+   /* candidates for weak interpolation have this flag set */
+    AF_FLAG_WEAK_INTERPOLATION = (1 << 8),
+
+   /* all inflection points in the outline have this flag set */
+    AF_FLAG_INFLECTION         = (1 << 9)
+
+  } AF_Flags;
+
+
+  /* edge hint flags */
+  typedef enum
+  {
+    AF_EDGE_NORMAL = 0,
+    AF_EDGE_ROUND  = (1 << 0),
+    AF_EDGE_SERIF  = (1 << 1),
+    AF_EDGE_DONE   = (1 << 2)
+
+  } AF_Edge_Flags;
+
+
+
+  typedef struct AF_PointRec_*    AF_Point;
+  typedef struct AF_SegmentRec_*  AF_Segment;
+  typedef struct AF_EdgeRec_*     AF_Edge;
+
+
+  typedef struct  AF_PointRec_
+  {
+    AF_Flags      flags;    /* point flags used by hinter */
+    FT_Pos        ox, oy;   /* original, scaled position  */
+    FT_Pos        fx, fy;   /* original, unscaled position (font units) */
+    FT_Pos        x,  y;    /* current position */
+    FT_Pos        u,  v;    /* current (x,y) or (y,x) depending on context */
+
+    AF_Direction  in_dir;   /* direction of inwards vector  */
+    AF_Direction  out_dir;  /* direction of outwards vector */
+
+    AF_Point      next;     /* next point in contour     */
+    AF_Point      prev;     /* previous point in contour */
+
+  } AF_PointRec;
+
+
+  typedef struct  AF_SegmentRec_
+  {
+    AF_Edge_Flags  flags;       /* edge/segment flags for this segment */
+    AF_Direction   dir;         /* segment direction                   */
+    FT_Pos         pos;         /* position of segment                 */
+    FT_Pos         min_coord;   /* minimum coordinate of segment       */
+    FT_Pos         max_coord;   /* maximum coordinate of segment       */
+
+    AF_Edge        edge;        /* the segment's parent edge */
+    AF_Segment     edge_next;   /* link to next segment in parent edge */
+
+    AF_Segment     link;        /* (stem) link segment        */
+    AF_Segment     serif;       /* primary segment for serifs */
+    FT_Pos         num_linked;  /* number of linked segments  */
+    FT_Pos         score;       /* used during stem matching  */
+
+    AF_Point       first;       /* first point in edge segment             */
+    AF_Point       last;        /* last point in edge segment              */
+    AF_Point*      contour;     /* ptr to first point of segment's contour */
+
+  } AF_SegmentRec;
+
+
+  typedef struct  AF_EdgeRec_
+  {
+    FT_Pos         fpos;       /* original, unscaled position (font units) */
+    FT_Pos         opos;       /* original, scaled position                */
+    FT_Pos         pos;        /* current position                         */
+
+    AF_Edge_Flags  flags;      /* edge flags */
+    AF_Direction   dir;        /* edge direction */
+    FT_Fixed       scale;      /* used to speed up interpolation between edges */
+    AF_Width       blue_edge;  /* non-NULL if this is a blue edge              */
+
+    AF_Edge        link;
+    AF_Edge        serif;
+    FT_Int         num_linked;
+
+    FT_Int         score;
+
+    AF_Segment     first;
+    AF_Segment     last;
+
+  } AF_EdgeRec;
+
+
+  typedef struct AF_AxisHintsRec_
+  {
+    FT_Int        num_segments;
+    AF_Segment    segments;
+
+    FT_Int        num_edges;
+    AF_Edge       edges;
+
+    AF_Direction  major_dir;
+
+  } AF_AxisHintsRec, *AF_AxisHints;
+
+
+  typedef struct AF_GlyphHintsRec_
+  {
+    FT_Memory     memory;
+
+    FT_Fixed      x_scale;
+    FT_Pos        x_delta;
+
+    FT_Fixed      y_scale;
+    FT_Pos        y_delta;
+
+    FT_Pos        edge_distance_threshold;
+
+    FT_Int        max_points;
+    FT_Int        num_points;
+    AF_Point      points;
+
+    FT_Int        max_contours;
+    FT_Int        num_contours;
+    AF_Point*     contours;
+
+    AF_AxisHintsRec  axis[ AF_DIMENSION_MAX ];
+    
+    FT_UInt32         scaler_flags;  /* copy of scaler flags */
+    FT_UInt32         other_flags;   /* free for script-specific implementations */
+    AF_ScriptMetrics  metrics;
+
+  } AF_GlyphHintsRec;
+
+
+#define  AF_HINTS_TEST_SCALER(h,f)  ( (h)->scaler_flags & (f) )
+#define  AF_HINTS_TEST_OTHER(h,f)   ( (h)->other_flags  & (f) )
+
+#define  AF_HINTS_DO_HORIZONTAL(h)  \
+            !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_HORIZONTAL)
+
+#define  AF_HINTS_DO_VERTICAL(h)    \
+            !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_VERTICAL)
+
+#define  AF_HINTS_DO_ADVANCE(h)     \
+            !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_ADVANCE)
+
+
+  FT_LOCAL( AF_Direction )
+  af_direction_compute( FT_Pos  dx,
+                        FT_Pos  dy );
+
+
+  FT_LOCAL( void )
+  af_glyph_hints_init( AF_GlyphHints  hints,
+                       FT_Memory      memory );
+
+
+
+ /*  recomputes all AF_Point in a AF_GlyphHints from the definitions
+  *  in a source outline
+  */
+  FT_LOCAL( FT_Error )
+  af_glyph_hints_reset( AF_GlyphHints     hints,
+                        AF_Scaler         scaler,
+                        AF_ScriptMetrics  metrics,
+                        FT_Outline*       outline );
+
+  FT_LOCAL( void )
+  af_glyph_hints_save( AF_GlyphHints   hints,
+                       FT_Outline*     outline );
+
+  FT_LOCAL( void )
+  af_glyph_hints_align_edge_points( AF_GlyphHints  hints,
+                                    AF_Dimension   dim );
+
+  FT_LOCAL( void )
+  af_glyph_hints_align_strong_points( AF_GlyphHints  hints,
+                                      AF_Dimension   dim );
+
+  FT_LOCAL( void )
+  af_glyph_hints_align_weak_points( AF_GlyphHints  hints,
+                                    AF_Dimension   dim );
+
+  FT_LOCAL( void )
+  af_glyph_hints_done( AF_GlyphHints  hints );
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AFHINTS_H__ */

reactos/lib/freetype/src/autofit
aflatin.c 1.2 -> 1.3
diff -N aflatin.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aflatin.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,1789 @@
+#include "aflatin.h"
+
+ /***************************************************************************/
+ /***************************************************************************/
+ /*****                                                                 *****/
+ /*****       L A T I N   G L O B A L   M E T R I C S                   *****/
+ /*****                                                                 *****/
+ /***************************************************************************/
+ /***************************************************************************/
+
+  static void
+  af_latin_metrics_init_widths( AF_LatinMetrics  metrics,
+                                FT_Face          face )
+  {
+    /* scan the array of segments in each direction */
+    AF_GlyphHintsRec  hints[1];
+
+    af_glyph_hints_init( hints, face->memory );
+
+    metrics->axis[ AF_DIMENSION_HORZ ].width_count = 0;
+    metrics->axis[ AF_DIMENSION_VERT ].width_count = 0;
+
+    /* For now, compute the standard width and height from the `o' */
+    {
+      FT_Error      error;
+      FT_UInt       glyph_index;
+      AF_Dimension  dim;
+      AF_ScalerRec  scaler[1];
+
+
+      glyph_index = FT_Get_Char_Index( face, 'o' );
+      if ( glyph_index == 0 )
+        goto Exit;
+
+      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
+      if ( error || face->glyph->outline.n_points <= 0 )
+        goto Exit;
+
+      scaler->x_scale     = scaler->y_scale = 0x10000L;
+      scaler->x_delta     = scaler->y_delta = 0;
+      scaler->face        = face;
+      scaler->render_mode = 0;
+      scaler->flags       = 0;
+
+      error = af_glyph_hints_reset( hints, scaler,
+                                    (AF_ScriptMetrics) metrics,
+                                    &face->glyph->outline );
+      if ( error )
+        goto Exit;
+
+      for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
+      {
+        AF_LatinAxis  axis    = & metrics->axis[ dim ];
+        AF_AxisHints  axhints = & hints->axis[ dim ];
+        AF_Segment    seg, limit, link;
+        FT_UInt       num_widths = 0;
+        FT_Pos        edge_distance_threshold = 32000;
+
+        af_latin_hints_compute_segments( hints, dim );
+        af_latin_hints_link_segments   ( hints, dim );
+
+        seg   = axhints->segments;
+        limit = seg + axhints->num_segments;
+
+        for ( ; seg < limit; seg++ )
+        {
+          link = seg->link;
+          /* we only consider stem segments there! */
+          if ( link && link->link == seg && link > seg )
+          {
+            FT_Pos  dist;
+
+
+            dist = seg->pos - link->pos;
+            if ( dist < 0 )
+              dist = -dist;
+
+            if ( num_widths < AF_LATIN_MAX_WIDTHS )
+              axis->widths[ num_widths++ ].org = dist;
+          }
+        }
+
+        af_sort_widths( num_widths, axis->widths );
+        axis->width_count = num_widths;
+
+        /* we will now try to find the smallest width */
+        if ( num_widths > 0 && axis->widths[0].org < edge_distance_threshold )
+          edge_distance_threshold = axis->widths[0].org;
+
+        /* Now, compute the edge distance threshold as a fraction of the */
+        /* smallest width in the font. Set it in `hinter->glyph' too!    */
+        if ( edge_distance_threshold == 32000 )
+          edge_distance_threshold = 50;
+
+        /* let's try 20% */
+        axis->edge_distance_threshold = edge_distance_threshold / 5;
+      }
+    }
+
+  Exit:
+    af_glyph_hints_done( hints );
+  }
+
+
+
+#define AF_LATIN_MAX_TEST_CHARACTERS  12
+
+
+  static  const char* const  af_latin_blue_chars[ AF_LATIN_MAX_BLUES ] =
+  {
+    "THEZOCQS",
+    "HEZLOCUS",
+    "fijkdbh",
+    "xzroesc",
+    "xzroesc",
+    "pqgjy"
+  };
+
+
+  static void
+  af_latin_metrics_init_blues( AF_LatinMetrics  metrics,
+                               FT_Face          face )
+  {
+    FT_Pos        flats [ AF_LATIN_MAX_TEST_CHARACTERS ];
+    FT_Pos        rounds[ AF_LATIN_MAX_TEST_CHARACTERS ];
+    FT_Int        num_flats;
+    FT_Int        num_rounds;
+    FT_Int        bb;
+    AF_LatinBlue  blue;
+    FT_Error      error;
+    AF_LatinAxis  axis  = &metrics->axis[ AF_DIMENSION_VERT ];
+    FT_GlyphSlot  glyph = face->glyph;
+
+    /* we compute the blues simply by loading each character from the    */
+    /* 'af_latin_blue_chars[blues]' string, then compute its top-most or */
+    /* bottom-most points (depending on `AF_IS_TOP_BLUE')                */
+
+    AF_LOG(( "blue zones computation\n" ));
+    AF_LOG(( "------------------------------------------------\n" ));
+
+    for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )
+    {
+      const char*  p     = af_latin_blue_chars[bb];
+      const char*  limit = p + AF_LATIN_MAX_TEST_CHARACTERS;
+      FT_Pos*      blue_ref;
+      FT_Pos*      blue_shoot;
+
+      AF_LOG(( "blue %3d: ", bb ));
+
+      num_flats  = 0;
+      num_rounds = 0;
+
+      for ( ; p < limit && *p; p++ )
+      {
+        FT_UInt     glyph_index;
+        FT_Vector*  extremum;
+        FT_Vector*  points;
+        FT_Vector*  point_limit;
+        FT_Vector*  point;
+        FT_Bool     round;
+
+
+        AF_LOG(( "'%c'", *p ));
+
+        /* load the character in the face -- skip unknown or empty ones */
+        glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );
+        if ( glyph_index == 0 )
+          continue;
+
+        error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
+        if ( error || glyph->outline.n_points <= 0 )
+          continue;
+
+        /* now compute min or max point indices and coordinates */
+        points      = glyph->outline.points;
+        point_limit = points + glyph->outline.n_points;
+        point       = points;
+        extremum    = point;
+        point++;
+
+        if ( AF_LATIN_IS_TOP_BLUE( bb ) )
+        {
+          for ( ; point < point_limit; point++ )
+            if ( point->y > extremum->y )
+              extremum = point;
+        }
+        else
+        {
+          for ( ; point < point_limit; point++ )
+            if ( point->y < extremum->y )
+              extremum = point;
+        }
+
+        AF_LOG(( "%5d", (int)extremum->y ));
+
+        /* now, check whether the point belongs to a straight or round  */
+        /* segment; we first need to find in which contour the extremum */
+        /* lies, then see its previous and next points                  */
+        {
+          FT_Int  idx = (FT_Int)( extremum - points );
+          FT_Int  n;
+          FT_Int  first, last, prev, next, end;
+          FT_Pos  dist;
+
+
+          last  = -1;
+          first = 0;
+
+          for ( n = 0; n < glyph->outline.n_contours; n++ )
+          {
+            end = glyph->outline.contours[n];
+            if ( end >= idx )
+            {
+              last = end;
+              break;
+            }
+            first = end + 1;
+          }
+
+          /* XXX: should never happen! */
+          if ( last < 0 )
+            continue;
+
+          /* now look for the previous and next points that are not on the */
+          /* same Y coordinate.  Threshold the `closeness'...              */
+
+          prev = idx;
+          next = prev;
+
+          do
+          {
+            if ( prev > first )
+              prev--;
+            else
+              prev = last;
+
+            dist = points[prev].y - extremum->y;
+            if ( dist < -5 || dist > 5 )
+              break;
+
+          } while ( prev != idx );
+
+          do
+          {
+            if ( next < last )
+              next++;
+            else
+              next = first;
+
+            dist = points[next].y - extremum->y;
+            if ( dist < -5 || dist > 5 )
+              break;
+
+          } while ( next != idx );
+
+          /* now, set the `round' flag depending on the segment's kind */
+          round = FT_BOOL(
+            FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_CURVE_TAG_ON ||
+            FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_CURVE_TAG_ON );
+
+          AF_LOG(( "%c ", round ? 'r' : 'f' ));
+        }
+
+        if ( round )
+          rounds[num_rounds++] = extremum->y;
+        else
+          flats[num_flats++] = extremum->y;
+      }
+
+      AF_LOG(( "\n" ));
+
+      if ( num_flats == 0 && num_rounds == 0 )
+      {
+       /* we couldn't find a single glyph to compute this blue zone,
+        * we will simply ignore it then
+        */
+        AF_LOG(( "empty !!\n" ));
+        continue;
+      }
+
+      /* we have computed the contents of the `rounds' and `flats' tables, */
+      /* now determine the reference and overshoot position of the blue -- */
+      /* we simply take the median value after a simple sort               */
+      af_sort_pos( num_rounds, rounds );
+      af_sort_pos( num_flats,  flats );
+
+      blue       = & axis->blues[ axis->blue_count ];
+      blue_ref   = & blue->ref.org;
+      blue_shoot = & blue->shoot.org;
+
+      axis->blue_count ++;
+
+      if ( num_flats == 0 )
+      {
+        *blue_ref    =
+        *blue_shoot = rounds[num_rounds / 2];
+      }
+      else if ( num_rounds == 0 )
+      {
+        *blue_ref   =
+        *blue_shoot = flats[num_flats / 2];
+      }
+      else
+      {
+        *blue_ref   = flats[num_flats / 2];
+        *blue_shoot = rounds[num_rounds / 2];
+      }
+
+      /* there are sometimes problems: if the overshoot position of top     */
+      /* zones is under its reference position, or the opposite for bottom  */
+      /* zones.  We must thus check everything there and correct the errors */
+      if ( *blue_shoot != *blue_ref )
+      {
+        FT_Pos   ref      = *blue_ref;
+        FT_Pos   shoot    = *blue_shoot;
+        FT_Bool  over_ref = FT_BOOL( shoot > ref );
+
+
+        if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )
+          *blue_shoot = *blue_ref = ( shoot + ref ) / 2;
+      }
+
+      blue->flags = 0;
+      if ( AF_LATIN_IS_TOP_BLUE(bb) )
+        blue->flags |= AF_LATIN_BLUE_TOP;
+
+      AF_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot ));
+    }
+
+    return;
+  }
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_latin_metrics_init( AF_LatinMetrics  metrics,
+                         FT_Face          face )
+  {
+    FT_Error      error;
+    FT_CharMap    oldmap = face->charmap;
+
+    /* do we have a Unicode charmap in there? */
+    error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
+    if ( error ) goto Exit;
+
+    metrics->units_per_em = face->units_per_EM;
+
+    af_latin_metrics_init_widths( metrics, face );
+    af_latin_metrics_init_blues( metrics, face );
+
+  Exit:
+    FT_Set_Charmap( face, oldmap );
+    return error;
+  }
+
+
+  static void
+  af_latin_metrics_scale_dim( AF_LatinMetrics   metrics,
+                              AF_Scaler         scaler,
+                              AF_Dimension      dim )
+  {
+    FT_Fixed      scale;
+    FT_Pos        delta;
+    AF_LatinAxis  axis;
+    FT_UInt       nn;
+
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      scale = scaler->x_scale;
+      delta = scaler->x_delta;
+    }
+    else
+    {
+      scale = scaler->y_scale;
+      delta = scaler->y_delta;
+    }
+
+    axis = & metrics->axis[ dim ];
+
+    if ( axis->org_scale == scale && axis->org_delta == delta )
+      return;
+
+    axis->org_scale = scale;
+    axis->org_delta = delta;
+
+   /* XXX: TODO: Correct Y and X scale according to Chester rules
+    */
+    axis->scale = scale;
+    axis->delta = delta;
+
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      metrics->root.scaler.x_scale = scale;
+      metrics->root.scaler.x_delta = delta;
+    }
+    else
+    {
+      metrics->root.scaler.y_scale = scale;
+      metrics->root.scaler.y_delta = delta;
+    }
+
+   /* scale the standard widths
+    */
+    for ( nn = 0; nn < axis->width_count; nn++ )
+    {
+      AF_Width  width = axis->widths + nn;
+
+      width->cur = FT_MulFix( width->org, scale );
+      width->fit = width->cur;
+    }
+
+    if ( dim == AF_DIMENSION_VERT )
+    {
+     /* scale the blue zones
+      */
+      for ( nn = 0; nn < axis->blue_count; nn++ )
+      {
+        AF_LatinBlue  blue  = & axis->blues[nn];
+        FT_Pos        dist;
+
+        blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta;
+        blue->ref.fit = blue->ref.cur;
+
+        blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta;
+        blue->shoot.fit = blue->shoot.cur;
+
+       /* a blue zone is only active when it is less than 3/4 pixels tall
+        */
+        dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );
+        if ( dist >= 48 || dist <= -48 )
+          blue->flags |= ~AF_LATIN_BLUE_ACTIVE;
+      }
+    }
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_latin_metrics_scale( AF_LatinMetrics  metrics,
+                          AF_Scaler        scaler )
+  {
+    af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );
+    af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );
+  }
+
+
+ /***************************************************************************/
+ /***************************************************************************/
+ /*****                                                                 *****/
+ /*****            L A T I N   G L Y P H   A N A L Y S I S              *****/
+ /*****                                                                 *****/
+ /***************************************************************************/
+ /***************************************************************************/
+
+  FT_LOCAL_DEF( void )
+  af_latin_hints_compute_segments( AF_GlyphHints  hints,
+                                   AF_Dimension   dim )
+  {
+    AF_AxisHints  axis = &hints->axis[dim];
+    AF_Segment    segments = axis->segments;
+    AF_Segment    segment       =  segments;
+    FT_Int        num_segments  =  0;
+    AF_Point*     contour       =  hints->contours;
+    AF_Point*     contour_limit =  contour + hints->num_contours;
+    AF_Direction  major_dir, segment_dir;
+
+#ifdef AF_HINT_METRICS
+    AF_Point    min_point     =  0;
+    AF_Point    max_point     =  0;
+    FT_Pos      min_coord     =  32000;
+    FT_Pos      max_coord     = -32000;
+#endif
+
+    major_dir   = FT_ABS( axis->major_dir );
+    segment_dir = major_dir;
+
+    /* set up (u,v) in each point */
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      AF_Point  point = hints->points;
+      AF_Point  limit = point + hints->num_points;
+
+      for ( ; point < limit; point++ )
+      {
+        point->u = point->fx;
+        point->v = point->fy;
+      }
+    }
+    else
+    {
+      AF_Point  point = hints->points;
+      AF_Point  limit = point + hints->num_points;
+
+      for ( ; point < limit; point++ )
+      {
+        point->u = point->fy;
+        point->v = point->fx;
+      }
+    }
+
+
+    /* do each contour separately */
+    for ( ; contour < contour_limit; contour++ )
+    {
+      AF_Point  point   =  contour[0];
+      AF_Point  last    =  point->prev;
+      int       on_edge =  0;
+      FT_Pos    min_pos =  32000;  /* minimum segment pos != min_coord */
+      FT_Pos    max_pos = -32000;  /* maximum segment pos != max_coord */
+      FT_Bool   passed;
+
+
+#ifdef AF_HINT_METRICS
+      if ( point->u < min_coord )
+      {
+        min_coord = point->u;
+        min_point = point;
+      }
+      if ( point->u > max_coord )
+      {
+        max_coord = point->u;
+        max_point = point;
+      }
+#endif
+
+      if ( point == last )  /* skip singletons -- just in case */
+        continue;
+
+      if ( FT_ABS( last->out_dir )  == major_dir &&
+           FT_ABS( point->out_dir ) == major_dir )
+      {
+        /* we are already on an edge, try to locate its start */
+        last = point;
+
+        for (;;)
+        {
+          point = point->prev;
+          if ( FT_ABS( point->out_dir ) != major_dir )
+          {
+            point = point->next;
+            break;
+          }
+          if ( point == last )
+            break;
+        }
+      }
+
+      last   = point;
+      passed = 0;
+
+      for (;;)
+      {
+        FT_Pos  u, v;
+
+
+        if ( on_edge )
+        {
+          u = point->u;
+          if ( u < min_pos )
+            min_pos = u;
+          if ( u > max_pos )
+            max_pos = u;
+
+          if ( point->out_dir != segment_dir || point == last )
+          {
+            /* we are just leaving an edge; record a new segment! */
+            segment->last = point;
+            segment->pos  = ( min_pos + max_pos ) >> 1;
+
+            /* a segment is round if either its first or last point */
+            /* is a control point                                   */
+            if ( ( segment->first->flags | point->flags ) &
+                   AF_FLAG_CONTROL                        )
+              segment->flags |= AF_EDGE_ROUND;
+
+            /* compute segment size */
+            min_pos = max_pos = point->v;
+
+            v = segment->first->v;
+            if ( v < min_pos )
+              min_pos = v;
+            if ( v > max_pos )
+              max_pos = v;
+
+            segment->min_coord = min_pos;
+            segment->max_coord = max_pos;
+
+            on_edge = 0;
+            num_segments++;
+            segment++;
+            /* fallthrough */
+          }
+        }
+
+        /* now exit if we are at the start/end point */
+        if ( point == last )
+        {
+          if ( passed )
+            break;
+          passed = 1;
+        }
+
+        if ( !on_edge && FT_ABS( point->out_dir ) == major_dir )
+        {
+          /* this is the start of a new segment! */
+          segment_dir = point->out_dir;
+
+          /* clear all segment fields */
+          FT_ZERO( segment );
+
+          segment->dir      = segment_dir;
+          segment->flags    = AF_EDGE_NORMAL;
+          min_pos = max_pos = point->u;
+          segment->first    = point;
+          segment->last     = point;
+          segment->contour  = contour;
+          segment->score    = 32000;
+          segment->link     = NULL;
+          on_edge           = 1;
+
+#ifdef AF_HINT_METRICS
+          if ( point == max_point )
+            max_point = 0;
+
+          if ( point == min_point )
+            min_point = 0;
+#endif
+        }
+
+        point = point->next;
+      }
+
+    } /* contours */
+
+#ifdef AF_HINT_METRICS
+    /* we need to ensure that there are edges on the left-most and  */
+    /* right-most points of the glyph in order to hint the metrics; */
+    /* we do this by inserting fake segments when needed            */
+    if ( dim == AF_DIMENSION_HORZ )
+    {
+      AF_Point  point       = hints->points;
+      AF_Point  point_limit = point + hints->num_points;
+
+      FT_Pos    min_pos =  32000;
+      FT_Pos    max_pos = -32000;
+
+
+      min_point = 0;
+      max_point = 0;
+
+      /* compute minimum and maximum points */
+      for ( ; point < point_limit; point++ )
+      {
+        FT_Pos  x = point->fx;
+
+
+        if ( x < min_pos )
+        {
+          min_pos   = x;
+          min_point = point;
+        }
+        if ( x > max_pos )
+        {
+          max_pos   = x;
+          max_point = point;
+        }
+      }
+
+      /* insert minimum segment */
+      if ( min_point )
+      {
+        /* clear all segment fields */
+        FT_ZERO( segment );
+
+        segment->dir   = segment_dir;
+        segment->flags = AF_EDGE_NORMAL;
+        segment->first = min_point;
+        segment->last  = min_point;
+        segment->pos   = min_pos;
+        segment->score = 32000;
+        segment->link  = NULL;
+
+        num_segments++;
+        segment++;
+      }
+
+      /* insert maximum segment */
+      if ( max_point )
+      {
+        /* clear all segment fields */
+        FT_ZERO( segment );
+
+        segment->dir   = segment_dir;
+        segment->flags = AF_EDGE_NORMAL;
+        segment->first = max_point;
+        segment->last  = max_point;
+        segment->pos   = max_pos;
+        segment->score = 32000;
+        segment->link  = NULL;
+
+        num_segments++;
+        segment++;
+      }
+    }
+#endif /* AF_HINT_METRICS */
+
+    axis->num_segments = num_segments;
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_latin_hints_link_segments( AF_GlyphHints  hints,
+                                AF_Dimension   dim )
+  {
+    AF_AxisHints  axis          = &hints->axis[dim];
+    AF_Segment    segments      = axis->segments;
+    AF_Segment    segment_limit = segments + axis->num_segments;
+    AF_Direction  major_dir     = axis->major_dir;
+    AF_Segment    seg1, seg2;
+
+    /* now compare each segment to the others */
+    for ( seg1 = segments; seg1 < segment_limit; seg1++ )
+    {
+      /* the fake segments are introduced to hint the metrics -- */
+      /* we must never link them to anything                     */
+      if ( seg1->first == seg1->last || seg1->dir != major_dir )
+        continue;
+
+      for ( seg2 = segments; seg2 < segment_limit; seg2++ )
+        if ( seg2 != seg1 && seg1->dir + seg2->dir == 0 )
+        {
+          FT_Pos  pos1 = seg1->pos;
+          FT_Pos  pos2 = seg2->pos;
+          FT_Pos  dist = pos2 - pos1;
+
+
+          if ( dist < 0 )
+            continue;
+
+          {
+            FT_Pos  min = seg1->min_coord;
+            FT_Pos  max = seg1->max_coord;
+            FT_Pos  len, score;
+
+
+            if ( min < seg2->min_coord )
+              min = seg2->min_coord;
+
+            if ( max > seg2->max_coord )
+              max = seg2->max_coord;
+
+            len = max - min;
+            if ( len >= 8 )
+            {
+              score = dist + 3000 / len;
+
+              if ( score < seg1->score )
+              {
+                seg1->score = score;
+                seg1->link  = seg2;
+              }
+
+              if ( score < seg2->score )
+              {
+                seg2->score = score;
+                seg2->link  = seg1;
+              }
+            }
+          }
+        }
+    }
+
+    /* now, compute the `serif' segments */
+    for ( seg1 = segments; seg1 < segment_limit; seg1++ )
+    {
+      seg2 = seg1->link;
+
+      if ( seg2 )
+      {
+        seg2->num_linked++;
+        if ( seg2->link != seg1 )
+        {
+          seg1->link  = 0;
+          seg1->serif = seg2->link;
+        }
+      }
+    }
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_latin_hints_compute_edges( AF_GlyphHints  hints,
+                                AF_Dimension   dim )
+  {
+    AF_AxisHints  axis = &hints->axis[dim];
+    AF_Edge       edges = axis->edges;
+    AF_Edge       edge, edge_limit;
+
+    AF_Segment    segments = axis->segments;
+    AF_Segment    segment_limit = segments + axis->num_segments;
+    AF_Segment    seg;
+
+    AF_Direction  up_dir;
+    FT_Fixed      scale;
+    FT_Pos        edge_distance_threshold;
+
+
+    scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale
+                                         : hints->y_scale;
+
+    up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP
+                                          : AF_DIR_RIGHT;
+
+    /*********************************************************************/
+    /*                                                                   */
+    /* We will begin by generating a sorted table of edges for the       */
+    /* current direction.  To do so, we simply scan each segment and try */
+    /* to find an edge in our table that corresponds to its position.    */
+    /*                                                                   */
+    /* If no edge is found, we create and insert a new edge in the       */
+    /* sorted table.  Otherwise, we simply add the segment to the edge's */
+    /* list which will be processed in the second step to compute the    */
+    /* edge's properties.                                                */
+    /*                                                                   */
+    /* Note that the edges table is sorted along the segment/edge        */
+    /* position.                                                         */
+    /*                                                                   */
+    /*********************************************************************/
+
+    edge_distance_threshold = FT_MulFix( hints->edge_distance_threshold,
+                                         scale );
+    if ( edge_distance_threshold > 64 / 4 )
+      edge_distance_threshold = 64 / 4;
+
+    edge_distance_threshold = FT_DivFix( edge_distance_threshold,
+                                         scale );
+
+    edge_limit = edges;
+    for ( seg = segments; seg < segment_limit; seg++ )
+    {
+      AF_Edge  found = 0;
+
+
+      /* look for an edge corresponding to the segment */
+      for ( edge = edges; edge < edge_limit; edge++ )
+      {
+        FT_Pos  dist;
+
+
+        dist = seg->pos - edge->fpos;
+        if ( dist < 0 )
+          dist = -dist;
+
+        if ( dist < edge_distance_threshold )
+        {
+          found = edge;
+          break;
+        }
+      }
+
+      if ( !found )
+      {
+        /* insert a new edge in the list and */
+        /* sort according to the position    */
+        while ( edge > edges && edge[-1].fpos > seg->pos )
+        {
+          edge[0] = edge[-1];
+          edge--;
+        }
+        edge_limit++;
+
+        /* clear all edge fields */
+        FT_ZERO( edge );
+
+        /* add the segment to the new edge's list */
+        edge->first    = seg;
+        edge->last     = seg;
+        edge->fpos     = seg->pos;
+        edge->opos     = edge->pos = FT_MulFix( seg->pos, scale );
+        seg->edge_next = seg;
+      }
+      else
+      {
+        /* if an edge was found, simply add the segment to the edge's */
+        /* list                                                       */
+        seg->edge_next        = edge->first;
+        edge->last->edge_next = seg;
+        edge->last            = seg;
+      }
+    }
+    axis->num_edges = (FT_Int)( edge_limit - edges );
+
+
+    /*********************************************************************/
+    /*                                                                   */
+    /* Good, we will now compute each edge's properties according to     */
+    /* segments found on its position.  Basically, these are:            */
+    /*                                                                   */
+    /*  - edge's main direction                                          */
+    /*  - stem edge, serif edge or both (which defaults to stem then)    */
+    /*  - rounded edge, straight or both (which defaults to straight)    */
+    /*  - link for edge                                                  */
+    /*                                                                   */
+    /*********************************************************************/
+
+    /* first of all, set the `edge' field in each segment -- this is */
+    /* required in order to compute edge links                       */
+
+    /* Note that I've tried to remove this loop, setting
+     * the "edge" field of each segment directly in the
+     * code above.  For some reason, it slows down execution
+     * speed -- on a Sun.
+     */
+    for ( edge = edges; edge < edge_limit; edge++ )
+    {
+      seg = edge->first;
+      if ( seg )
+        do
+        {
+          seg->edge = edge;
+          seg       = seg->edge_next;
+        }
+        while ( seg != edge->first );
+    }
+
+    /* now, compute each edge properties */
+    for ( edge = edges; edge < edge_limit; edge++ )
+    {
+      FT_Int  is_round    = 0;  /* does it contain round segments?    */
+      FT_Int  is_straight = 0;  /* does it contain straight segments? */
+      FT_Pos  ups         = 0;  /* number of upwards segments         */
+      FT_Pos  downs       = 0;  /* number of downwards segments       */
+
+
+      seg = edge->first;
+
+      do
+      {
+        FT_Bool  is_serif;
+
+
+        /* check for roundness of segment */
+        if ( seg->flags & AF_EDGE_ROUND )
+          is_round++;
+        else
+          is_straight++;
+
+        /* check for segment direction */
+        if ( seg->dir == up_dir )
+          ups   += seg->max_coord-seg->min_coord;
+        else
+          downs += seg->max_coord-seg->min_coord;
+
+        /* check for links -- if seg->serif is set, then seg->link must */
+        /* be ignored                                                   */
+        is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge );
+
+        if ( seg->link || is_serif )
+        {
+          AF_Edge     edge2;
+          AF_Segment  seg2;
+
+
+          edge2 = edge->link;
+          seg2  = seg->link;
+
+          if ( is_serif )
+          {
+            seg2  = seg->serif;
+            edge2 = edge->serif;
+          }
+
+          if ( edge2 )
+          {
+            FT_Pos  edge_delta;
+            FT_Pos  seg_delta;
+
+
+            edge_delta = edge->fpos - edge2->fpos;
+            if ( edge_delta < 0 )
+              edge_delta = -edge_delta;
+
+            seg_delta = seg->pos - seg2->pos;
+            if ( seg_delta < 0 )
+              seg_delta = -seg_delta;
+
+            if ( seg_delta < edge_delta )
+              edge2 = seg2->edge;
+          }
+          else
+            edge2 = seg2->edge;
+
+          if ( is_serif )
+          {
+            edge->serif   = edge2;
+            edge2->flags |= AF_EDGE_SERIF;
+          }
+          else
[truncated at 1000 lines; 793 more skipped]

reactos/lib/freetype/src/autofit
aflatin.h 1.2 -> 1.3
diff -N aflatin.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aflatin.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,168 @@
+#ifndef __AFLATIN_H__
+#define __AFLATIN_H__
+
+#include "afhints.h"
+
+FT_BEGIN_HEADER
+
+ /*
+  * the latin-specific script class
+  *
+  */
+  FT_LOCAL( const AF_ScriptClassRec )    af_latin_script_class;
+
+ /***************************************************************************/
+ /***************************************************************************/
+ /*****                                                                 *****/
+ /*****       L A T I N   G L O B A L   M E T R I C S                   *****/
+ /*****                                                                 *****/
+ /***************************************************************************/
+ /***************************************************************************/
+
+ /*
+  * the following declarations could be embedded in the file "aflatin.c"
+  * they've been made semi-public to allow alternate script hinters to
+  * re-use some of them
+  */
+
+ /*
+  *  Latin (global) metrics management
+  *
+  */
+
+  enum
+  {
+    AF_LATIN_BLUE_CAPITAL_TOP,
+    AF_LATIN_BLUE_CAPITAL_BOTTOM,
+    AF_LATIN_BLUE_SMALL_F_TOP,
+    AF_LATIN_BLUE_SMALL_TOP,
+    AF_LATIN_BLUE_SMALL_BOTTOM,
+    AF_LATIN_BLUE_SMALL_MINOR,
+
+    AF_LATIN_BLUE_MAX
+  };
+
+#define AF_LATIN_IS_TOP_BLUE( b )  ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \
+                                     (b) == AF_LATIN_BLUE_SMALL_F_TOP || \
+                                     (b) == AF_LATIN_BLUE_SMALL_TOP   )
+
+#define  AF_LATIN_MAX_WIDTHS     16
+#define  AF_LATIN_MAX_BLUES      AF_LATIN_BLUE_MAX
+
+  enum
+  {
+    AF_LATIN_BLUE_ACTIVE = (1 << 0),
+    AF_LATIN_BLUE_TOP    = (1 << 1),
+
+    AF_LATIN_BLUE_FLAG_MAX
+  };
+
+
+  typedef struct AF_LatinBlueRec_
+  {
+    AF_WidthRec   ref;
+    AF_WidthRec   shoot;
+    FT_UInt       flags;
+
+  } AF_LatinBlueRec, *AF_LatinBlue;
+
+
+  typedef struct AF_LatinAxisRec_
+  {
+    FT_Fixed         scale;
+    FT_Pos           delta;
+
+    FT_UInt          width_count;
+    AF_WidthRec      widths[ AF_LATIN_MAX_WIDTHS ];
+    FT_Pos           edge_distance_threshold;
+
+   /* ignored for horizontal metrics */
+    FT_Bool          control_overshoot;
+    FT_UInt          blue_count;
+    AF_LatinBlueRec  blues[ AF_LATIN_BLUE_MAX ];
+
+    FT_Fixed         org_scale;
+    FT_Pos           org_delta;
+
+  } AF_LatinAxisRec, *AF_LatinAxis;
+
+
+  typedef struct AF_LatinMetricsRec_
+  {
+    AF_ScriptMetricsRec   root;
+    FT_UInt               units_per_em;
+    AF_LatinAxisRec       axis[ AF_DIMENSION_MAX ];
+
+  } AF_LatinMetricsRec, *AF_LatinMetrics;
+
+
+
+  FT_LOCAL( FT_Error )
+  af_latin_metrics_init( AF_LatinMetrics  metrics,
+                         FT_Face          face );
+
+  FT_LOCAL( void )
+  af_latin_metrics_scale( AF_LatinMetrics  metrics,
+                          AF_Scaler        scaler );
+
+
+
+ /***************************************************************************/
+ /***************************************************************************/
+ /*****                                                                 *****/
+ /*****            L A T I N   G L Y P H   A N A L Y S I S              *****/
+ /*****                                                                 *****/
+ /***************************************************************************/
+ /***************************************************************************/
+
+  enum
+  {
+    AF_LATIN_HINTS_HORZ_SNAP   = (1 << 0),  /* enable stem width snapping  */
+    AF_LATIN_HINTS_VERT_SNAP   = (1 << 1),  /* enable stem height snapping */
+    AF_LATIN_HINTS_STEM_ADJUST = (1 << 2),  /* enable stem width/height adjustment */
+    AF_LATIN_HINTS_MONO        = (1 << 3)   /* indicate monochrome rendering */
+  };
+
+#define  AF_LATIN_HINTS_DO_HORZ_SNAP(h) \
+   AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_HORZ_SNAP)
+
+#define  AF_LATIN_HINTS_DO_VERT_SNAP(h) \
+   AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_VERT_SNAP)
+
+#define  AF_LATIN_HINTS_DO_STEM_ADJUST(h)  \
+   AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_STEM_ADJUST)
+
+#define  AF_LATIN_HINTS_DO_MONO(h)  \
+   AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_MONO)
+
+
+ /* this shouldn't normally be exported. However, other scripts might
+  * like to use this function as-is
+  */
+  FT_LOCAL( void )
+  af_latin_hints_compute_segments( AF_GlyphHints  hints,
+                                   AF_Dimension   dim );
+
+ /* this shouldn't normally be exported. However, other scripts might
+  * want to use this function as-is
+  */
+  FT_LOCAL( void )
+  af_latin_hints_link_segments( AF_GlyphHints  hints,
+                                AF_Dimension   dim );
+
+ /* this shouldn't normally be exported. However, other scripts might
+  * want to use this function as-is
+  */
+  FT_LOCAL( void )
+  af_latin_hints_compute_edges( AF_GlyphHints  hints,
+                                AF_Dimension   dim );
+
+  FT_LOCAL( void )
+  af_latin_hints_detect_features( AF_GlyphHints  hints,
+                                  AF_Dimension   dim );
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AFLATIN_H__ */

reactos/lib/freetype/src/autofit
afloader.c 1.2 -> 1.3
diff -N afloader.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afloader.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,441 @@
+#include "afloader.h"
+#include "afhints.h"
+#include "afglobal.h"
+#include "aflatin.h"
+
+  FT_LOCAL_DEF( FT_Error )
+  af_loader_init( AF_Loader  loader,
+                  FT_Memory  memory )
+  {
+    FT_Error  error;
+
+    FT_ZERO( loader );
+
+    af_glyph_hints_init( &loader->hints, memory );
+
+    error = FT_GlyphLoader_New( memory, &loader->gloader );
+    if ( !error )
+    {
+      error = FT_GlyphLoader_CreateExtra( loader->gloader );
+      if ( error )
+      {
+        FT_GlyphLoader_Done( loader->gloader );
+        loader->gloader = NULL;
+      }
+    }
+    return error;
+  }
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_loader_reset( AF_Loader   loader,
+                   FT_Face     face )
+  {
+    FT_Error   error = 0;
+
+    loader->face    = face;
+    loader->globals = (AF_FaceGlobals) face->autohint.data;
+
+    FT_GlyphLoader_Rewind( loader->gloader );
+
+    if ( loader->globals == NULL )
+    {
+      error = af_face_globals_new( face, &loader->globals );
+      if ( !error )
+      {
+        face->autohint.data      = (FT_Pointer) loader->globals;
+        face->autohint.finalizer = (FT_Generic_Finalizer) af_face_globals_free;
+      }
+    }
+    return error;
+  }
+
+
+  FT_LOCAL_DEF( void )
+  af_loader_done( AF_Loader   loader )
+  {
+    loader->face    = NULL;
+    loader->globals = NULL;
+
+    FT_GlyphLoader_Done( loader->gloader );
+    loader->gloader = NULL;
+  }
+
+
+  static FT_Error
+  af_loader_load_g( AF_Loader  loader,
+                    AF_Scaler  scaler,
+                    FT_UInt    glyph_index,
+                    FT_Int32   load_flags,
+                    FT_UInt    depth )
+  {
+    FT_Error          error    = 0;
+    FT_Face           face     = loader->face;
+    FT_GlyphLoader    gloader  = loader->gloader;
+    AF_ScriptMetrics  metrics  = loader->metrics;
+    AF_GlyphHints     hints    = &loader->hints;
+    FT_GlyphSlot      slot     = face->glyph;
+    FT_Slot_Internal  internal = slot->internal;
+
+    error = FT_Load_Glyph( face, glyph_index, load_flags );
+    if ( error )
+      goto Exit;
+
+    loader->transformed = internal->glyph_transformed;
+    if ( loader->transformed )
+    {
+      FT_Matrix  inverse;
+
+      loader->trans_matrix = internal->glyph_matrix;
+      loader->trans_delta  = internal->glyph_delta;
+
+      inverse = loader->trans_matrix;
+      FT_Matrix_Invert( &inverse );
+      FT_Vector_Transform( &loader->trans_delta, &inverse );
+    }
+
+    /* set linear metrics */
+    slot->linearHoriAdvance = slot->metrics.horiAdvance;
+    slot->linearVertAdvance = slot->metrics.vertAdvance;
+
+    switch ( slot->format )
+    {
+      case FT_GLYPH_FORMAT_OUTLINE:
+       /* translate the loaded glyph when an internal transform
+        * is needed
+        */
+        if ( loader->transformed )
+        {
+          FT_Vector*  point = slot->outline.points;
+          FT_Vector*  limit = point + slot->outline.n_points;
+
+          for ( ; point < limit; point++ )
+          {
+            point->x += loader->trans_delta.x;
+            point->y += loader->trans_delta.y;
+          }
+        }
+
+        /* copy the outline points in the loader's current               */
+        /* extra points which is used to keep original glyph coordinates */
+        error = FT_GlyphLoader_CheckPoints( gloader,
+                                            slot->outline.n_points + 4,
+                                            slot->outline.n_contours );
+        if ( error )
+          goto Exit;
+
+        FT_ARRAY_COPY( gloader->current.outline.points,
+                       slot->outline.points,
+                       slot->outline.n_points );
+
+        FT_ARRAY_COPY( gloader->current.extra_points,
+                       slot->outline.points,
+                       slot->outline.n_points );
+
+        FT_ARRAY_COPY( gloader->current.outline.contours,
+                       slot->outline.contours,
+                       slot->outline.n_contours );
+
+        FT_ARRAY_COPY( gloader->current.outline.tags,
+                       slot->outline.tags,
+                       slot->outline.n_points );
+
+        gloader->current.outline.n_points   = slot->outline.n_points;
+        gloader->current.outline.n_contours = slot->outline.n_contours;
+
+        /* compute original horizontal phantom points (and ignore */
+        /* vertical ones)                                         */
+        loader->pp1.x = hints->x_delta;
+        loader->pp1.y = hints->y_delta;
+        loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,
+                                   hints->x_scale ) + hints->x_delta;
+        loader->pp2.y = hints->y_delta;
+
+        /* be sure to check for spacing glyphs */
+        if ( slot->outline.n_points == 0 )
+          goto Hint_Metrics;
+
+        /* now load the slot image into the auto-outline and run the */
+        /* automatic hinting process                                 */
+        error = metrics->clazz->script_hints_init( hints,
+                                                   &gloader->current.outline,
+                                                   metrics );
+        if ( error )
+          goto Exit;
+
+        /* apply the hints */
+        metrics->clazz->script_hints_apply( hints,
+                                            &gloader->current.outline,
+                                            metrics );
+        /* we now need to hint the metrics according to the change in */
+        /* width/positioning that occured during the hinting process  */
+        {
+          FT_Pos        old_advance, old_rsb, old_lsb, new_lsb;
+          AF_AxisHints  axis  = &hints->axis[ AF_DIMENSION_HORZ ];
+          AF_Edge       edge1 = axis->edges;    /* leftmost edge  */
+          AF_Edge       edge2 = edge1 + axis->num_edges - 1; /* rightmost edge */
+
+
+          old_advance = loader->pp2.x;
+          old_rsb     = old_advance - edge2->opos;
+          old_lsb     = edge1->opos;
+          new_lsb     = edge1->pos;
+
+          loader->pp1.x = FT_PIX_ROUND( new_lsb    - old_lsb );
+          loader->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
+
+#if 0
+          /* try to fix certain bad advance computations */
+          if ( loader->pp2.x + loader->pp1.x == edge2->pos && old_rsb > 4 )
+            loader->pp2.x += 64;
+#endif
+        }
+
+        /* good, we simply add the glyph to our loader's base */
+        FT_GlyphLoader_Add( gloader );
+        break;
+
+    case FT_GLYPH_FORMAT_COMPOSITE:
+      {
+        FT_UInt      nn, num_subglyphs = slot->num_subglyphs;
+        FT_UInt      num_base_subgs, start_point;
+        FT_SubGlyph  subglyph;
+
+
+        start_point = gloader->base.outline.n_points;
+
+        /* first of all, copy the subglyph descriptors in the glyph loader */
+        error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs );
+        if ( error )
+          goto Exit;
+
+        FT_ARRAY_COPY( gloader->current.subglyphs,
+                       slot->subglyphs,
+                       num_subglyphs );
+
+        gloader->current.num_subglyphs = num_subglyphs;
+        num_base_subgs = gloader->base.num_subglyphs;
+
+        /* now, read each subglyph independently */
+        for ( nn = 0; nn < num_subglyphs; nn++ )
+        {
+          FT_Vector  pp1, pp2;
+          FT_Pos     x, y;
+          FT_UInt    num_points, num_new_points, num_base_points;
+
+
+          /* gloader.current.subglyphs can change during glyph loading due */
+          /* to re-allocation -- we must recompute the current subglyph on */
+          /* each iteration                                                */
+          subglyph = gloader->base.subglyphs + num_base_subgs + nn;
+
+          pp1 = loader->pp1;
+          pp2 = loader->pp2;
+
+          num_base_points = gloader->base.outline.n_points;
+
+          error = af_loader_load_g( loader, scaler, subglyph->index,
+                                    load_flags, depth + 1 );
+          if ( error )
+            goto Exit;
+
+          /* recompute subglyph pointer */
+          subglyph = gloader->base.subglyphs + num_base_subgs + nn;
+
+          if ( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS )
+          {
+            pp1 = loader->pp1;
+            pp2 = loader->pp2;
+          }
+          else
+          {
+            loader->pp1 = pp1;
+            loader->pp2 = pp2;
+          }
+
+          num_points     = gloader->base.outline.n_points;
+          num_new_points = num_points - num_base_points;
+
+          /* now perform the transform required for this subglyph */
+
+          if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE    |
+                                   FT_SUBGLYPH_FLAG_XY_SCALE |
+                                   FT_SUBGLYPH_FLAG_2X2      ) )
+          {
+            FT_Vector*  cur   = gloader->base.outline.points +
+                                num_base_points;
+            FT_Vector*  org   = gloader->base.extra_points +
+                                num_base_points;
+            FT_Vector*  limit = cur + num_new_points;
+
+
+            for ( ; cur < limit; cur++, org++ )
+            {
+              FT_Vector_Transform( cur, &subglyph->transform );
+              FT_Vector_Transform( org, &subglyph->transform );
+            }
+          }
+
+          /* apply offset */
+
+          if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) )
+          {
+            FT_Int      k = subglyph->arg1;
+            FT_UInt     l = subglyph->arg2;
+            FT_Vector*  p1;
+            FT_Vector*  p2;
+
+
+            if ( start_point + k >= num_base_points         ||
+                               l >= (FT_UInt)num_new_points )
+            {
+              error = FT_Err_Invalid_Composite;
+              goto Exit;
+            }
+
+            l += num_base_points;
+
+            /* for now, only use the current point coordinates;    */
+            /* we may consider another approach in the near future */
+            p1 = gloader->base.outline.points + start_point + k;
+            p2 = gloader->base.outline.points + start_point + l;
+
+            x = p1->x - p2->x;
+            y = p1->y - p2->y;
+          }
+          else
+          {
+            x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta;
+            y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta;
+
+            x = FT_PIX_ROUND(x);
+            y = FT_PIX_ROUND(y);
+          }
+
+          {
+            FT_Outline  dummy = gloader->base.outline;
+
+
+            dummy.points  += num_base_points;
+            dummy.n_points = (short)num_new_points;
+
+            FT_Outline_Translate( &dummy, x, y );
+          }
+        }
+      }
+      break;
+
+    default:
+      /* we don't support other formats (yet?) */
+      error = FT_Err_Unimplemented_Feature;
+    }
+
+  Hint_Metrics:
+    if ( depth == 0 )
+    {
+      FT_BBox  bbox;
+
+
+      /* transform the hinted outline if needed */
+      if ( loader->transformed )
+        FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
+
+      /* we must translate our final outline by -pp1.x and compute */
+      /* the new metrics                                           */
+      if ( loader->pp1.x )
+        FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
+
+      FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
+
+      bbox.xMin  = FT_PIX_FLOOR(  bbox.xMin );
+      bbox.yMin  = FT_PIX_FLOOR(  bbox.yMin );
+      bbox.xMax  = FT_PIX_CEIL( bbox.xMax );
+      bbox.yMax  = FT_PIX_CEIL( bbox.yMax );
+
+      slot->metrics.width        = bbox.xMax - bbox.xMin;
+      slot->metrics.height       = bbox.yMax - bbox.yMin;
+      slot->metrics.horiBearingX = bbox.xMin;
+      slot->metrics.horiBearingY = bbox.yMax;
+
+      /* for mono-width fonts (like Andale, Courier, etc.) we need */
+      /* to keep the original rounded advance width                */
+#if 0
+      if ( !FT_IS_FIXED_WIDTH( slot->face ) )
+        slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
+      else
+        slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
+                                               x_scale );
+#else
+      slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
+#endif
+
+      slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
+
+      /* now copy outline into glyph slot */
+      FT_GlyphLoader_Rewind( internal->loader );
+      error = FT_GlyphLoader_CopyPoints( internal->loader, gloader );
+      if ( error )
+        goto Exit;
+
+      slot->outline = internal->loader->base.outline;
+      slot->format  = FT_GLYPH_FORMAT_OUTLINE;
+    }
+
+#ifdef DEBUG_HINTER
+    af_debug_hinter = hinter;
+#endif
+
+  Exit:
+    return error;
+  }
+
+
+
+
+  FT_LOCAL_DEF( FT_Error )
+  af_loader_load_glyph( AF_Loader  loader,
+                        FT_Face    face,
+                        FT_UInt    gindex,
+                        FT_UInt32  load_flags )
+  {
+    FT_Error      error;
+    FT_Size       size = face->size;
+    AF_ScalerRec  scaler;
+
+    if ( !size )
+      return FT_Err_Invalid_Argument;
+
+    FT_ZERO( &scaler );
+
+    scaler.face    = face;
+    scaler.x_scale = size->metrics.x_scale;
+    scaler.x_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */
+    scaler.y_scale = size->metrics.y_scale;
+    scaler.y_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */
+
+    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
+    scaler.flags       = 0;  /* XXX: fix this */
+
+    error = af_loader_reset( loader, face );
+    if ( !error )
+    {
+      AF_ScriptMetrics  metrics;
+
+      error = af_face_globals_get_metrics( loader->globals, gindex, &metrics );
+      if ( !error )
+      {
+        loader->metrics = metrics;
+
+        metrics->scaler = scaler;
+
+        if ( metrics->clazz->script_metrics_scale )
+          metrics->clazz->script_metrics_scale( metrics, &scaler );
+
+        load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
+        load_flags &= ~FT_LOAD_RENDER;
+
+        error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );
+      }
+    }
+    return error;
+  }

reactos/lib/freetype/src/autofit
afloader.h 1.2 -> 1.3
diff -N afloader.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afloader.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,50 @@
+#ifndef __AF_LOADER_H__
+#define __AF_LOADER_H__
+
+#include "afhints.h"
+#include "afglobal.h"
+
+FT_BEGIN_HEADER
+
+  typedef struct AF_LoaderRec_
+  {
+    FT_Face           face;           /* current face */
+    AF_FaceGlobals    globals;        /* current face globals */
+    FT_GlyphLoader    gloader;        /* glyph loader */
+    AF_GlyphHintsRec  hints;
+    AF_ScriptMetrics  metrics;
+    FT_Bool           transformed;
+    FT_Matrix         trans_matrix;
+    FT_Vector         trans_delta;
+    FT_Vector         pp1;
+    FT_Vector         pp2;
+    /* we don't handle vertical phantom points */
+
+  } AF_LoaderRec, *AF_Loader;
+
+
+  FT_LOCAL( FT_Error )
+  af_loader_init( AF_Loader  loader,
+                  FT_Memory  memory );
+
+
+  FT_LOCAL( FT_Error )
+  af_loader_reset( AF_Loader  loader,
+                   FT_Face    face );
+
+
+  FT_LOCAL( void )
+  af_loader_done( AF_Loader  loader );
+
+
+  FT_LOCAL( FT_Error )
+  af_loader_load_glyph( AF_Loader  loader,
+                        FT_Face    face,
+                        FT_UInt    gindex,
+                        FT_UInt32  load_flags );
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AF_LOADER_H__ */

reactos/lib/freetype/src/autofit
afmodule.c 1.2 -> 1.3
diff -N afmodule.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afmodule.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,70 @@
+#include "afmodule.h"
+#include "afloader.h"
+#include FT_INTERNAL_OBJECTS_H
+
+  typedef struct  FT_AutofitterRec_
+  {
+    FT_ModuleRec  root;
+    AF_LoaderRec  loader[1];
+
+  } FT_AutofitterRec, *FT_Autofitter;
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  af_autofitter_init( FT_Autofitter  module )
+  {
+    return af_loader_init( module->loader, module->root.library->memory );
+  }
+
+
+  FT_CALLBACK_DEF( void )
+  af_autofitter_done( FT_Autofitter  module )
+  {
+    af_loader_done( module->loader );
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  af_autofitter_load_glyph( FT_Autofitter  module,
+                            FT_GlyphSlot   slot,
+                            FT_Size        size,
+                            FT_UInt        glyph_index,
+                            FT_Int32       load_flags )
+  {
+    FT_UNUSED(size);
+
+    return af_loader_load_glyph( module->loader, slot->face,
+                                 glyph_index, load_flags );
+  }
+
+
+
+  FT_CALLBACK_TABLE_DEF
+  const FT_AutoHinter_ServiceRec  af_autofitter_service =
+  {
+    NULL,
+    NULL,
+    NULL,
+    (FT_AutoHinter_GlyphLoadFunc) af_autofitter_load_glyph
+  };
+
+
+  FT_CALLBACK_TABLE_DEF
+  const FT_Module_Class  autofit_module_class =
+  {
+    FT_MODULE_HINTER,
+    sizeof ( FT_AutofitterRec ),
+
+    "autofitter",
+    0x10000L,   /* version 1.0 of the autofitter  */
+    0x20000L,   /* requires FreeType 2.0 or above */
+
+    (const void*) &af_autofitter_service,
+
+    (FT_Module_Constructor) af_autofitter_init,
+    (FT_Module_Destructor)  af_autofitter_done,
+    (FT_Module_Requester)   0
+  };
+
+
+/* END */

reactos/lib/freetype/src/autofit
afmodule.h 1.2 -> 1.3
diff -N afmodule.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ afmodule.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,16 @@
+#ifndef __AFMODULE_H__
+#define __AFMODULE_H__
+
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
+FT_BEGIN_HEADER
+
+  FT_CALLBACK_TABLE
+  const FT_Module_Class  autofit_module_class;
+
+
+FT_END_HEADER
+
+#endif /* __AFMODULE_H__ */

reactos/lib/freetype/src/autofit
aftypes.h 1.2 -> 1.3
diff -N aftypes.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aftypes.h	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,268 @@
+#ifndef __AFTYPES_H__
+#define __AFTYPES_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_OUTLINE_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
+
+FT_BEGIN_HEADER
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                D E B U G G I N G                               *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+#define xxAF_DEBUG
+
+#ifdef AF_DEBUG
+
+#  include <stdio.h>
+#  define AF_LOG( x )  printf x
+
+#else
+
+#  define AF_LOG( x )  do ; while ( 0 ) /* nothing */
+
+#endif /* AF_DEBUG */
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                U T I L I T Y                                   *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+  typedef struct AF_WidthRec_
+  {
+    FT_Pos  org;  /* original position/width in font units              */
+    FT_Pos  cur;  /* current/scaled position/width in device sub-pixels */
+    FT_Pos  fit;  /* current/fitted position/width in device sub-pixels */
+
+  } AF_WidthRec, *AF_Width;
+
+
+  FT_LOCAL( void )
+  af_sort_pos( FT_UInt   count,
+               FT_Pos*   table );
+
+  FT_LOCAL( void )
+  af_sort_widths( FT_UInt   count,
+                  AF_Width  widths );
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                A N G L E   T Y P E S                           *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+ /*
+  *  Angle type. The auto-fitter doesn't need a very high angular accuracy,
+  *  and this allows us to speed up some computations considerably with a
+  *  light Cordic algorithm (see afangles.c)
+  *
+  */
+
+  typedef FT_Int    AF_Angle;
+
+#define  AF_ANGLE_PI     128
+#define  AF_ANGLE_2PI    (AF_ANGLE_PI*2)
+#define  AF_ANGLE_PI2    (AF_ANGLE_PI/2)
+#define  AF_ANGLE_PI4    (AF_ANGLE_PI/4)
+
+ /*
+  *  compute the angle of a given 2-D vector
+  *
+  */
+  FT_LOCAL( AF_Angle )
+  af_angle_atan( FT_Pos  dx,
+                 FT_Pos  dy );
+
+
+ /*
+  *  computes "angle2 - angle1", the result is always within
+  *  the range [ -AF_ANGLE_PI .. AF_ANGLE_PI-1 ]
+  *
+  */
+  FT_LOCAL( AF_Angle )
+  af_angle_diff( AF_Angle  angle1,
+                 AF_Angle  angle2 );
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                O U T L I N E S                                 *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+ /* opaque handle to glyph-specific hints. see "afhints.h" for more
+  * details
+  */
+  typedef struct AF_GlyphHintsRec_*     AF_GlyphHints;
+
+ /* this structure is used to model an input glyph outline to
+  * the auto-hinter. The latter will set the "hints" field
+  * depending on the glyph's script
+  */
+  typedef struct AF_OutlineRec_
+  {
+    FT_Face          face;
+    FT_Outline       outline;
+    FT_UInt          outline_resolution;
+
+    FT_Int           advance;
+    FT_UInt          metrics_resolution;
+
+    AF_GlyphHints    hints;
+
+  } AF_OutlineRec;
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                S C A L E R S                                   *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+ /*
+  *  A scaler models the target pixel device that will receive the
+  *  auto-hinted glyph image
+  *
+  */
+
+  typedef enum
+  {
+    AF_SCALER_FLAG_NO_HORIZONTAL = 1,  /* disable horizontal hinting */
+    AF_SCALER_FLAG_NO_VERTICAL   = 2,  /* disable vertical hinting   */
+    AF_SCALER_FLAG_NO_ADVANCE    = 4   /* disable advance hinting    */
+
+  } AF_ScalerFlags;
+
+
+  typedef struct AF_ScalerRec_
+  {
+    FT_Face         face;         /* source font face                        */
+    FT_Fixed        x_scale;      /* from font units to 1/64th device pixels */
+    FT_Fixed        y_scale;      /* from font units to 1/64th device pixels */
+    FT_Pos          x_delta;      /* in 1/64th device pixels                 */
+    FT_Pos          y_delta;      /* in 1/64th device pixels                 */
+    FT_Render_Mode  render_mode;  /* monochrome, anti-aliased, LCD, etc..    */
+    FT_UInt32       flags;        /* additionnal control flags, see above    */
+
+  } AF_ScalerRec, *AF_Scaler;
+
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /*****                                                                *****/
+ /*****                S C R I P T S                                   *****/
+ /*****                                                                *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+ /*
+  *  the list of know scripts. Each different script correspond to the
+  *  following information:
+  *
+  *   - a set of Unicode ranges to test weither the face supports the
+  *     script
+  *
+  *   - a specific global analyzer that will compute global metrics
+  *     specific to the script.
+  *
+  *   - a specific glyph analyzer that will compute segments and
+  *     edges for each glyph covered by the script
+  *
+  *   - a specific grid-fitting algorithm that will distort the
+  *     scaled glyph outline according to the results of the glyph
+  *     analyzer
+  *
+  *  note that a given analyzer and/or grid-fitting algorithm can be
+  *  used by more than one script
+  */
+  typedef enum
+  {
+    AF_SCRIPT_NONE  = 0,
+    AF_SCRIPT_LATIN = 1,
+    /* add new scripts here. don't forget to update the list in "afglobal.c" */
+
+    AF_SCRIPT_MAX   /* do not remove */
+
+  } AF_Script;
+
+
+
+  typedef struct AF_ScriptClassRec_ const*  AF_ScriptClass;
+
+  typedef struct AF_ScriptMetricsRec_
+  {
+    AF_ScriptClass    clazz;
+    AF_ScalerRec      scaler;
+
+  } AF_ScriptMetricsRec, *AF_ScriptMetrics;
+
+
+ /* this function parses a FT_Face to compute global metrics for
+  * a specific script
+  */
+  typedef FT_Error  (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics   metrics,
+                                                  FT_Face            face );
+
+  typedef void      (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics  metrics,
+                                                   AF_Scaler         scaler );
+
+  typedef void      (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics   metrics );
+
+
+  typedef FT_Error  (*AF_Script_InitHintsFunc)( AF_GlyphHints     hints,
+                                                FT_Outline*       outline,
+                                                AF_ScriptMetrics  metrics );
+
+  typedef void      (*AF_Script_ApplyHintsFunc)( AF_GlyphHints     hints,
+                                                 FT_Outline*       outline,
+                                                 AF_ScriptMetrics  metrics );
+
+
+  typedef struct AF_Script_UniRangeRec_
+  {
+    FT_UInt32    first;
+    FT_UInt32    last;
+
+  } AF_Script_UniRangeRec;
+
+  typedef const AF_Script_UniRangeRec *  AF_Script_UniRange;
+
+  typedef struct AF_ScriptClassRec_
+  {
+    AF_Script                   script;
+    AF_Script_UniRange          script_uni_ranges;  /* last must be { 0, 0 } */
+
+    FT_UInt                     script_metrics_size;
+    AF_Script_InitMetricsFunc   script_metrics_init;
+    AF_Script_ScaleMetricsFunc  script_metrics_scale;
+    AF_Script_DoneMetricsFunc   script_metrics_done;
+
+    AF_Script_InitHintsFunc     script_hints_init;
+    AF_Script_ApplyHintsFunc    script_hints_apply;
+
+  } AF_ScriptClassRec;
+
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __AFTYPES_H__ */

reactos/lib/freetype/src/autofit
autofit.c 1.2 -> 1.3
diff -N autofit.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ autofit.c	10 May 2004 17:48:29 -0000	1.3
@@ -0,0 +1,9 @@
+#define FT_MAKE_OPTION_SINGLE_OBJECT
+#include <ft2build.h>
+#include "afangles.c"
+#include "afglobal.c"
+#include "afhints.c"
+#include "afdummy.c"
+#include "aflatin.c"
+#include "afloader.c"
+#include "afmodule.c"

reactos/lib/freetype/src/autohint
ahglobal.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ahglobal.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ahglobal.c	10 May 2004 17:48:29 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Routines used to compute global metrics automatically (body).        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 Catharon Productions Inc.              */
+/*  Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc.        */
 /*  Author: David Turner                                                   */
 /*                                                                         */
 /*  This file is part of the Catharon Typography Project and shall only    */
@@ -30,7 +30,7 @@
   /* cf. AH_BLUE_XXX constants in ahtypes.h */
 
   static
-  const char*  blue_chars[AH_BLUE_MAX] =
+  const char* const  blue_chars[AH_BLUE_MAX] =
   {
     "THEZOCQS",
     "HEZLOCUS",
@@ -95,7 +95,7 @@
       goto Exit;
 
     /* we compute the blues simply by loading each character from the */
-    /* 'blue_chars[blues]' string, then compute its top-most or       */
+    /* `blue_chars[blues]' string, then compute its top-most or       */
     /* bottom-most points (depending on `AH_IS_TOP_BLUE')             */
 
     AH_LOG(( "blue zones computation\n" ));

reactos/lib/freetype/src/autohint
ahglyph.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ahglyph.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ahglyph.c	10 May 2004 17:48:30 -0000	1.6
@@ -5,7 +5,7 @@
 /*    Routines used to load and analyze a given glyph before hinting       */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 Catharon Productions Inc.              */
+/*  Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc.        */
 /*  Author: David Turner                                                   */
 /*                                                                         */
 /*  This file is part of the Catharon Typography Project and shall only    */
@@ -141,8 +141,8 @@
                         FT_Pos  dy )
   {
     AH_Direction  dir;
-    FT_Pos        ax = ABS( dx );
-    FT_Pos        ay = ABS( dy );
+    FT_Pos        ax = FT_ABS( dx );
+    FT_Pos        ay = FT_ABS( dy );
 
 
     dir = AH_DIR_NONE;
@@ -418,7 +418,7 @@
     /* first of all, reallocate the contours array if necessary */
     if ( num_contours > outline->max_contours )
     {
-      FT_Int  new_contours = ( num_contours + 3 ) & -4;
+      FT_Int  new_contours = FT_PAD_CEIL( num_contours, 4 );
 
 
       if ( FT_RENEW_ARRAY( outline->contours,
@@ -435,7 +435,7 @@
     /*                                                                   */
     if ( num_points + 2 > outline->max_points )
     {
-      FT_Int  news = ( num_points + 2 + 7 ) & -8;
+      FT_Int  news = FT_PAD_CEIL( num_points + 2, 8 );
       FT_Int  max  = outline->max_points;
 
 
@@ -884,8 +884,8 @@
         if ( point == last )  /* skip singletons -- just in case */
           continue;
 
-        if ( ABS( last->out_dir )  == major_dir &&
-             ABS( point->out_dir ) == major_dir )
+        if ( FT_ABS( last->out_dir )  == major_dir &&
+             FT_ABS( point->out_dir ) == major_dir )
         {
           /* we are already on an edge, try to locate its start */
           last = point;
@@ -893,7 +893,7 @@
           for (;;)
           {
             point = point->prev;
-            if ( ABS( point->out_dir ) != major_dir )
+            if ( FT_ABS( point->out_dir ) != major_dir )
             {
               point = point->next;
               break;
@@ -958,7 +958,7 @@
             passed = 1;
           }
 
-          if ( !on_edge && ABS( point->out_dir ) == major_dir )
+          if ( !on_edge && FT_ABS( point->out_dir ) == major_dir )
           {
             /* this is the start of a new segment! */
             segment_dir = point->out_dir;

reactos/lib/freetype/src/autohint
ahhint.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ahhint.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ahhint.c	10 May 2004 17:48:30 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Glyph hinter (body).                                                 */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 Catharon Productions Inc.              */
+/*  Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc.        */
 /*  Author: David Turner                                                   */
 /*                                                                         */
 /*  This file is part of the Catharon Typography Project and shall only    */
@@ -71,7 +71,7 @@
       }
     }
 
-    scaled = ( reference + 32 ) & -64;
+    scaled = FT_PIX_ROUND( reference );
 
     if ( width >= reference )
     {
@@ -167,7 +167,7 @@
             dist += delta;
         }
         else
-          dist = ( dist + 32 ) & -64;
+          dist = ( dist + 32 ) & ~63;
       }
     }
     else
@@ -181,7 +181,7 @@
         /* in the case of vertical hinting, always round */
         /* the stem heights to integer pixels            */
         if ( dist >= 64 )
-          dist = ( dist + 16 ) & -64;
+          dist = ( dist + 16 ) & ~63;
         else
           dist = 64;
       }
@@ -196,7 +196,7 @@
           if ( dist < 64 )
             dist = 64;
           else
-            dist = ( dist + 32 ) & -64;
+            dist = ( dist + 32 ) & ~63;
         }
         else
         {
@@ -207,10 +207,10 @@
             dist = ( dist + 64 ) >> 1;
 
           else if ( dist < 128 )
-            dist = ( dist + 22 ) & -64;
+            dist = ( dist + 22 ) & ~63;
           else
             /* XXX: round otherwise to prevent color fringes in LCD mode */
-            dist = ( dist + 32 ) & -64;
+            dist = ( dist + 32 ) & ~63;
         }
       }
     }
@@ -284,7 +284,7 @@
             dist += delta;
         }
         else
-          dist = ( dist + 32 ) & -64;
+          dist = ( dist + 32 ) & ~63;
       }
     }
     else
@@ -298,7 +298,7 @@
         /* in the case of vertical hinting, always round */
         /* the stem heights to integer pixels            */
         if ( dist >= 64 )
-          dist = ( dist + 16 ) & -64;
+          dist = ( dist + 16 ) & ~63;
         else
           dist = 64;
       }
@@ -313,7 +313,7 @@
           if ( dist < 64 )
             dist = 64;
           else
-            dist = ( dist + 32 ) & -64;
+            dist = ( dist + 32 ) & ~63;
         }
         else
         {
@@ -324,10 +324,10 @@
             dist = ( dist + 64 ) >> 1;
 
           else if ( dist < 128 )
-            dist = ( dist + 22 ) & -64;
+            dist = ( dist + 22 ) & ~63;
           else
             /* XXX: round otherwise to prevent color fringes in LCD mode */
-            dist = ( dist + 32 ) & -64;
+            dist = ( dist + 32 ) & ~63;
         }
       }
     }
@@ -396,7 +396,7 @@
     if ( base->flags & AH_EDGE_DONE )
     {
       if ( dist >= 64 )
-        dist = ( dist + 8 ) & -64;
+        dist = ( dist + 8 ) & ~63;
 
       else if ( dist <= 32 && !vertical )
         dist = ( dist + 33 ) >> 1;
@@ -545,7 +545,7 @@
           {
             org_center = edge->opos + ( org_len >> 1 );
 
-            cur_pos1   = ( org_center + 32 ) & -64;
+            cur_pos1   = FT_PIX_ROUND( org_center );
 
             error1 = org_center - ( cur_pos1 - u_off );
             if ( error1 < 0 )
@@ -565,7 +565,7 @@
 
           }
           else
-            edge->pos = ( edge->opos + 32 ) & -64;
+            edge->pos = FT_PIX_ROUND( edge->opos );
 
           anchor = edge;
 
@@ -575,7 +575,7 @@
 
 #else /* !FT_CONFIG_CHESTER_STEM */
 
-          edge->pos = ( edge->opos + 32 ) & -64;
+          edge->pos = FT_PIX_ROUND( edge->opos );
           anchor    = edge;
 
           edge->flags |= AH_EDGE_DONE;
@@ -614,7 +614,7 @@
             FT_Pos  u_off, d_off;
 
 
-            cur_pos1 = ( org_center + 32 ) & -64;
+            cur_pos1 = FT_PIX_ROUND( org_center );
 
             if (cur_len <= 64 )
               u_off = d_off = 32;
@@ -649,12 +649,12 @@
             cur_len    = ah_compute_stem_width( hinter, dimension, org_len,
                                                 edge->flags, edge2->flags );
 
-            cur_pos1   = ( org_pos + 32 ) & -64;
+            cur_pos1   = FT_PIX_ROUND( org_pos );
             delta1     = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
             if ( delta1 < 0 )
               delta1 = -delta1;
 
-            cur_pos2   = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
+            cur_pos2   = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
             delta2     = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
             if ( delta2 < 0 )
               delta2 = -delta2;
@@ -665,12 +665,12 @@
 
 #else /* !FT_CONFIG_CHESTER_STEM */
 
-          cur_pos1   = ( org_pos + 32 ) & -64;
+          cur_pos1   = FT_PIX_ROUND( org_pos );
           delta1     = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
           if ( delta1 < 0 )
             delta1 = -delta1;
 
-          cur_pos2   = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
+          cur_pos2   = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
           delta2     = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
           if ( delta2 < 0 )
             delta2 = -delta2;
@@ -703,7 +703,7 @@
       /* the third (lowest) stem aligns with the base line; it might end up */
       /* one pixel higher or lower.                                         */
 
-      n_edges = edge_limit - edges;
+      n_edges = (FT_Int)( edge_limit - edges );
       if ( !dimension && ( n_edges == 6 || n_edges == 12 ) )
       {
         AH_EdgeRec  *edge1, *edge2, *edge3;
@@ -764,12 +764,12 @@
           ah_align_serif_edge( hinter, edge->serif, edge, dimension );
         else if ( !anchor )
         {
-          edge->pos = ( edge->opos + 32 ) & -64;
+          edge->pos = FT_PIX_ROUND( edge->opos );
           anchor    = edge;
         }
         else
           edge->pos = anchor->pos +
-                      ( ( edge->opos-anchor->opos + 32 ) & -64 );
+                      FT_PIX_ROUND( edge->opos - anchor->opos );
 
         edge->flags |= AH_EDGE_DONE;
 
@@ -943,7 +943,7 @@
 
             /* find enclosing edges */
             min = 0;
-            max = edge_limit - edges;
+            max = (FT_UInt)( edge_limit - edges );
 
             while ( min < max )
             {
@@ -1299,15 +1299,16 @@
       if ( delta2 < 32 )
         delta2 = 0;
       else if ( delta2 < 64 )
-        delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & -32 );
+        delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
       else
-        delta2 = ( delta2 + 32 ) & -64;
+        delta2 = FT_PIX_ROUND( delta2 );
 
       if ( delta < 0 )
         delta2 = -delta2;
 
       scaled->blue_refs[n] =
-        ( FT_MulFix( design->blue_refs[n], y_scale ) + 32 ) & -64;
+        FT_PIX_ROUND( FT_MulFix( design->blue_refs[n], y_scale ) );
+
       scaled->blue_shoots[n] = scaled->blue_refs[n] + delta2;
     }
 
@@ -1488,24 +1489,24 @@
 
       /* copy the outline points in the loader's current               */
       /* extra points which is used to keep original glyph coordinates */
-      error = ah_loader_check_points( gloader, slot->outline.n_points + 2,
+      error = ah_loader_check_points( gloader, slot->outline.n_points + 4,
                                       slot->outline.n_contours );
       if ( error )
         goto Exit;
 
-      FT_MEM_COPY( gloader->current.extra_points, slot->outline.points,
-                   slot->outline.n_points * sizeof ( FT_Vector ) );
+      FT_ARRAY_COPY( gloader->current.extra_points, slot->outline.points,
+                     slot->outline.n_points );
 
-      FT_MEM_COPY( gloader->current.outline.contours, slot->outline.contours,
-                   slot->outline.n_contours * sizeof ( short ) );
+      FT_ARRAY_COPY( gloader->current.outline.contours, slot->outline.contours,
+                     slot->outline.n_contours );
 
-      FT_MEM_COPY( gloader->current.outline.tags, slot->outline.tags,
-                   slot->outline.n_points * sizeof ( char ) );
+      FT_ARRAY_COPY( gloader->current.outline.tags, slot->outline.tags,
+                     slot->outline.n_points );
 
       gloader->current.outline.n_points   = slot->outline.n_points;
       gloader->current.outline.n_contours = slot->outline.n_contours;
 
-      /* compute original phantom points */
+      /* compute original horizontal phantom points, ignoring vertical ones */
       hinter->pp1.x = 0;
       hinter->pp1.y = 0;
       hinter->pp2.x = FT_MulFix( slot->metrics.horiAdvance, x_scale );
@@ -1539,6 +1540,7 @@
 
       /* we now need to hint the metrics according to the change in */
       /* width/positioning that occured during the hinting process  */
+      if ( outline->num_vedges > 0 )
       {
         FT_Pos   old_advance, old_rsb, old_lsb, new_lsb;
         AH_Edge  edge1 = outline->vert_edges;     /* leftmost edge  */
@@ -1551,8 +1553,8 @@
         old_lsb     = edge1->opos;
         new_lsb     = edge1->pos;
 
-        hinter->pp1.x = ( ( new_lsb    - old_lsb ) + 32 ) & -64;
-        hinter->pp2.x = ( ( edge2->pos + old_rsb ) + 32 ) & -64;
+        hinter->pp1.x = FT_PIX_ROUND( new_lsb    - old_lsb );
+        hinter->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
 
 #if 0
         /* try to fix certain bad advance computations */
@@ -1561,6 +1563,12 @@
 #endif
       }
 
+      else
+      {
+        hinter->pp1.x = ( hinter->pp1.x + 32 ) & -64;
+        hinter->pp2.x = ( hinter->pp2.x + 32 ) & -64;
+      }
+
       /* good, we simply add the glyph to our loader's base */
       ah_loader_add( gloader );
       break;
@@ -1579,8 +1587,8 @@
         if ( error )
           goto Exit;
 
-        FT_MEM_COPY( gloader->current.subglyphs, slot->subglyphs,
-                     num_subglyphs * sizeof ( FT_SubGlyph ) );
+        FT_ARRAY_COPY( gloader->current.subglyphs, slot->subglyphs,
+                       num_subglyphs );
 
         gloader->current.num_subglyphs = num_subglyphs;
         num_base_subgs = gloader->base.num_subglyphs;
@@ -1677,8 +1685,8 @@
             x = FT_MulFix( subglyph->arg1, x_scale );
             y = FT_MulFix( subglyph->arg2, y_scale );
 
-            x = ( x + 32 ) & -64;
-            y = ( y + 32 ) & -64;
+            x = FT_PIX_ROUND(x);
+            y = FT_PIX_ROUND(y);
           }
 
           {
@@ -1715,10 +1723,10 @@
         FT_Outline_Translate( &gloader->base.outline, -hinter->pp1.x, 0 );
 
       FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
-      bbox.xMin &= -64;
-      bbox.yMin &= -64;
-      bbox.xMax  = ( bbox.xMax + 63 ) & -64;
-      bbox.yMax  = ( bbox.yMax + 63 ) & -64;
+      bbox.xMin  = FT_PIX_FLOOR(  bbox.xMin );
+      bbox.yMin  = FT_PIX_FLOOR(  bbox.yMin );
+      bbox.xMax  = FT_PIX_CEIL( bbox.xMax );
+      bbox.yMax  = FT_PIX_CEIL( bbox.yMax );
 
       slot->metrics.width        = bbox.xMax - bbox.xMin;
       slot->metrics.height       = bbox.yMax - bbox.yMin;
@@ -1733,7 +1741,7 @@
         slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
                                                x_scale );
 
-      slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + 32 ) & -64;
+      slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
 
       /* now copy outline into glyph slot */
       ah_loader_rewind( slot->internal->loader );
@@ -1802,7 +1810,7 @@
       if ( shoot > 0 )
       {
         FT_Pos  scaled = FT_MulFix( shoot, y_scale );
-        FT_Pos  fitted = ( scaled + 32 ) & -64;
+        FT_Pos  fitted = FT_PIX_ROUND( scaled );
 
 
         if ( scaled != fitted )
@@ -1850,9 +1858,9 @@
 
     hinter->do_stem_adjust   = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
 
-
-    load_flags  |= FT_LOAD_NO_SCALE
-                 | FT_LOAD_IGNORE_TRANSFORM ;
+    load_flags |= FT_LOAD_NO_SCALE
+                | FT_LOAD_IGNORE_TRANSFORM;
+    load_flags &= ~FT_LOAD_RENDER;
 
     error = ah_hinter_load( hinter, glyph_index, load_flags, 0 );
 

reactos/lib/freetype/src/autohint
ahtypes.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ahtypes.h	21 Jan 2004 19:23:46 -0000	1.3
+++ ahtypes.h	10 May 2004 17:48:30 -0000	1.4
@@ -5,7 +5,7 @@
 /*    General types and definitions for the auto-hint module               */
 /*    (specification only).                                                */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 Catharon Productions Inc.              */
+/*  Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc.        */
 /*  Author: David Turner                                                   */
 /*                                                                         */
 /*  This file is part of the Catharon Typography Project and shall only    */
@@ -492,8 +492,9 @@
     AH_Outline       glyph;
 
     AH_Loader        loader;
-    FT_Vector        pp1;
+    FT_Vector        pp1;               /* horizontal phantom points */
     FT_Vector        pp2;
+    /* we ignore vertical phantom points */
 
     FT_Bool          transformed;
     FT_Vector        trans_delta;

reactos/lib/freetype/src/base
ftrfork.c added at 1.1
diff -N ftrfork.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftrfork.c	10 May 2004 17:48:31 -0000	1.1
@@ -0,0 +1,717 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftrfork.c                                                              */
+/*                                                                         */
+/*    Embedded resource forks accessor (body).                             */
+/*                                                                         */
+/*  Copyright 2004 by                                                      */
+/*  Masatake YAMATO and Redhat K.K.                                        */
+/*                                                                         */
+/*  FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are     */
+/*  derived from ftobjs.c.                                                 */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+/***************************************************************************/
+/* Development of the code in this file is support of                      */
+/* Information-technology Promotion Agency, Japan.                         */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_RFORK_H
+
+
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_raccess
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /****               Resource fork directory access                    ****/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  FT_BASE_DEF( FT_Error )
+  FT_Raccess_Get_HeaderInfo( FT_Library  library,
+                             FT_Stream   stream,
+                             FT_Long     rfork_offset,
+                             FT_Long    *map_offset,
+                             FT_Long    *rdata_pos )
+  {
+    FT_Error       error;
+    unsigned char  head[16], head2[16];
+    FT_Long        map_pos, rdata_len;
+    int            allzeros, allmatch, i;
+    FT_Long        type_list;
+
+    FT_UNUSED( library );
+
+
+    error = FT_Stream_Seek( stream, rfork_offset );
+    if ( error )
+      return error;
+
+    error = FT_Stream_Read( stream, (FT_Byte *)head, 16 );
+    if ( error )
+      return error;
+
+    *rdata_pos = rfork_offset + ( ( head[0] << 24 ) |
+                                  ( head[1] << 16 ) |
+                                  ( head[2] <<  8 ) |
+                                    head[3]         );
+    map_pos    = rfork_offset + ( ( head[4] << 24 ) |
+                                  ( head[5] << 16 ) |
+                                  ( head[6] <<  8 ) |
+                                    head[7]         );
+    rdata_len = ( head[ 8] << 24 ) |
+                ( head[ 9] << 16 ) |
+                ( head[10] <<  8 ) |
+                  head[11];
+
+    /* map_len = head[12] .. head[15] */
+
+    if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset )
+      return FT_Err_Unknown_File_Format;
+
+    error = FT_Stream_Seek( stream, map_pos );
+    if ( error )
+      return error;
+
+    head2[15] = (FT_Byte)( head[15] + 1 );       /* make it be different */
+
+    error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );
+    if ( error )
+      return error;
+
+    allzeros = 1;
+    allmatch = 1;
+    for ( i = 0; i < 16; ++i )
+    {
+      if ( head2[i] != 0 )
+        allzeros = 0;
+      if ( head2[i] != head[i] )
+        allmatch = 0;
+    }
+    if ( !allzeros && !allmatch )
+      return FT_Err_Unknown_File_Format;
+
+    /* If we have reached this point then it is probably a mac resource */
+    /* file.  Now, does it contain any interesting resources?           */
+    /* Skip handle to next resource map, the file resource number, and  */
+    /* attributes.                                                      */
+    (void)FT_STREAM_SKIP( 4        /* skip handle to next resource map */
+                          + 2      /* skip file resource number */
+                          + 2 );   /* skip attributes */
+
+    if ( FT_READ_USHORT( type_list ) )
+      return error;
+    if ( type_list == -1 )
+      return FT_Err_Unknown_File_Format;
+
+    error = FT_Stream_Seek( stream, map_pos + type_list );
+    if ( error )
+      return error;
+
+    *map_offset = map_pos + type_list;
+    return FT_Err_Ok;
+  }
+
+
+  FT_BASE_DEF( FT_Error )
+  FT_Raccess_Get_DataOffsets( FT_Library  library,
+                              FT_Stream   stream,
+                              FT_Long     map_offset,
+                              FT_Long     rdata_pos,
+                              FT_Long     tag,
+                              FT_Long   **offsets,
+                              FT_Long    *count )
+  {
+    FT_Error   error;
+    int        i, j, cnt, subcnt;
+    FT_Long    tag_internal, rpos;
+    FT_Memory  memory = library->memory;
+    FT_Long    temp;
+    FT_Long    *offsets_internal;
+
+
+    error = FT_Stream_Seek( stream, map_offset );
+    if ( error )
+      return error;
+
+    if ( FT_READ_USHORT( cnt ) )
+      return error;
+    cnt++;
+
+    for ( i = 0; i < cnt; ++i )
+    {
+      if ( FT_READ_LONG( tag_internal ) ||
+           FT_READ_USHORT( subcnt )     ||
+           FT_READ_USHORT( rpos )       )
+        return error;
+
+      FT_TRACE2(( "Resource tags: %c%c%c%c\n",
+                  (char)( 0xff & ( tag_internal >> 24 ) ),
+                  (char)( 0xff & ( tag_internal >> 16 ) ),
+                  (char)( 0xff & ( tag_internal >>  8 ) ),
+                  (char)( 0xff & ( tag_internal >>  0 ) ) ));
+
+      if ( tag_internal == tag )
+      {
+        *count = subcnt + 1;
+        rpos  += map_offset;
+
+        error = FT_Stream_Seek( stream, rpos );
+        if ( error )
+          return error;
+
+        if ( FT_ALLOC( offsets_internal, *count * sizeof( FT_Long ) ) )
+          return error;
+
+        for ( j = 0; j < *count; ++j )
+        {
+          (void)FT_STREAM_SKIP( 2 ); /* resource id */
+          (void)FT_STREAM_SKIP( 2 ); /* rsource name */
+
+          if ( FT_READ_LONG( temp ) )
+          {
+            FT_FREE( offsets_internal );
+            return error;
+          }
+
+          offsets_internal[j] = rdata_pos + ( temp & 0xFFFFFFL );
+
+          (void)FT_STREAM_SKIP( 4 ); /* mbz */
+        }
+
+        *offsets = offsets_internal;
+
+        return FT_Err_Ok;
+      }
+    }
+
+    return FT_Err_Cannot_Open_Resource;
+  }
+
+
+#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                                                                 ****/
+  /****                     Guessing functions                          ****/
+  /****                                                                 ****/
+  /****            When you add a new guessing function,                ****/
+  /****           update FT_RACCESS_N_RULES in ftrfork.h.               ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  typedef FT_Error
+  (*raccess_guess_func)( FT_Library  library,
+                         FT_Stream   stream,
+                         char *      base_file_name,
+                         char      **result_file_name,
+                         FT_Long    *result_offset );
+
+
+  static FT_Error
+  raccess_guess_apple_double( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_apple_single( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_darwin_ufs_export( FT_Library  library,
+                                   FT_Stream   stream,
+                                   char *      base_file_name,
+                                   char      **result_file_name,
+                                   FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_darwin_hfsplus( FT_Library  library,
+                                FT_Stream   stream,
+                                char *      base_file_name,
+                                char      **result_file_name,
+                                FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_vfat( FT_Library  library,
+                      FT_Stream   stream,
+                      char *      base_file_name,
+                      char      **result_file_name,
+                      FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_linux_cap( FT_Library  library,
+                           FT_Stream   stream,
+                           char *      base_file_name,
+                           char      **result_file_name,
+                           FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_linux_double( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_linux_netatalk( FT_Library  library,
+                                FT_Stream   stream,
+                                char *      base_file_name,
+                                char      **result_file_name,
+                                FT_Long    *result_offset );
+
+
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****                       Helper functions                          ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+
+  static FT_Error
+  raccess_guess_apple_generic( FT_Library  library,
+                               FT_Stream   stream,
+                               char *      base_file_name,
+                               FT_Int32    magic,
+                               FT_Long    *result_offset );
+
+  static FT_Error
+  raccess_guess_linux_double_from_file_name( FT_Library  library,
+                                             char *      file_name,
+                                             FT_Long    *result_offset );
+
+  static char *
+  raccess_make_file_name( FT_Memory    memory,
+                          const char  *original_name,
+                          const char  *insertion );
+
+
+  FT_BASE_DEF( void )
+  FT_Raccess_Guess( FT_Library  library,
+                    FT_Stream   stream,
+                    char*       base_name,
+                    char      **new_names,
+                    FT_Long    *offsets,
+                    FT_Error   *errors )
+  {
+    FT_Long  i;
+
+
+    raccess_guess_func  funcs[FT_RACCESS_N_RULES] =
+    {
+      raccess_guess_apple_double,
+      raccess_guess_apple_single,
+      raccess_guess_darwin_ufs_export,
+      raccess_guess_darwin_hfsplus,
+      raccess_guess_vfat,
+      raccess_guess_linux_cap,
+      raccess_guess_linux_double,
+      raccess_guess_linux_netatalk,
+    };
+
+    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
+    {
+      new_names[i] = NULL;
+      errors[i] = FT_Stream_Seek( stream, 0 );
+      if ( errors[i] )
+        continue ;
+
+      errors[i] = (funcs[i])( library, stream, base_name,
+                              &(new_names[i]), &(offsets[i]) );
+    }
+
+    return;
+  }
+
+
+  static FT_Error
+  raccess_guess_apple_double( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset )
+  {
+    FT_Int32  magic = ( 0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x07 );
+
+
+    *result_file_name = NULL;
+    return raccess_guess_apple_generic( library, stream, base_file_name,
+                                        magic, result_offset );
+  }
+
+
+  static FT_Error
+  raccess_guess_apple_single( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset )
+  {
+    FT_Int32  magic = (0x00 << 24 | 0x05 << 16 | 0x16 << 8 | 0x00);
+
+
+    *result_file_name = NULL;
+    return raccess_guess_apple_generic( library, stream, base_file_name,
+                                        magic, result_offset );
+  }
+
+
+  static FT_Error
+  raccess_guess_darwin_ufs_export( FT_Library  library,
+                                   FT_Stream   stream,
+                                   char *      base_file_name,
+                                   char      **result_file_name,
+                                   FT_Long    *result_offset )
+  {
+    char*      newpath;
+    FT_Error   error;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory  = library->memory;
+    newpath = raccess_make_file_name( memory, base_file_name, "._" );
+    if ( !newpath )
+      return FT_Err_Out_Of_Memory;
+
+    error = raccess_guess_linux_double_from_file_name( library, newpath,
+                                                       result_offset );
+    if ( !error )
+      *result_file_name = newpath;
+    else
+      FT_FREE( newpath );
+
+    return error;
+  }
+
+
+  static FT_Error
+  raccess_guess_darwin_hfsplus( FT_Library  library,
+                                FT_Stream   stream,
+                                char *      base_file_name,
+                                char      **result_file_name,
+                                FT_Long    *result_offset )
+  {
+    /*
+      Only meaningful on systems with hfs+ drivers (or Macs).
+     */
+    FT_Error   error;
+    char*      newpath;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    if ( FT_ALLOC( newpath,
+                   ft_strlen( base_file_name ) + ft_strlen( "/rsrc" ) + 1 ) )
+      return error;
+
+    ft_strcpy( newpath, base_file_name );
+    ft_strcat( newpath, "/rsrc" );
+    *result_file_name = newpath;
+    *result_offset = 0;
+    return FT_Err_Ok;
+  }
+
+
+  static FT_Error
+  raccess_guess_vfat( FT_Library  library,
+                      FT_Stream   stream,
+                      char *      base_file_name,
+                      char      **result_file_name,
+                      FT_Long    *result_offset )
+  {
+    char*      newpath;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    newpath = raccess_make_file_name( memory, base_file_name,
+                                      "resource.frk/" );
+    if ( !newpath )
+      return FT_Err_Out_Of_Memory;
+
+    *result_file_name = newpath;
+    *result_offset    = 0;
+
+    return FT_Err_Ok;
+  }
+
+
+  static FT_Error
+  raccess_guess_linux_cap( FT_Library  library,
+                           FT_Stream   stream,
+                           char *      base_file_name,
+                           char      **result_file_name,
+                           FT_Long    *result_offset )
+  {
+    char*      newpath;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    newpath = raccess_make_file_name( memory, base_file_name, ".resource/" );
+    if ( !newpath )
+      return FT_Err_Out_Of_Memory;
+
+    *result_file_name = newpath;
+    *result_offset    = 0;
+
+    return FT_Err_Ok;
+  }
+
+
+  static FT_Error
+  raccess_guess_linux_double( FT_Library  library,
+                              FT_Stream   stream,
+                              char *      base_file_name,
+                              char      **result_file_name,
+                              FT_Long    *result_offset )
+  {
+    char*      newpath;
+    FT_Error   error;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    newpath = raccess_make_file_name( memory, base_file_name, "%" );
+    if ( !newpath )
+      return FT_Err_Out_Of_Memory;
+
+    error = raccess_guess_linux_double_from_file_name( library, newpath,
+                                                       result_offset );
+    if ( !error )
+      *result_file_name = newpath;
+    else
+      FT_FREE( newpath );
+
+    return error;
+  }
+
+
+  static FT_Error
+  raccess_guess_linux_netatalk( FT_Library  library,
+                                FT_Stream   stream,
+                                char *      base_file_name,
+                                char      **result_file_name,
+                                FT_Long    *result_offset )
+  {
+    char*      newpath;
+    FT_Error   error;
+    FT_Memory  memory;
+
+    FT_UNUSED( stream );
+
+
+    memory = library->memory;
+
+    newpath = raccess_make_file_name( memory, base_file_name,
+                                      ".AppleDouble/" );
+    if ( !newpath )
+      return FT_Err_Out_Of_Memory;
+
+    error = raccess_guess_linux_double_from_file_name( library, newpath,
+                                                       result_offset );
+    if ( !error )
+      *result_file_name = newpath;
+    else
+      FT_FREE( newpath );
+
+    return error;
+  }
+
+
+  static FT_Error
+  raccess_guess_apple_generic( FT_Library  library,
+                               FT_Stream   stream,
+                               char *      base_file_name,
+                               FT_Int32    magic,
+                               FT_Long    *result_offset )
+  {
+    FT_Int32   magic_from_stream;
+    FT_Error   error;
+    FT_Int32   version_number;
+    FT_UShort  n_of_entries;
+
+    int        i;
+    FT_UInt32  entry_id, entry_offset, entry_length;
+
+    const FT_UInt32  resource_fork_entry_id = 0x2;
+
+    FT_UNUSED( library );
+    FT_UNUSED( base_file_name );
+
+
+    if ( FT_READ_LONG ( magic_from_stream ) )
+      return error;
+    if ( magic_from_stream != magic )
+      return FT_Err_Unknown_File_Format;
+
+    if ( FT_READ_LONG( version_number ) )
+      return error;
+
+    /* filler */
+    error = FT_Stream_Skip( stream, 16 );
+    if ( error )
+      return error;
+
+    if ( FT_READ_USHORT( n_of_entries ) )
+      return error;
+    if ( n_of_entries == 0 )
+      return FT_Err_Unknown_File_Format;
+
+    for ( i = 0; i < n_of_entries; i++ )
+    {
+      if ( FT_READ_LONG( entry_id ) )
+        return error;
+      if ( entry_id == resource_fork_entry_id )
+      {
+        if ( FT_READ_LONG( entry_offset ) ||
+             FT_READ_LONG( entry_length ) )
+          continue;
+        *result_offset = entry_offset;
+
+        return FT_Err_Ok;
+      }
+      else
+        FT_Stream_Skip( stream, 4 + 4 );    /* offset + length */
+      }
+
+    return FT_Err_Unknown_File_Format;
+  }
+
+
+  static FT_Error
+  raccess_guess_linux_double_from_file_name( FT_Library  library,
+                                             char *      file_name,
+                                             FT_Long    *result_offset )
+  {
+    FT_Memory     memory;
+    FT_Open_Args  args2;
+    FT_Stream     stream2;
+    char *        nouse = NULL;
+    FT_Error      error;
+
+
+    memory = library->memory;
+
+    args2.flags    = FT_OPEN_PATHNAME;
+    args2.pathname = file_name;
+    error = FT_Stream_New( library, &args2, &stream2 );
+    if ( error )
+      return error;
+
+    error = raccess_guess_apple_double( library, stream2, file_name,
+                                        &nouse, result_offset );
+
+    FT_Stream_Close( stream2 );
+
+    return error;
+  }
+
+
+  static char*
+  raccess_make_file_name( FT_Memory    memory,
+                          const char  *original_name,
+                          const char  *insertion )
+  {
+    char*        new_name;
+    char*        tmp;
+    const char*  slash;
+    unsigned     new_length;
+    FT_ULong     error;
+
+    new_length = ft_strlen( original_name ) + ft_strlen( insertion );
+    if ( FT_ALLOC( new_name, new_length + 1 ) )
+      return NULL;
+
+    tmp = ft_strrchr( original_name, '/' );
+    if ( tmp )
+    {
+      ft_strncpy( new_name, original_name, tmp - original_name + 1 );
+      new_name[tmp - original_name + 1] = '\0';
+      slash = tmp + 1;
+    }
+    else
+    {
+      slash       = original_name;
+      new_name[0] = '\0';
+    }
+
+    ft_strcat( new_name, insertion );
+    ft_strcat( new_name, slash );
+
+    return new_name;
+  }
+
+
+#else   /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
+
+
+  /*************************************************************************/
+  /*                  Dummy function; just sets errors                     */
+  /*************************************************************************/
+
+  FT_BASE_DEF( void )
+  FT_Raccess_Guess( FT_Library  library,
+                    FT_Stream   stream,
+                    char*       base_name,
+                    char      **new_names,
+                    FT_Long    *offsets,
+                    FT_Error   *errors )
+  {
+    int  i;
+
+
+    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
+    {
+      new_names[i] = NULL;
+      offsets[i]   = 0;
+      errors[i]    = FT_Err_Unimplemented_Feature;
+    }
+  }
+
+
+#endif  /* !FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
+
+
+/* END */

reactos/lib/freetype/src/base
Jamfile 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Jamfile	21 Jan 2004 19:23:46 -0000	1.3
+++ Jamfile	10 May 2004 17:48:30 -0000	1.4
@@ -1,4 +1,4 @@
-# FreeType 2 src/base Jamfile (c) 2001, 2002, 2003 David Turner
+# FreeType 2 src/base Jamfile (c) 2001, 2002, 2003, 2004 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
@@ -10,7 +10,7 @@
   if $(FT2_MULTI)
   {
     _sources = ftutil ftdbgmem ftstream ftcalc fttrigon ftgloadr ftoutln
-               ftobjs ftnames ;
+               ftobjs ftnames ftrfork ;
   }
   else
   {
@@ -24,8 +24,7 @@
 #
 Library  $(FT2_LIB) : ftsystem.c   ftinit.c    ftglyph.c  ftmm.c     ftbdf.c
                       ftbbox.c     ftdebug.c   ftxf86.c   fttype1.c  ftpfr.c
-                      ftstroke.c   ftwinfnt.c
-                      ;
+                      ftstroke.c   ftwinfnt.c ;
 
 # Add Macintosh-specific file to the library when necessary.
 #

reactos/lib/freetype/src/base
descrip.mms 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- descrip.mms	21 Jan 2004 19:23:46 -0000	1.3
+++ descrip.mms	10 May 2004 17:48:30 -0000	1.4
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001, 2003 by
+# Copyright 2001, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -15,7 +15,7 @@
 
 CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
 
-OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj
+OBJS=ftbase.obj,ftinit.obj,ftglyph.obj,ftdebug.obj,ftbdf.obj,ftmm.obj,fttype1.obj,ftxf86.obj,ftpfr.obj,ftstroke.obj,ftwinfnt.obj,ftbbox.obj
 
 all : $(OBJS)
         library [--.lib]freetype.olb $(OBJS)

reactos/lib/freetype/src/base
ftbase.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ftbase.c	21 Jan 2004 19:23:46 -0000	1.2
+++ ftbase.c	10 May 2004 17:48:30 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component (body only).                         */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -29,6 +29,7 @@
 #include "ftgloadr.c"
 #include "ftobjs.c"
 #include "ftnames.c"
+#include "ftrfork.c"
 
 #if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
 #include "ftmac.c"

reactos/lib/freetype/src/base
ftbdf.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftbdf.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ftbdf.c	10 May 2004 17:48:30 -0000	1.6
@@ -17,27 +17,8 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_BDF_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
-
-
-  static FT_Bool
-  test_font_type( FT_Face      face,
-                  const char*  name )
-  {
-    if ( face && face->driver )
-    {
-      FT_Module  driver = (FT_Module)face->driver;
-
-
-      if ( driver->clazz && driver->clazz->module_name )
-      {
-        if ( ft_strcmp( driver->clazz->module_name, name ) == 0 )
-          return 1;
-      }
-    }
-    return 0;
-  }
+#include FT_SERVICE_BDF_H
 
 
   FT_EXPORT_DEF( FT_Error )
@@ -52,14 +33,15 @@
 
     error = FT_Err_Invalid_Argument;
 
-    if ( test_font_type( face, "bdf" ) )
+    if ( face )
     {
-      BDF_Public_Face  bdf_face = (BDF_Public_Face)face;
+      FT_Service_BDF  service;
+
 
+      FT_FACE_FIND_SERVICE( face, service, BDF );
 
-      encoding = (const char*) bdf_face->charset_encoding;
-      registry = (const char*) bdf_face->charset_registry;
-      error    = 0;
+      if ( service && service->get_charset_id )
+        error = service->get_charset_id( face, &encoding, &registry );
     }
 
     if ( acharset_encoding )
@@ -84,22 +66,18 @@
 
     aproperty->type = BDF_PROPERTY_TYPE_NONE;
 
-    if ( face != NULL && face->driver != NULL )
+    if ( face )
     {
-      FT_Driver            driver = face->driver;
-      BDF_GetPropertyFunc  func;
+      FT_Service_BDF  service;
 
 
-      if ( driver->root.clazz->get_interface )
-      {
-        func = (BDF_GetPropertyFunc)driver->root.clazz->get_interface(
-                 FT_MODULE( driver ), "get_bdf_property" );
-        if ( func )
-          error = func( face, prop_name, aproperty );
-      }
+      FT_FACE_FIND_SERVICE( face, service, BDF );
+
+      if ( service && service->get_property )
+        error = service->get_property( face, prop_name, aproperty );
     }
 
-    return error;
+    return  error;
   }
 
 

reactos/lib/freetype/src/base
ftcalc.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftcalc.c	15 Feb 2004 21:45:32 -0000	1.4
+++ ftcalc.c	10 May 2004 17:48:30 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -74,8 +74,8 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_RoundFix( FT_Fixed  a )
   {
-    return ( a >= 0 ) ?   ( a + 0x8000L ) & -0x10000L
-                      : -((-a + 0x8000L ) & -0x10000L );
+    return ( a >= 0 ) ?   ( a + 0x8000L ) & ~0xFFFFL
+                      : -((-a + 0x8000L ) & ~0xFFFFL );
   }
 
 
@@ -84,8 +84,8 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_CeilFix( FT_Fixed  a )
   {
-    return ( a >= 0 ) ?   ( a + 0xFFFFL ) & -0x10000L
-                      : -((-a + 0xFFFFL ) & -0x10000L );
+    return ( a >= 0 ) ?   ( a + 0xFFFFL ) & ~0xFFFFL
+                      : -((-a + 0xFFFFL ) & ~0xFFFFL );
   }
 
 
@@ -94,8 +94,8 @@
   FT_EXPORT_DEF( FT_Fixed )
   FT_FloorFix( FT_Fixed  a )
   {
-    return ( a >= 0 ) ?   a & -0x10000L
-                      : -((-a) & -0x10000L );
+    return ( a >= 0 ) ?   a & ~0xFFFFL
+                      : -((-a) & ~0xFFFFL );
   }
 
 
@@ -155,6 +155,33 @@
   }
 
 
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+  /* documentation is in ftcalc.h */
+
+  FT_BASE_DEF( FT_Long )
+  FT_MulDiv_No_Round( FT_Long  a,
+                      FT_Long  b,
+                      FT_Long  c )
+  {
+    FT_Int   s;
+    FT_Long  d;
+
+
+    s = 1;
+    if ( a < 0 ) { a = -a; s = -1; }
+    if ( b < 0 ) { b = -b; s = -s; }
+    if ( c < 0 ) { c = -c; s = -s; }
+
+    d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
+                         : 0x7FFFFFFFL );
+
+    return ( s > 0 ) ? d : -d;
+  }
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Long )
@@ -298,14 +325,13 @@
     if ( a == 0 || b == c )
       return a;
 
-    s  = a; a = ABS( a );
-    s ^= b; b = ABS( b );
-    s ^= c; c = ABS( c );
+    s  = a; a = FT_ABS( a );
+    s ^= b; b = FT_ABS( b );
+    s ^= c; c = FT_ABS( c );
 
     if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
-    {
       a = ( a * b + ( c >> 1 ) ) / c;
-    }
+
     else if ( c > 0 )
     {
       FT_Int64  temp, temp2;
@@ -325,6 +351,43 @@
   }
 
 
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+  FT_BASE_DEF( FT_Long )
+  FT_MulDiv_No_Round( FT_Long  a,
+                      FT_Long  b,
+                      FT_Long  c )
+  {
+    long  s;
+
+
+    if ( a == 0 || b == c )
+      return a;
+
+    s  = a; a = FT_ABS( a );
+    s ^= b; b = FT_ABS( b );
+    s ^= c; c = FT_ABS( c );
+
+    if ( a <= 46340L && b <= 46340L && c > 0 )
+      a = a * b / c;
+
+    else if ( c > 0 )
+    {
+      FT_Int64  temp;
+
+
+      ft_multo64( a, b, &temp );
+      a = ft_div64by32( temp.hi, temp.lo, c );
+    }
+    else
+      a = 0x7FFFFFFFL;
+
+    return ( s < 0 ? -a : a );
+  }
+
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Long )
@@ -338,8 +401,8 @@
     if ( a == 0 || b == 0x10000L )
       return a;
 
-    s  = a; a = ABS(a);
-    s ^= b; b = ABS(b);
+    s  = a; a = FT_ABS(a);
+    s ^= b; b = FT_ABS(b);
 
     ua = (FT_ULong)a;
     ub = (FT_ULong)b;
@@ -371,8 +434,8 @@
     FT_UInt32  q;
 
 
-    s  = a; a = ABS(a);
-    s ^= b; b = ABS(b);
+    s  = a; a = FT_ABS(a);
+    s ^= b; b = FT_ABS(b);
 
     if ( b == 0 )
     {
@@ -411,8 +474,8 @@
     FT_Int32  s;
 
 
-    s  = x; x = ABS( x );
-    s ^= y; y = ABS( y );
+    s  = x; x = FT_ABS( x );
+    s ^= y; y = FT_ABS( y );
 
     ft_multo64( x, y, z );
 
@@ -445,7 +508,7 @@
       x->lo = (FT_UInt32)-(FT_Int32)x->lo;
       x->hi = ~x->hi + !x->lo;
     }
-    s ^= y;  y = ABS( y );
+    s ^= y;  y = FT_ABS( y );
 
     /* Shortcut */
     if ( x->hi == 0 )
@@ -499,7 +562,7 @@
       x->lo = (FT_UInt32)-(FT_Int32)x->lo;
       x->hi = ~x->hi + !x->lo;
     }
-    s ^= y;  y = ABS( y );
+    s ^= y;  y = FT_ABS( y );
 
     /* Shortcut */
     if ( x->hi == 0 )

reactos/lib/freetype/src/base
ftdbgmem.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftdbgmem.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ftdbgmem.c	10 May 2004 17:48:30 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Memory debugger (body).                                              */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -604,7 +604,7 @@
         p = getenv( "FT2_ALLOC_TOTAL_MAX" );
         if ( p != NULL )
         {
-          FT_Long   total_max = atol(p);
+          FT_Long   total_max = ft_atol(p);
           
           if ( total_max > 0 )
           {
@@ -616,7 +616,7 @@
         p = getenv( "FT2_ALLOC_COUNT_MAX" );
         if ( p != NULL )
         {
-          FT_Long  total_count = atol(p);
+          FT_Long  total_count = ft_atol(p);
           
           if ( total_count > 0 )
           {

reactos/lib/freetype/src/base
ftdebug.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftdebug.c	1 Apr 2003 08:38:21 -0000	1.1
+++ ftdebug.c	10 May 2004 17:48:30 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Debugging and logging component (body).                              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -82,8 +82,9 @@
   /* array of trace levels, initialized to 0 */
   int  ft_trace_levels[trace_count];
 
+
   /* define array of trace toggle names */
-#define FT_TRACE_DEF(x)  #x ,
+#define FT_TRACE_DEF( x )  #x ,
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
@@ -94,19 +95,43 @@
 #undef FT_TRACE_DEF
 
 
+  /* documentation is in ftdebug.h */
+
+  FT_EXPORT_DEF( FT_Int )
+  FT_Trace_Get_Count( void )
+  {
+    return trace_count;
+  }
+
+
+  /* documentation is in ftdebug.h */
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name( FT_Int  idx )
+  {
+    int  max = FT_Trace_Get_Count();
+
+
+    if ( idx < max )
+      return ft_trace_toggles[idx];
+    else
+      return NULL;
+  }
+
+
   /*************************************************************************/
   /*                                                                       */
   /* Initialize the tracing sub-system.  This is done by retrieving the    */
-  /* value of the "FT2_DEBUG" environment variable.  It must be a list of  */
-  /* toggles, separated by spaces, `;' or `,'.  Example:                   */
+  /* value of the `FT2_DEBUG' environment variable.  It must be a list of  */
+  /* toggles, separated by spaces, `;', or `,'.  Example:                  */
   /*                                                                       */
-  /*    "any:3 memory:6 stream:5"                                          */
+  /*    export FT2_DEBUG="any:3 memory:6 stream:5"                         */
   /*                                                                       */
-  /* This will request that all levels be set to 3, except the trace level */
-  /* for the memory and stream components which are set to 6 and 5,        */
+  /* This requests that all levels be set to 3, except the trace level for */
+  /* the memory and stream components which are set to 6 and 5,            */
   /* respectively.                                                         */
   /*                                                                       */
-  /* See the file <freetype/internal/fttrace.h> for details of the         */
+  /* See the file <include/freetype/internal/fttrace.h> for details of the */
   /* available toggle names.                                               */
   /*                                                                       */
   /* The level must be between 0 and 6; 0 means quiet (except for serious  */
@@ -117,6 +142,7 @@
   {
     const char*  ft2_debug = getenv( "FT2_DEBUG" );
 
+
     if ( ft2_debug )
     {
       const char*  p = ft2_debug;
@@ -133,10 +159,10 @@
         q = p;
         while ( *p && *p != ':' )
           p++;
-          
+
         if ( *p == ':' && p > q )
         {
-          FT_Int  n, i, len = (FT_Int)(p - q);
+          FT_Int  n, i, len = (FT_Int)( p - q );
           FT_Int  level = -1, found = -1;
 
 
@@ -171,7 +197,7 @@
           {
             if ( found == trace_any )
             {
-              /* special case for "any" */
+              /* special case for `any' */
               for ( n = 0; n < trace_count; n++ )
                 ft_trace_levels[n] = level;
             }
@@ -183,14 +209,33 @@
     }
   }
 
+
 #else  /* !FT_DEBUG_LEVEL_TRACE */
 
+
   FT_BASE_DEF( void )
   ft_debug_init( void )
   {
     /* nothing */
   }
 
+
+  FT_EXPORT_DEF( FT_Int )
+  FT_Trace_Get_Count( void )
+  {
+    return 0;
+  }
+
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name( FT_Int  idx )
+  {
+    FT_UNUSED( idx );
+
+    return NULL;
+  }
+
+
 #endif /* !FT_DEBUG_LEVEL_TRACE */
 
 

reactos/lib/freetype/src/base
ftgloadr.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftgloadr.c	15 Feb 2004 21:45:32 -0000	1.3
+++ ftgloadr.c	10 May 2004 17:48:30 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph loader (body).                                    */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_GLYPH_LOADER_H
 #include FT_INTERNAL_MEMORY_H
+#include FT_INTERNAL_OBJECTS_H
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_gloader
@@ -205,7 +206,7 @@
 
     if ( new_max > old_max )
     {
-      new_max = ( new_max + 7 ) & -8;
+      new_max = FT_PAD_CEIL( new_max, 8 );
 
       if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
            FT_RENEW_ARRAY( base->tags,   old_max, new_max ) )
@@ -225,7 +226,7 @@
               n_contours;
     if ( new_max > old_max )
     {
-      new_max = ( new_max + 3 ) & -4;
+      new_max = FT_PAD_CEIL( new_max, 4 );
       if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
         goto Exit;
 
@@ -261,7 +262,7 @@
     old_max = loader->max_subglyphs;
     if ( new_max > old_max )
     {
-      new_max = ( new_max + 1 ) & -2;
+      new_max = FT_PAD_CEIL( new_max, 2 );
       if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
         goto Exit;
 
@@ -336,17 +337,17 @@
       FT_Outline*  in  = &source->base.outline;
 
 
-      FT_MEM_COPY( out->points, in->points,
-                   num_points * sizeof ( FT_Vector ) );
-      FT_MEM_COPY( out->tags, in->tags,
-                   num_points * sizeof ( char ) );
-      FT_MEM_COPY( out->contours, in->contours,
-                   num_contours * sizeof ( short ) );
+      FT_ARRAY_COPY( out->points, in->points,
+                     num_points );
+      FT_ARRAY_COPY( out->tags, in->tags,
+                     num_points );
+      FT_ARRAY_COPY( out->contours, in->contours,
+                     num_contours );
 
       /* do we need to copy the extra points? */
       if ( target->use_extra && source->use_extra )
-        FT_MEM_COPY( target->base.extra_points, source->base.extra_points,
-                     num_points * sizeof ( FT_Vector ) );
+        FT_ARRAY_COPY( target->base.extra_points, source->base.extra_points,
+                       num_points );
 
       out->n_points   = (short)num_points;
       out->n_contours = (short)num_contours;

reactos/lib/freetype/src/base
ftglyph.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftglyph.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ftglyph.c	10 May 2004 17:48:30 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType convenience functions to handle glyphs (body).              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -206,6 +206,7 @@
   }
 
 
+  FT_CALLBACK_TABLE_DEF
   const FT_Glyph_Class  ft_bitmap_glyph_class =
   {
     sizeof( FT_BitmapGlyphRec ),
@@ -253,14 +254,11 @@
       goto Exit;
 
     /* copy it */
-    FT_MEM_COPY( target->points, source->points,
-                 source->n_points * sizeof ( FT_Vector ) );
+    FT_ARRAY_COPY( target->points, source->points, source->n_points );
 
-    FT_MEM_COPY( target->tags, source->tags,
-                 source->n_points * sizeof ( FT_Byte ) );
+    FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
 
-    FT_MEM_COPY( target->contours, source->contours,
-                 source->n_contours * sizeof ( FT_Short ) );
+    FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
 
     /* copy all flags, except the `FT_OUTLINE_OWNER' one */
     target->flags = source->flags | FT_OUTLINE_OWNER;
@@ -327,6 +325,7 @@
   }
 
 
+  FT_CALLBACK_TABLE_DEF
   const FT_Glyph_Class  ft_outline_glyph_class =
   {
     sizeof( FT_OutlineGlyphRec ),
@@ -421,7 +420,7 @@
   FT_Get_Glyph( FT_GlyphSlot  slot,
                 FT_Glyph     *aglyph )
   {
-    FT_Library  library = slot->library;
+    FT_Library  library;
     FT_Error    error;
     FT_Glyph    glyph;
 
@@ -431,6 +430,8 @@
     if ( !slot )
       return FT_Err_Invalid_Slot_Handle;
 
+    library = slot->library;
+
     if ( !aglyph )
       return FT_Err_Invalid_Argument;
 
@@ -544,10 +545,10 @@
         if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
              bbox_mode == FT_GLYPH_BBOX_PIXELS  )
         {
-          acbox->xMin &= -64;
-          acbox->yMin &= -64;
-          acbox->xMax  = ( acbox->xMax + 63 ) & -64;
-          acbox->yMax  = ( acbox->yMax + 63 ) & -64;
+          acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
+          acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
+          acbox->xMax = FT_PIX_CEIL( acbox->xMax );
+          acbox->yMax = FT_PIX_CEIL( acbox->yMax );
         }
 
         /* convert to integer pixels if needed */

reactos/lib/freetype/src/base
ftmac.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ftmac.c	21 Jan 2004 19:23:46 -0000	1.2
+++ ftmac.c	10 May 2004 17:48:30 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Mac FOND support.  Written by just@letterror.com.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -66,6 +66,10 @@
 #ifdef __GNUC__
 #include "../truetype/ttobjs.h"
 #include "../type1/t1objs.h"
+  /* This is for Mac OS X.  Without redefinition, OS_INLINE */
+  /* expands to `static inline' which doesn't survive the   */
+  /* -ansi compilation flag of GCC.                         */
+#define OS_INLINE  static __inline__
 #include <Carbon/Carbon.h>
 #else
 #include "truetype/ttobjs.h"
@@ -77,6 +81,10 @@
 #include <TextUtils.h>
 #endif
 
+#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
+#include <FSp_fopen.h>
+#endif
+
 #include FT_MAC_H
 
 
@@ -87,12 +95,50 @@
 #define PREFER_LWFN 1
 #endif
 
+
+#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
+
+#define STREAM_FILE( stream )  ( (FILE*)stream->descriptor.pointer )
+
+
+  FT_CALLBACK_DEF( void )
+  ft_FSp_stream_close( FT_Stream  stream )
+  {
+    fclose( STREAM_FILE( stream ) );
+
+    stream->descriptor.pointer = NULL;
+    stream->size               = 0;
+    stream->base               = 0;
+  }
+
+
+  FT_CALLBACK_DEF( unsigned long )
+  ft_FSp_stream_io( FT_Stream       stream,
+                    unsigned long   offset,
+                    unsigned char*  buffer,
+                    unsigned long   count )
+  {
+    FILE*  file;
+
+
+    file = STREAM_FILE( stream );
+
+    fseek( file, offset, SEEK_SET );
+
+    return (unsigned long)fread( buffer, 1, count, file );
+  }
+
+#endif  /* __MWERKS__ && !TARGET_RT_MAC_MACHO */
+
+
   /* Given a pathname, fill in a file spec. */
   static int
   file_spec_from_path( const char*  pathname,
                        FSSpec*      spec )
   {
-#if defined( TARGET_API_MAC_CARBON ) && !defined( __MWERKS__ )
+
+#if !TARGET_API_MAC_OS8 && \
+    !( defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO )
 
     OSErr  e;
     FSRef  ref;
@@ -123,12 +169,13 @@
       return 0;
 
 #endif
+
   }
 
 
   /* Return the file type of the file specified by spec. */
   static OSType
-  get_file_type( FSSpec*  spec )
+  get_file_type( const FSSpec*  spec )
   {
     FInfo  finfo;
 
@@ -140,22 +187,6 @@
   }
 
 
-#ifdef TARGET_API_MAC_CARBON
-
-  /* is this a Mac OS X .dfont file */
-  static Boolean
-  is_dfont( FSSpec*  spec )
-  {
-    int  nameLen = spec->name[0];
-
-
-    return nameLen >= 6                                      &&
-           !ft_memcmp( spec->name + nameLen - 5, ".dfont", 6 );
-  }
-
-#endif
-
-
   /* Given a PostScript font name, create the Macintosh LWFN file name. */
   static void
   create_lwfn_name( char*   ps_name,
@@ -217,9 +248,9 @@
   /* Make a file spec for an LWFN file from a FOND resource and
      a file name. */
   static FT_Error
-  make_lwfn_spec( Handle          fond,
-                  unsigned char*  file_name,
-                  FSSpec*         spec )
+  make_lwfn_spec( Handle               fond,
+                  const unsigned char* file_name,
+                  FSSpec*              spec )
   {
     FT_Error  error;
     short     ref_num, v_ref_num;
@@ -240,12 +271,24 @@
   }
 
 
+  static short
+  count_faces_sfnt( char *fond_data )
+  {
+    /* The count is 1 greater than the value in the FOND.  */
+    /* Isn't that cute? :-)                                */
+
+    return 1 + *( (short *)( fond_data + sizeof ( FamRec ) ) );
+  }
+
+
   /* Look inside the FOND data, answer whether there should be an SFNT
      resource, and answer the name of a possible LWFN Type 1 file.
 
      Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
      to load a face OTHER than the first one in the FOND!
   */
+
+
   static void
   parse_fond( char*   fond_data,
               short*  have_sfnt,
@@ -265,19 +308,24 @@
     fond       = (FamRec*)fond_data;
     assoc      = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
     base_assoc = assoc;
-    assoc     += face_index;        /* add on the face_index! */
 
-    /* if the face at this index is not scalable,
-       fall back to the first one (old behavior) */
-    if ( assoc->fontSize == 0 )
-    {
-      *have_sfnt = 1;
-      *sfnt_id   = assoc->fontID;
-    }
-    else if ( base_assoc->fontSize == 0 )
+    /* Let's do a little range checking before we get too excited here */
+    if ( face_index < count_faces_sfnt( fond_data ) )
     {
-      *have_sfnt = 1;
-      *sfnt_id   = base_assoc->fontID;
+      assoc += face_index;        /* add on the face_index! */
+
+      /* if the face at this index is not scalable,
+         fall back to the first one (old behavior) */
+      if ( assoc->fontSize == 0 )
+      {
+        *have_sfnt = 1;
+        *sfnt_id   = assoc->fontID;
+      }
+      else if ( base_assoc->fontSize == 0 )
+      {
+        *have_sfnt = 1;
+        *sfnt_id   = base_assoc->fontID;
+      }
     }
 
     if ( fond->ffStylOff )
@@ -344,6 +392,33 @@
   }
 
 
+  static short
+  count_faces( Handle  fond )
+  {
+    short   sfnt_id, have_sfnt, have_lwfn = 0;
+    Str255  lwfn_file_name;
+    FSSpec  lwfn_spec;
+
+
+    HLock( fond );
+    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );
+    HUnlock( fond );
+
+    if ( lwfn_file_name[0] )
+    {
+      if ( make_lwfn_spec( fond, lwfn_file_name, &lwfn_spec ) == FT_Err_Ok )
+        have_lwfn = 1;  /* yeah, we got one! */
+      else
+        have_lwfn = 0;  /* no LWFN file found */
+    }
+
+    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
+      return 1;
+    else
+      return count_faces_sfnt( *fond );
+  }
+
+
   /* Read Type 1 data from the POST resources inside the LWFN file,
      return a PFB buffer. This is somewhat convoluted because the FT2
      PFB parser wants the ASCII header as one chunk, and the LWFN
@@ -351,12 +426,12 @@
      of the same type together. */
   static FT_Error
   read_lwfn( FT_Memory  memory,
-             FSSpec*    lwfn_spec,
+             short      res_ref,
              FT_Byte**  pfb_data,
              FT_ULong*  size )
   {
     FT_Error       error = FT_Err_Ok;
-    short          res_ref, res_id;
+    short          res_id;
     unsigned char  *buffer, *p, *size_p = NULL;
     FT_ULong       total_size = 0;
     FT_ULong       post_size, pfb_chunk_size;
@@ -364,13 +439,10 @@
     char           code, last_code;
 
 
-    res_ref = FSpOpenResFile( lwfn_spec, fsRdPerm );
-    if ( ResError() )
-      return FT_Err_Out_Of_Memory;
     UseResFile( res_ref );
 
-    /* First pass: load all POST resources, and determine the size of
-       the output buffer. */
+    /* First pass: load all POST resources, and determine the size of */
+    /* the output buffer.                                             */
     res_id    = 501;
     last_code = -1;
 
@@ -397,8 +469,8 @@
     if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
       goto Error;
 
-    /* Second pass: append all POST data to the buffer, add PFB fields.
-       Glue all consecutive chunks of the same type together. */
+    /* Second pass: append all POST data to the buffer, add PFB fields. */
+    /* Glue all consecutive chunks of the same type together.           */
     p              = buffer;
     res_id         = 501;
     last_code      = -1;
@@ -543,6 +615,14 @@
       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;
@@ -551,19 +631,59 @@
   }
 
 
+  static FT_Error
+  OpenFileAsResource( const FSSpec*  spec,
+                      short         *p_res_ref )
+  {
+    FT_Error  error;
+
+#if !TARGET_API_MAC_OS8
+
+    FSRef     hostContainerRef;
+
+
+    error = FSpMakeFSRef( spec, &hostContainerRef );
+    if ( error == noErr )
+      error = FSOpenResourceFile( &hostContainerRef,
+                                  0, NULL, fsRdPerm, p_res_ref );
+
+    /* If the above fails, then it is probably not a resource file       */
+    /* However, it has been reported that FSOpenResourceFile() sometimes */
+    /* fails on some old resource-fork files, which FSpOpenResFile() can */
+    /* open.  So, just try again with FSpOpenResFile() and see what      */
+    /* happens :-)                                                       */
+
+    if ( error != noErr )
+
+#endif  /* !TARGET_API_MAC_OS8 */
+
+    {
+      *p_res_ref = FSpOpenResFile( spec, fsRdPerm );
+      error = ResError();
+    }
+
+    return error ? FT_Err_Cannot_Open_Resource : FT_Err_Ok;
+  }
+
+
   /* Create a new FT_Face from a file spec to an LWFN file. */
   static FT_Error
-  FT_New_Face_From_LWFN( FT_Library  library,
-                         FSSpec*     spec,
-                         FT_Long     face_index,
-                         FT_Face    *aface )
+  FT_New_Face_From_LWFN( FT_Library     library,
+                         const FSSpec*  lwfn_spec,
+                         FT_Long        face_index,
+                         FT_Face       *aface )
   {
     FT_Byte*  pfb_data;
     FT_ULong  pfb_size;
     FT_Error  error;
+    short     res_ref;
 
 
-    error = read_lwfn( library->memory, spec, &pfb_data, &pfb_size );
+    error = OpenFileAsResource( lwfn_spec, &res_ref );
+    if ( error )
+      return error;
+
+    error = read_lwfn( library->memory, res_ref, &pfb_data, &pfb_size );
     if ( error )
       return error;
 
@@ -624,83 +744,34 @@
   /* Create a new FT_Face from a file spec to a suitcase file. */
   static FT_Error
   FT_New_Face_From_Suitcase( FT_Library  library,
-                             FSSpec*     spec,
+                             short       res_ref,
                              FT_Long     face_index,
                              FT_Face    *aface )
   {
     FT_Error  error = FT_Err_Ok;
-    short     res_ref, res_index;
+    short     res_index;
     Handle    fond;
+    short     num_faces;
 
 
-    res_ref = FSpOpenResFile( spec, fsRdPerm );
-    if ( ResError() )
-      return FT_Err_Cannot_Open_Resource;
     UseResFile( res_ref );
 
-    /* face_index may be -1, in which case we
-       just need to do a sanity check */
-    if ( face_index < 0 )
-      res_index = 1;
-    else
+    for ( res_index = 1; ; ++res_index )
     {
-      res_index = (short)( face_index + 1 );
-      face_index = 0;
-    }
-    fond = Get1IndResource( 'FOND', res_index );
-    if ( ResError() )
-    {
-      error = FT_Err_Cannot_Open_Resource;
-      goto Error;
-    }
-
-    error = FT_New_Face_From_FOND( library, fond, face_index, aface );
-
-  Error:
-    CloseResFile( res_ref );
-    return error;
-  }
-
-
-#ifdef TARGET_API_MAC_CARBON
-
-  /* Create a new FT_Face from a file spec to a suitcase file. */
-  static FT_Error
-  FT_New_Face_From_dfont( FT_Library  library,
-                          FSSpec*     spec,
-                          FT_Long     face_index,
-                          FT_Face*    aface )
-  {
-    FT_Error  error = FT_Err_Ok;
-    short     res_ref, res_index;
-    Handle    fond;
-    FSRef     hostContainerRef;
-
-
-    error = FSpMakeFSRef( spec, &hostContainerRef );
-    if ( error == noErr )
-      error = FSOpenResourceFile( &hostContainerRef,
-                                  0, NULL, fsRdPerm, &res_ref );
-
-    if ( error != noErr )
-      return FT_Err_Cannot_Open_Resource;
+      fond = Get1IndResource( 'FOND', res_index );
+      if ( ResError() )
+      {
+        error = FT_Err_Cannot_Open_Resource;
+        goto Error;
+      }
+      if ( face_index < 0 )
+        break;
 
-    UseResFile( res_ref );
+      num_faces = count_faces( fond );
+      if ( face_index < num_faces )
+        break;
 
-    /* face_index may be -1, in which case we
-       just need to do a sanity check */
-    if ( face_index < 0 )
-      res_index = 1;
-    else
-    {
-      res_index = (short)( face_index + 1 );
-      face_index = 0;
-    }
-    fond = Get1IndResource( 'FOND', res_index );
-    if ( ResError() )
-    {
-      error = FT_Err_Cannot_Open_Resource;
-      goto Error;
+      face_index -= num_faces;
     }
 
     error = FT_New_Face_From_FOND( library, fond, face_index, aface );
@@ -710,8 +781,6 @@
     return error;
   }
 
-#endif
-
 
   /* documentation is in ftmac.h */
 
@@ -763,9 +832,9 @@
   /* documentation is in ftmac.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_GetFile_From_Mac_Name( char*     fontName,
-                            FSSpec*   pathSpec,
-                            FT_Long*  face_index )
+  FT_GetFile_From_Mac_Name( const char* fontName,
+                            FSSpec*     pathSpec,
+                            FT_Long*    face_index )
   {
     OptionBits            options = kFMUseGlobalScopeOption;
 
@@ -826,7 +895,7 @@
               the_font = font;
             }
             else
-               ++(*face_index);
+              ++(*face_index);
           }
         }
 
@@ -845,23 +914,46 @@
       return FT_Err_Unknown_File_Format;
   }
 
+  /* Common function to load a new FT_Face from a resource file. */
 
-  static long
-  ResourceForkSize(FSSpec*  spec)
+  static FT_Error
+  FT_New_Face_From_Resource( FT_Library     library,
+                             const FSSpec  *spec,
+                             FT_Long        face_index,
+                             FT_Face       *aface )
   {
-    long   len;
-    short  refNum;
-    OSErr  e;
+    OSType    file_type;
+    short     res_ref;
+    FT_Error  error;
 
 
-    e = FSpOpenRF( spec, fsRdPerm, &refNum ); /* I.M. Files 2-155 */
-    if ( e == noErr )
+    if ( OpenFileAsResource( spec, &res_ref ) == FT_Err_Ok )
     {
-      e = GetEOF( refNum, &len );
-      FSClose( refNum );
+      /* 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 );
     }
 
-    return ( e == noErr ) ? len : 0;
+    /* 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;
   }
 
 
@@ -884,7 +976,7 @@
   {
     FT_Open_Args  args;
     FSSpec        spec;
-    OSType        file_type;
+    FT_Error      error;
 
 
     /* test for valid `library' and `aface' delayed to FT_Open_Face() */
@@ -894,31 +986,106 @@
     if ( file_spec_from_path( pathname, &spec ) )
       return FT_Err_Invalid_Argument;
 
-    /* Regardless of type, don't try to use the resource fork if it is */
-    /* empty.  Some TTF fonts have type `FFIL', for example, but they  */
-    /* only have data forks.                                           */
-
-    if ( ResourceForkSize( &spec ) != 0 )
-    {
-      file_type = get_file_type( &spec );
-      if ( file_type == 'FFIL' || file_type == 'tfil' )
-        return FT_New_Face_From_Suitcase( library, &spec, face_index, aface );
+    error = FT_New_Face_From_Resource( library, &spec, face_index, aface );
+    if ( error != 0 || *aface != NULL )
+      return error;
 
-      if ( file_type == 'LWFN' )
-        return FT_New_Face_From_LWFN( library, &spec, face_index, aface );
-    }
+    /* let it fall through to normal loader (.ttf, .otf, etc.) */
+    args.flags    = FT_OPEN_PATHNAME;
+    args.pathname = (char*)pathname;
+    return FT_Open_Face( library, &args, face_index, aface );
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_New_Face_From_FSSpec                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    FT_New_Face_From_FSSpec is identical to FT_New_Face except it      */
+  /*    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_Open_Args  args;
+    FT_Error      error;
+    FT_Stream     stream;
+    FILE*         file;
+    FT_Memory     memory;
 
-#ifdef TARGET_API_MAC_CARBON
 
-    if ( is_dfont( &spec ) )
-      return FT_New_Face_From_dfont( library, &spec, face_index, aface );
+    /* test for valid `library' and `aface' delayed to FT_Open_Face() */
+    if ( !spec )
+      return FT_Err_Invalid_Argument;
 
-#endif
+    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;
-    args.pathname = (char*)pathname;
-    return FT_Open_Face( library, &args, face_index, aface );
+
+#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
+
+    /* Codewarrior's C library can open a FILE from a FSSpec */
+    /* but we must compile with FSp_fopen.c in addition to   */
+    /* runtime libraries.                                    */
+
+    memory = library->memory;
+
+    if ( FT_NEW( stream ) )
+      return error;
+    stream->memory = memory;
+
+    file = FSp_fopen( spec, "rb" );
+    if ( !file )
+      return FT_Err_Cannot_Open_Resource;
+
+    fseek( file, 0, SEEK_END );
+    stream->size = ftell( file );
+    fseek( file, 0, SEEK_SET );
+
+    stream->descriptor.pointer = file;
+    stream->pathname.pointer   = NULL;
+    stream->pos                = 0;
+
+    stream->read  = ft_FSp_stream_io;
+    stream->close = ft_FSp_stream_close;
+
+    args.flags    = FT_OPEN_STREAM;
+    args.stream   = stream;
+
+    error = FT_Open_Face( library, &args, face_index, aface );
+    if ( error == FT_Err_Ok )
+      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
+
+#else  /* !(__MWERKS__ && !TARGET_RT_MAC_MACHO) */
+
+    {
+      FSRef  ref;
+      UInt8  path[256];
+      OSErr  err;
+
+
+      err = FSpMakeFSRef(spec, &ref);
+      if ( !err )
+      {
+        err = FSRefMakePath( &ref, path, sizeof ( path ) );
+        if ( !err )
+          error = FT_New_Face( library, (const char*)path,
+                               face_index, aface );
+      }
+      if ( err )
+        error = FT_Err_Cannot_Open_Resource;
+    }
+
+#endif  /* !(__MWERKS__ && !TARGET_RT_MAC_MACHO) */
+
+    return error;
   }
 
 

reactos/lib/freetype/src/base
ftmm.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftmm.c	15 Feb 2004 21:45:32 -0000	1.3
+++ ftmm.c	10 May 2004 17:48:30 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Multiple Master font support (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_MULTIPLE_MASTERS_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
 
 
   /*************************************************************************/
@@ -31,15 +32,15 @@
 #define FT_COMPONENT  trace_mm
 
 
-  /* documentation is in ftmm.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_Get_Multi_Master( FT_Face           face,
-                       FT_Multi_Master  *amaster )
+  static FT_Error
+  ft_face_get_mm_service( FT_Face                   face,
+                          FT_Service_MultiMasters  *aservice )
   {
     FT_Error  error;
 
 
+    *aservice = NULL;
+
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
 
@@ -47,14 +48,34 @@
 
     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
     {
-      FT_Driver       driver = face->driver;
-      FT_Get_MM_Func  func;
+      FT_FACE_LOOKUP_SERVICE( face,
+                              *aservice,
+                              MULTI_MASTERS );
+
+      if ( aservice )
+        error = FT_Err_Ok;
+    }
+
+    return error;
+  }
+
+
+  /* documentation is in ftmm.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Get_Multi_Master( FT_Face           face,
+                       FT_Multi_Master  *amaster )
+  {
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
 
 
-      func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
-                               FT_MODULE( driver ), "get_mm" );
-      if ( func )
-        error = func( face, amaster );
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
+    {
+      error = FT_Err_Invalid_Argument;
+      if ( service->get_mm )
+        error = service->get_mm( face, amaster );
     }
 
     return error;
@@ -68,24 +89,16 @@
                                 FT_UInt   num_coords,
                                 FT_Long*  coords )
   {
-    FT_Error  error;
-
-
-    if ( !face )
-      return FT_Err_Invalid_Face_Handle;
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
 
-    error = FT_Err_Invalid_Argument;
 
-    if ( FT_HAS_MULTIPLE_MASTERS( face ) )
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
     {
-      FT_Driver              driver = face->driver;
-      FT_Set_MM_Design_Func  func;
-
-
-      func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
-                                      FT_MODULE( driver ), "set_mm_design" );
-      if ( func )
-        error = func( face, num_coords, coords );
+      error = FT_Err_Invalid_Argument;
+      if ( service->set_mm_design )
+        error = service->set_mm_design( face, num_coords, coords );
     }
 
     return error;
@@ -99,24 +112,16 @@
                                FT_UInt    num_coords,
                                FT_Fixed*  coords )
   {
-    FT_Error  error;
+    FT_Error                 error;
+    FT_Service_MultiMasters  service;
 
 
-    if ( !face )
-      return FT_Err_Invalid_Face_Handle;
-
-    error = FT_Err_Invalid_Argument;
-
-    if ( FT_HAS_MULTIPLE_MASTERS( face ) )
+    error = ft_face_get_mm_service( face, &service );
+    if ( !error )
     {
-      FT_Driver             driver = face->driver;
-      FT_Set_MM_Blend_Func  func;
-
-
-      func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
-                                     FT_MODULE( driver ), "set_mm_blend" );
-      if ( func )
-        error = func( face, num_coords, coords );
+      error = FT_Err_Invalid_Argument;
+      if ( service->set_mm_blend )
+         error = service->set_mm_blend( face, num_coords, coords );
     }
 
     return error;

reactos/lib/freetype/src/base
ftobjs.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftobjs.c	15 Feb 2004 21:45:32 -0000	1.5
+++ ftobjs.c	10 May 2004 17:48:30 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (body).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,12 +21,42 @@
 #include FT_OUTLINE_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_RFORK_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */
 #include FT_TRUETYPE_TABLES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
 
+#include FT_SERVICE_SFNT_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_TT_CMAP_H
+
+
+  FT_BASE_DEF( FT_Pointer )
+  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,
+                          const char*     service_id )
+  {
+    FT_Pointer      result = NULL;
+    FT_ServiceDesc  desc   = service_descriptors;
+
+
+    if ( desc && service_id )
+    {
+      for ( ; desc->serv_id != NULL; desc++ )
+      {
+        if ( ft_strcmp( desc->serv_id, service_id ) == 0 )
+        {
+          result = (FT_Pointer)desc->serv_data;
+          break;
+        }
+      }
+    }
+
+    return result;
+  }
+
 
   FT_BASE_DEF( void )
   ft_validator_init( FT_Validator        valid,
@@ -74,12 +104,12 @@
   /*************************************************************************/
 
 
-  /* create a new input stream from a FT_Open_Args structure */
-  /*                                                         */
-  static FT_Error
-  ft_input_stream_new( FT_Library           library,
-                       const FT_Open_Args*  args,
-                       FT_Stream*           astream )
+  /* create a new input stream from an FT_Open_Args structure */
+  /*                                                          */
+  FT_BASE_DEF( FT_Error )
+  FT_Stream_New( FT_Library           library,
+                 const FT_Open_Args*  args,
+                 FT_Stream           *astream )
   {
     FT_Error   error;
     FT_Memory  memory;
@@ -137,9 +167,9 @@
   }
 
 
-  static void
-  ft_input_stream_free( FT_Stream  stream,
-                        FT_Int     external )
+  FT_BASE_DEF( void )
+  FT_Stream_Free( FT_Stream  stream,
+                  FT_Int     external )
   {
     if ( stream )
     {
@@ -487,7 +517,10 @@
         autohint = 0;
     }
 
-    if ( autohint )
+    /* don't apply autohinting if glyph is vertically distorted or */
+    /* mirrored                                                    */
+    if ( autohint && !( face->internal->transform_matrix.yy <= 0 ||
+                        face->internal->transform_matrix.yx != 0 ) )
     {
       FT_AutoHinter_Service  hinting;
 
@@ -547,15 +580,14 @@
     if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0  &&
          ( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
     {
-      FT_UInt           EM      = face->units_per_EM;
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
 
       slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
-                                           (FT_Long)metrics->x_ppem << 16, EM );
+                                           metrics->x_scale, 64 );
 
       slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
-                                           (FT_Long)metrics->y_ppem << 16, EM );
+                                           metrics->y_scale, 64 );
     }
 
     if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
@@ -641,6 +673,28 @@
   }
 
 
+  static void
+  destroy_charmaps( FT_Face    face,
+                    FT_Memory  memory )
+  {
+    FT_Int  n;
+
+
+    for ( n = 0; n < face->num_charmaps; n++ )
+    {
+      FT_CMap  cmap = FT_CMAP( face->charmaps[n] );
+
+
+      FT_CMap_Done( cmap );
+
+      face->charmaps[n] = NULL;
+    }
+
+    FT_FREE( face->charmaps );
+    face->num_charmaps = 0;
+  }
+
+
   /* destructor for faces list */
   static void
   destroy_face( FT_Memory  memory,
@@ -661,9 +715,9 @@
 
     /* discard all sizes for this face */
     FT_List_Finalize( &face->sizes_list,
-                     (FT_List_Destructor)destroy_size,
-                     memory,
-                     driver );
+                      (FT_List_Destructor)destroy_size,
+                      memory,
+                      driver );
     face->size = 0;
 
     /* now discard client data */
@@ -671,31 +725,14 @@
       face->generic.finalizer( face );
 
     /* discard charmaps */
-    {
-      FT_Int  n;
-
-
-      for ( n = 0; n < face->num_charmaps; n++ )
-      {
-        FT_CMap  cmap = FT_CMAP( face->charmaps[n] );
-
-
-        FT_CMap_Done( cmap );
-
-        face->charmaps[n] = NULL;
-      }
-
-      FT_FREE( face->charmaps );
-      face->num_charmaps = 0;
-    }
-
+    destroy_charmaps( face, memory );
 
     /* finalize format-specific stuff */
     if ( clazz->done_face )
       clazz->done_face( face );
 
     /* close the stream for this face if needed */
-    ft_input_stream_free(
+    FT_Stream_Free(
       face->stream,
       ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
 
@@ -704,7 +741,6 @@
     /* get rid of it */
     if ( face->internal )
     {
-      FT_FREE( face->internal->postscript_name );
       FT_FREE( face->internal );
     }
     FT_FREE( face );
@@ -748,7 +784,7 @@
 
 
     /* caller should have already checked that `face' is valid */
-    FT_ASSERT ( face );
+    FT_ASSERT( face );
 
     first = face->charmaps;
 
@@ -897,6 +933,7 @@
   Fail:
     if ( error )
     {
+      destroy_charmaps( face, memory );
       clazz->done_face( face );
       FT_FREE( internal );
       FT_FREE( face );
@@ -1100,19 +1137,18 @@
   static FT_Error
   Mac_Read_POST_Resource( FT_Library  library,
                           FT_Stream   stream,
-                          FT_Long     resource_listoffset,
+                          FT_Long    *offsets,
                           FT_Long     resource_cnt,
-                          FT_Long     resource_data,
                           FT_Long     face_index,
                           FT_Face    *aface )
   {
     FT_Error   error  = FT_Err_Cannot_Open_Resource;
     FT_Memory  memory = library->memory;
     FT_Byte*   pfb_data;
-    int        i, type, flags, len;
+    int        i, type, flags;
+    FT_Long    len;
     FT_Long    pfb_len, pfb_pos, pfb_lenpos;
-    FT_Long    rlen, junk, temp;
-    FT_Long   *offsets;
+    FT_Long    rlen, temp;
 
 
     if ( face_index == -1 )
@@ -1120,24 +1156,6 @@
     if ( face_index != 0 )
       return error;
 
-    if ( FT_ALLOC( offsets, (FT_Long)resource_cnt * sizeof ( FT_Long ) ) )
-      return error;
-
-    error = FT_Stream_Seek( stream, resource_listoffset );
-    if ( error )
-      goto Exit;
-
-    /* Find all the POST resource offsets */
-    for ( i = 0; i < resource_cnt; ++i )
-    {
-      (void)FT_READ_USHORT( junk ); /* resource id */
-      (void)FT_READ_USHORT( junk ); /* rsource name */
-      if ( FT_READ_LONG( temp ) )
-        goto Exit;
-      offsets[i] = resource_data + ( temp & 0xFFFFFFL );
-      (void)FT_READ_LONG( junk );   /* mbz */
-    }
-
     /* Find the length of all the POST resources, concatenated.  Assume */
     /* worst case (each resource in its own section).                   */
     pfb_len = 0;
@@ -1154,14 +1172,14 @@
     if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
       goto Exit;
 
-    pfb_pos             = 0;
-    pfb_data[pfb_pos++] = 0x80;
-    pfb_data[pfb_pos++] = 1;            /* Ascii section */
-    pfb_lenpos          = pfb_pos;
-    pfb_data[pfb_pos++] = 0;            /* 4-byte length, fill in later */
-    pfb_data[pfb_pos++] = 0;
-    pfb_data[pfb_pos++] = 0;
-    pfb_data[pfb_pos++] = 0;
+    pfb_data[0] = 0x80;
+    pfb_data[1] = 1;            /* Ascii section */
+    pfb_data[2] = 0;            /* 4-byte length, fill in later */
+    pfb_data[3] = 0;
+    pfb_data[4] = 0;
+    pfb_data[5] = 0;
+    pfb_pos     = 7;
+    pfb_lenpos  = 2;
 
     len = 0;
     type = 1;
@@ -1179,10 +1197,10 @@
         len += rlen;
       else
       {
-        pfb_data[pfb_lenpos    ] =   len         & 0xFF;
-        pfb_data[pfb_lenpos + 1] = ( len >>  8 ) & 0xFF;
-        pfb_data[pfb_lenpos + 2] = ( len >> 16 ) & 0xFF;
-        pfb_data[pfb_lenpos + 3] = ( len >> 24 ) & 0xFF;
+        pfb_data[pfb_lenpos    ] = (FT_Byte)( len );
+        pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
+        pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
+        pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
 
         if ( ( flags >> 8 ) == 5 )      /* End of font mark */
           break;
@@ -1192,8 +1210,8 @@
         type = flags >> 8;
         len = rlen;
 
-        pfb_data[pfb_pos++] = type;
-        pfb_lenpos          = pfb_pos;
+        pfb_data[pfb_pos++] = (FT_Byte)type;
+        pfb_lenpos          = (FT_Byte)pfb_pos;
         pfb_data[pfb_pos++] = 0;        /* 4-byte length, fill in later */
         pfb_data[pfb_pos++] = 0;
         pfb_data[pfb_pos++] = 0;
@@ -1207,10 +1225,10 @@
     pfb_data[pfb_pos++] = 0x80;
     pfb_data[pfb_pos++] = 3;
 
-    pfb_data[pfb_lenpos    ] =   len         & 0xFF;
-    pfb_data[pfb_lenpos + 1] = ( len >>  8 ) & 0xFF;
-    pfb_data[pfb_lenpos + 2] = ( len >> 16 ) & 0xFF;
-    pfb_data[pfb_lenpos + 3] = ( len >> 24 ) & 0xFF;
+    pfb_data[pfb_lenpos    ] = (FT_Byte)( len );
+    pfb_data[pfb_lenpos + 1] = (FT_Byte)( len >> 8 );
+    pfb_data[pfb_lenpos + 2] = (FT_Byte)( len >> 16 );
+    pfb_data[pfb_lenpos + 3] = (FT_Byte)( len >> 24 );
 
     return open_face_from_buffer( library,
                                   pfb_data,
@@ -1223,7 +1241,6 @@
     FT_FREE( pfb_data );
 
   Exit:
-    FT_FREE( offsets );
     return error;
   }
 
@@ -1236,18 +1253,16 @@
   static FT_Error
   Mac_Read_sfnt_Resource( FT_Library  library,
                           FT_Stream   stream,
-                          FT_Long     resource_listoffset,
+                          FT_Long    *offsets,
                           FT_Long     resource_cnt,
-                          FT_Long     resource_data,
                           FT_Long     face_index,
                           FT_Face    *aface )
   {
     FT_Memory  memory = library->memory;
     FT_Byte*   sfnt_data;
     FT_Error   error;
-    int        i;
-    FT_Long    flag_offset= 0xFFFFFFL;
-    FT_Long    rlen, junk;
+    FT_Long    flag_offset;
+    FT_Long    rlen;
     int        is_cff;
 
 
@@ -1256,26 +1271,11 @@
     if ( face_index >= resource_cnt )
       return FT_Err_Cannot_Open_Resource;
 
-    error = FT_Stream_Seek( stream, resource_listoffset );
+    flag_offset = offsets[face_index];
+    error = FT_Stream_Seek( stream, flag_offset );
     if ( error )
       goto Exit;
 
-    for ( i = 0; i <= face_index; ++i )
-    {
-      (void)FT_READ_USHORT( junk );     /* resource id */
-      (void)FT_READ_USHORT( junk );     /* rsource name */
-      if ( FT_READ_LONG( flag_offset ) )
-        goto Exit;
-      flag_offset &= 0xFFFFFFL;
-      (void)FT_READ_LONG( junk );       /* mbz */
-    }
-
-    if ( flag_offset == 0xFFFFFFL )
-      return FT_Err_Cannot_Open_Resource;
-
-    error = FT_Stream_Seek( stream, flag_offset + resource_data );
-    if ( error )
-      goto Exit;
     if ( FT_READ_LONG( rlen ) )
       goto Exit;
     if ( rlen == -1 )
@@ -1316,112 +1316,41 @@
                  FT_Long     face_index,
                  FT_Face    *aface )
   {
-    FT_Error       error;
-    unsigned char  head[16], head2[16];
-    FT_Long        rdata_pos, map_pos, rdata_len, map_len;
-    int            allzeros, allmatch, i, cnt, subcnt;
-    FT_Long        type_list, tag, rpos, junk;
-
-
-    error = FT_Stream_Seek( stream, resource_offset );
-    if ( error )
-      goto Exit;
-    error = FT_Stream_Read( stream, (FT_Byte *)head, 16 );
-    if ( error )
-      goto Exit;
-
-    rdata_pos = resource_offset + ( ( head[0] << 24 ) |
-                                    ( head[1] << 16 ) |
-                                    ( head[2] <<  8 ) |
-                                      head[3]         );
-    map_pos   = resource_offset + ( ( head[4] << 24 ) |
-                                    ( head[5] << 16 ) |
-                                    ( head[6] <<  8 ) |
-                                      head[7]         );
-    rdata_len = ( head[ 8] << 24 ) |
-                ( head[ 9] << 16 ) |
-                ( head[10] <<  8 ) |
-                  head[11];
-    map_len   = ( head[12] << 24 ) |
-                ( head[13] << 16 ) |
-                ( head[14] <<  8 ) |
-                  head[15];
-
-    if ( rdata_pos + rdata_len != map_pos || map_pos == resource_offset )
-      return FT_Err_Unknown_File_Format;
-
-    error = FT_Stream_Seek( stream, map_pos );
-    if ( error )
-      goto Exit;
+    FT_Memory  memory = library->memory;
+    FT_Error   error;
+    FT_Long    map_offset, rdara_pos;
+    FT_Long    *data_offsets;
+    FT_Long    count;
 
-    head2[15] = head[15] + 1;       /* make it be different */
 
-    error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );
+    error = FT_Raccess_Get_HeaderInfo( library, stream, resource_offset,
+                                       &map_offset, &rdara_pos );
     if ( error )
-      goto Exit;
+      return error;
 
-    allzeros = 1;
-    allmatch = 1;
-    for ( i = 0; i < 16; ++i )
-    {
-      if ( head2[i] != 0 )
-        allzeros = 0;
-      if ( head2[i] != head[i] )
-        allmatch = 0;
+    error = FT_Raccess_Get_DataOffsets( library, stream,
+                                        map_offset, rdara_pos,
+                                        FT_MAKE_TAG( 'P', 'O', 'S', 'T' ),
+                                        &data_offsets, &count );
+    if ( !error )
+    {
+      error = Mac_Read_POST_Resource( library, stream, data_offsets, count,
+                                      face_index, aface );
+      FT_FREE( data_offsets );
+      return error;
     }
-    if ( !allzeros && !allmatch )
-      return FT_Err_Unknown_File_Format;
-
-    /* If we've gotten this far then it's probably a mac resource file. */
-    /* Now, does it contain any interesting resources?                  */
-
-    (void)FT_READ_LONG( junk );    /* skip handle to next resource map */
-    (void)FT_READ_USHORT( junk );  /* skip file resource number */
-    (void)FT_READ_USHORT( junk );  /* skip attributes */
 
-    if ( FT_READ_USHORT( type_list ) )
-      goto Exit;
-    if ( type_list == -1 )
-      return FT_Err_Unknown_File_Format;
-
-    error = FT_Stream_Seek( stream, map_pos + type_list );
-    if ( error )
-      goto Exit;
-
-    if ( FT_READ_USHORT( cnt ) )
-      goto Exit;
-
-    ++cnt;
-    for ( i = 0; i < cnt; ++i )
+    error = FT_Raccess_Get_DataOffsets( library, stream,
+                                        map_offset, rdara_pos,
+                                        FT_MAKE_TAG( 's', 'f', 'n', 't' ),
+                                        &data_offsets, &count );
+    if ( !error )
     {
-      if ( FT_READ_LONG( tag )      ||
-           FT_READ_USHORT( subcnt ) ||
-           FT_READ_USHORT( rpos )   )
-        goto Exit;
-
-      ++subcnt;
-      rpos += map_pos + type_list;
-      if ( tag == FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) )
-        return Mac_Read_POST_Resource( library,
-                                       stream,
-                                       rpos,
-                                       subcnt,
-                                       rdata_pos,
-                                       face_index,
-                                       aface );
-      else if ( tag == FT_MAKE_TAG( 's', 'f', 'n', 't' ) )
-        return Mac_Read_sfnt_Resource( library,
-                                       stream,
-                                       rpos,
-                                       subcnt,
-                                       rdata_pos,
-                                       face_index,
-                                       aface );
+      error = Mac_Read_sfnt_Resource( library, stream, data_offsets, count,
+                                      face_index, aface );
+      FT_FREE( data_offsets );
     }
 
-    error = FT_Err_Cannot_Open_Resource; /* this file contains no
-                                            interesting resources */
-  Exit:
     return error;
   }
 
@@ -1476,11 +1405,87 @@
   }
 
 
-  /* Check for some macintosh formats                              */
+  static FT_Error
+  load_face_in_embedded_rfork( FT_Library           library,
+                               FT_Stream            stream,
+                               FT_Long              face_index,
+                               FT_Face             *aface,
+                               const FT_Open_Args  *args )
+  {
+
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_raccess
+
+    FT_Memory  memory = library->memory;
+    FT_Error   error  = FT_Err_Unknown_File_Format;
+    int        i;
+
+    char *     file_names[FT_RACCESS_N_RULES];
+    FT_Long    offsets[FT_RACCESS_N_RULES];
+    FT_Error   errors[FT_RACCESS_N_RULES];
+
+    FT_Open_Args  args2;
+    FT_Stream     stream2;
+
+
+    FT_Raccess_Guess( library, stream,
+                      args->pathname, file_names, offsets, errors );
+
+    for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
+    {
+      if ( errors[i] )
+      {
+        FT_TRACE3(( "Error[%d] has occurred in rule %d\n", errors[i], i ));
+        continue;
+      }
+
+      args2.flags    = FT_OPEN_PATHNAME;
+      args2.pathname = file_names[i] ? file_names[i] : args->pathname;
+
+      FT_TRACE3(( "Try rule %d: %s (offset=%d) ...",
+                  i, args2.pathname, offsets[i] ));
+
+      error = FT_Stream_New( library, &args2, &stream2 );
+      if ( error )
+      {
+        FT_TRACE3(( "failed\n" ));
+        continue;
+      }
+
+      error = IsMacResource( library, stream2, offsets[i],
+                             face_index, aface );
+      FT_Stream_Close( stream2 );
+
+      FT_TRACE3(( "%s\n", error ? "failed": "successful" ));
+
+      if ( !error )
+          break;
+    }
+
+    for (i = 0; i < FT_RACCESS_N_RULES; i++)
+    {
+      if ( file_names[i] )
+        FT_FREE( file_names[i] );
+    }
+
+    /* Caller (load_mac_face) requires FT_Err_Unknown_File_Format. */
+    if ( error )
+      error = FT_Err_Unknown_File_Format;
+
+    return error;
+
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_objs
+
+  }
+
+
+  /* Check for some macintosh formats.                             */
   /* Is this a macbinary file?  If so look at the resource fork.   */
   /* Is this a mac dfont file?                                     */
   /* Is this an old style resource fork? (in data)                 */
-  /* Else if we're on Mac OS/X, open the resource fork explicitly. */
+  /* Else call load_face_in_embedded_rfork to try extra rules      */
+  /* (defined in `ftrfork.c').                                     */
   /*                                                               */
   static FT_Error
   load_mac_face( FT_Library           library,
@@ -1495,46 +1500,27 @@
 
     error = IsMacBinary( library, stream, face_index, aface );
     if ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format )
-      error = IsMacResource( library, stream, 0, face_index, aface );
-
-#ifdef FT_MACINTOSH
-    /*
-       I know this section is within code which is normally turned off 
-       for the Mac.  It provides an alternative approach to reading the
-       mac resource forks on OS/X in the event that a user does not wish
-       to compile ftmac.c.
-     */
-         
-    if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format      ||
-           FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation )  &&
-           ( args->flags & FT_OPEN_PATHNAME )                           )
     {
-      FT_Open_Args  args2;
-      char*         newpath;
-      FT_Memory     memory;
-      FT_Stream     stream2;
 
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_raccess
+
+      FT_TRACE3(( "Try as dfont: %s ...", args->pathname ));
 
-      memory = library->memory;
+      error = IsMacResource( library, stream, 0, face_index, aface );
 
-      FT_ALLOC( newpath,
-                ft_strlen( args->pathname ) + ft_strlen( "/rsrc" ) + 1 );
-      ft_strcpy( newpath, args->pathname );
-      ft_strcat( newpath, "/rsrc" );
+      FT_TRACE3(( "%s\n", error ? "failed" : "successful" ));
 
-      args2.flags    = FT_OPEN_PATHNAME;
-      args2.pathname = (char*)newpath;
-      error = ft_input_stream_new( library, &args2, &stream2 );
-      if ( !error )
-      {
-        error = IsMacResource( library, stream2, 0, face_index, aface );
-        FT_Stream_Close( stream2 );
-      }
-      FT_FREE( newpath );
-    }
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_objs
 
-#endif  /* FT_MACINTOSH */
+    }
 
+    if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format      ||
+           FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) &&
+         ( args->flags & FT_OPEN_PATHNAME )                            )
+      error = load_face_in_embedded_rfork( library, stream,
+                                           face_index, aface, args );
     return error;
   }
 
@@ -1559,7 +1545,7 @@
 
 
     /* test for valid `library' delayed to */
-    /* ft_input_stream_new()               */
+    /* FT_Stream_New()                     */
 
     if ( !aface || !args )
       return FT_Err_Invalid_Argument;
@@ -1570,7 +1556,7 @@
                                args->stream                     );
 
     /* create input stream */
-    error = ft_input_stream_new( library, args, &stream );
+    error = FT_Stream_New( library, args, &stream );
     if ( error )
       goto Exit;
 
@@ -1603,7 +1589,7 @@
       else
         error = FT_Err_Invalid_Handle;
 
-      ft_input_stream_free( stream, external_stream );
+      FT_Stream_Free( stream, external_stream );
       goto Fail;
     }
     else
@@ -1648,7 +1634,7 @@
          FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation )
       goto Fail2;
 
-#ifndef FT_MACINTOSH
+#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS )
     error = load_mac_face( library, stream, face_index, aface, args );
     if ( !error )
     {
@@ -1657,19 +1643,19 @@
       /* stream (we opened a different stream which extracted the       */
       /* interesting information out of this stream here.  That stream  */
       /* will still be open and the face will point to it).             */
-      ft_input_stream_free( stream, external_stream );
+      FT_Stream_Free( stream, external_stream );
       return error;
     }
 
     if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
       goto Fail2;
-#endif  /* !FT_MACINTOSH */
+#endif  /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */
 
       /* no driver is able to handle this format */
       error = FT_Err_Unknown_File_Format;
 
   Fail2:
-      ft_input_stream_free( stream, external_stream );
+      FT_Stream_Free( stream, external_stream );
       goto Fail;
     }
 
@@ -1778,7 +1764,7 @@
     FT_Driver_Class  clazz;
 
 
-    /* test for valid `parameters' delayed to ft_input_stream_new() */
+    /* test for valid `parameters' delayed to FT_Stream_New() */
 
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
@@ -1787,7 +1773,7 @@
     if ( !driver )
       return FT_Err_Invalid_Driver_Handle;
 
-    error = ft_input_stream_new( driver->root.library, parameters, &stream );
+    error = FT_Stream_New( driver->root.library, parameters, &stream );
     if ( error )
       goto Exit;
 
@@ -1800,7 +1786,7 @@
       error = clazz->attach_file( face, stream );
 
     /* close the attached stream */
-    ft_input_stream_free( stream,
+    FT_Stream_Free( stream,
                     (FT_Bool)( parameters->stream &&
                                ( parameters->flags & FT_OPEN_STREAM ) ) );
 
@@ -1958,17 +1944,17 @@
   {
     /* Compute root ascender, descender, test height, and max_advance */
 
-    metrics->ascender    = ( FT_MulFix( face->ascender,
-                                        metrics->y_scale ) + 63 ) & -64;
+    metrics->ascender    = FT_PIX_CEIL( FT_MulFix( face->ascender,
+                                                   metrics->y_scale ) );
 
-    metrics->descender   = ( FT_MulFix( face->descender,
-                                        metrics->y_scale ) + 0 ) & -64;
+    metrics->descender   = FT_PIX_FLOOR( FT_MulFix( face->descender,
+                                                    metrics->y_scale ) );
 
-    metrics->height      = ( FT_MulFix( face->height,
-                                        metrics->y_scale ) + 32 ) & -64;
+    metrics->height      = FT_PIX_ROUND( FT_MulFix( face->height,
+                                                    metrics->y_scale ) );
 
-    metrics->max_advance = ( FT_MulFix( face->max_advance_width,
-                                        metrics->x_scale ) + 32 ) & -64;
+    metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
+                                                    metrics->x_scale ) );
   }
 
 
@@ -2014,11 +2000,20 @@
       char_height = 1 * 64;
 
     /* Compute pixel sizes in 26.6 units with rounding */
-    dim_x = ( ( char_width  * horz_resolution + (36+32*72) ) / 72 ) & -64;
-    dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
+    dim_x = ( char_width  * horz_resolution + 36 ) / 72;
+    dim_y = ( char_height * vert_resolution + 36 ) / 72;
+
+    {
+      FT_UShort  x_ppem = (FT_UShort)( ( dim_x + 32 ) >> 6 );
+      FT_UShort  y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 );
 
-    metrics->x_ppem  = (FT_UShort)( dim_x >> 6 );
-    metrics->y_ppem  = (FT_UShort)( dim_y >> 6 );
+
+      if ( x_ppem == metrics->x_ppem && y_ppem == metrics->y_ppem )
+        return FT_Err_Ok;
+
+      metrics->x_ppem = x_ppem;
+      metrics->y_ppem = y_ppem;
+    }
 
     metrics->x_scale = 0x10000L;
     metrics->y_scale = 0x10000L;
@@ -2061,7 +2056,6 @@
     metrics = &face->size->metrics;
     clazz   = driver->clazz;
 
-    /* default processing -- this can be overridden by the driver */
     if ( pixel_width == 0 )
       pixel_width = pixel_height;
 
@@ -2073,6 +2067,12 @@
     if ( pixel_height < 1 )
       pixel_height = 1;
 
+    /* use `>=' to avoid potention compiler warning on 16bit platforms */
+    if ( pixel_width  >= 0xFFFFU )
+      pixel_width  = 0xFFFFU;
+    if ( pixel_height >= 0xFFFFU )
+      pixel_height = 0xFFFFU;
+
     metrics->x_ppem = (FT_UShort)pixel_width;
     metrics->y_ppem = (FT_UShort)pixel_height;
 
@@ -2134,8 +2134,8 @@
 
           if ( kern_mode != FT_KERNING_UNFITTED )
           {
-            akerning->x = ( akerning->x + 32 ) & -64;
-            akerning->y = ( akerning->y + 32 ) & -64;
+            akerning->x = FT_PIX_ROUND( akerning->x );
+            akerning->y = FT_PIX_ROUND( akerning->y );
           }
         }
       }
@@ -2368,21 +2368,15 @@
 
     if ( face && FT_HAS_GLYPH_NAMES( face ) )
     {
-      /* now, lookup for glyph name */
-      FT_Driver         driver = face->driver;
-      FT_Module_Class*  clazz  = FT_MODULE_CLASS( driver );
+      FT_Service_GlyphDict  service;
 
 
-      if ( clazz->get_interface )
-      {
-        FT_Face_GetGlyphNameIndexFunc  requester;
-
+      FT_FACE_LOOKUP_SERVICE( face,
+                              service,
+                              GLYPH_DICT );
 
-        requester = (FT_Face_GetGlyphNameIndexFunc)clazz->get_interface(
-                      FT_MODULE( driver ), "name_index" );
-        if ( requester )
-          result = requester( face, glyph_name );
-      }
+      if ( service && service->name_index )
+        result = service->name_index( face, glyph_name );
     }
 
     return result;
@@ -2408,21 +2402,15 @@
          glyph_index <= (FT_UInt)face->num_glyphs &&
          FT_HAS_GLYPH_NAMES( face )               )
     {
-      /* now, lookup for glyph name */
-      FT_Driver         driver = face->driver;
-      FT_Module_Class*  clazz  = FT_MODULE_CLASS( driver );
+      FT_Service_GlyphDict  service;
 
 
-      if ( clazz->get_interface )
-      {
-        FT_Face_GetGlyphNameFunc  requester;
+      FT_FACE_LOOKUP_SERVICE( face,
+                              service,
+                              GLYPH_DICT );
 
-
-        requester = (FT_Face_GetGlyphNameFunc)clazz->get_interface(
-                      FT_MODULE( driver ), "glyph_name" );
-        if ( requester )
-          error = requester( face, glyph_index, buffer, buffer_max );
-      }
+      if ( service && service->get_name )
+        error = service->get_name( face, glyph_index, buffer, buffer_max );
     }
 
     return error;
@@ -2440,25 +2428,19 @@
     if ( !face )
       goto Exit;
 
-    result = face->internal->postscript_name;
     if ( !result )
     {
-      /* now, look up glyph name */
-      FT_Driver         driver = face->driver;
-      FT_Module_Class*  clazz  = FT_MODULE_CLASS( driver );
-
+      FT_Service_PsFontName  service;
 
-      if ( clazz->get_interface )
-      {
-        FT_Face_GetPostscriptNameFunc  requester;
 
+      FT_FACE_LOOKUP_SERVICE( face,
+                              service,
+                              POSTSCRIPT_FONT_NAME );
 
-        requester = (FT_Face_GetPostscriptNameFunc)clazz->get_interface(
-                      FT_MODULE( driver ), "postscript_name" );
-        if ( requester )
-          result = requester( face );
-      }
+      if ( service && service->get_ps_font_name )
+        result = service->get_ps_font_name( face );
     }
+
   Exit:
     return result;
   }
@@ -2470,21 +2452,17 @@
   FT_Get_Sfnt_Table( FT_Face      face,
                      FT_Sfnt_Tag  tag )
   {
-    void*                   table = 0;
-    FT_Get_Sfnt_Table_Func  func;
-    FT_Driver               driver;
+    void*                  table = 0;
+    FT_Service_SFNT_Table  service;
 
 
-    if ( !face || !FT_IS_SFNT( face ) )
-      goto Exit;
-
-    driver = face->driver;
-    func = (FT_Get_Sfnt_Table_Func)driver->root.clazz->get_interface(
-                                     FT_MODULE( driver ), "get_sfnt" );
-    if ( func )
-      table = func( face, tag );
+    if ( face && FT_IS_SFNT( face ) )
+    {
+      FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
+      if ( service != NULL )
+        table = service->get_table( face, tag );
+    }
 
-  Exit:
     return table;
   }
 
@@ -2498,20 +2476,39 @@
                       FT_Byte*   buffer,
                       FT_ULong*  length )
   {
-    SFNT_Load_Table_Func  func;
-    FT_Driver             driver;
+    FT_Service_SFNT_Table  service;
 
 
     if ( !face || !FT_IS_SFNT( face ) )
       return FT_Err_Invalid_Face_Handle;
 
-    driver = face->driver;
-    func   = (SFNT_Load_Table_Func) driver->root.clazz->get_interface(
-                                      FT_MODULE( driver ), "load_sfnt" );
-    if ( !func )
+    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
+    if ( service == NULL )
       return FT_Err_Unimplemented_Feature;
 
-    return func( face, tag, offset, buffer, length );
+    return service->load_table( face, tag, offset, buffer, length );
+  }
+
+
+  FT_EXPORT_DEF( FT_ULong )
+  FT_Get_CMap_Language_ID( FT_CharMap  charmap )
+  {
+    FT_Service_TTCMaps  service;
+    FT_Face             face;
+    TT_CMapInfo         cmap_info;
+
[truncated at 1000 lines; 66 more skipped]

reactos/lib/freetype/src/base
ftoutln.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftoutln.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftoutln.c	10 May 2004 17:48:30 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType outline management (body).                                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -26,6 +26,7 @@
 #include <ft2build.h>
 #include FT_OUTLINE_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_TRIGONOMETRY_H
 
 
   /*************************************************************************/
@@ -357,14 +358,11 @@
          source->n_contours != target->n_contours )
       return FT_Err_Invalid_Argument;
 
-    FT_MEM_COPY( target->points, source->points,
-                 source->n_points * sizeof ( FT_Vector ) );
+    FT_ARRAY_COPY( target->points, source->points, source->n_points );
 
-    FT_MEM_COPY( target->tags, source->tags,
-                 source->n_points * sizeof ( FT_Byte ) );
+    FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
 
-    FT_MEM_COPY( target->contours, source->contours,
-                 source->n_contours * sizeof ( FT_Short ) );
+    FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
 
     /* copy all flags, except the `FT_OUTLINE_OWNER' one */
     is_owner      = target->flags & FT_OUTLINE_OWNER;
@@ -655,4 +653,143 @@
   }
 
 
+  typedef struct  FT_OrientationExtremumRec_
+  {
+    FT_Int   index;
+    FT_Long  pos;
+    FT_Int   first;
+    FT_Int   last;
+
+  } FT_OrientationExtremumRec;
+
+
+  static FT_Orientation
+  ft_orientation_extremum_compute( FT_OrientationExtremumRec*  extremum,
+                                   FT_Outline*                 outline )
+  {
+    FT_Vector  *point, *first, *last, *prev, *next;
+    FT_Vector*  points = outline->points;
+    FT_Angle    angle_in, angle_out;
+
+
+    /* compute the previous and next points in the same contour */
+    point = points + extremum->index;
+    first = points + extremum->first;
+    last  = points + extremum->last;
+
+    prev = point;
+    next = point;
+
+    do
+    {
+      prev = ( prev == first ) ? last : prev - 1;
+      if ( prev == point )
+        return FT_ORIENTATION_TRUETYPE;  /* degenerate case */
+
+    } while ( prev->x != point->x || prev->y != point->y );
+
+    do
+    {
+      next = ( next == last ) ? first : next + 1;
+      if ( next == point )
+        return FT_ORIENTATION_TRUETYPE;  /* shouldn't happen */
+
+    } while ( next->x != point->x || next->y != point->y );
+
+    /* now compute the orientation of the `out' vector relative */
+    /* to the `in' vector.                                      */
+    angle_in  = FT_Atan2( point->x - prev->x,  point->y - prev->y );
+    angle_out = FT_Atan2( next->x  - point->x, next->y  - point->y );
+
+    return ( FT_Angle_Diff( angle_in, angle_out ) >= 0 )
+             ? FT_ORIENTATION_TRUETYPE
+             : FT_ORIENTATION_POSTSCRIPT;
+  }
+
+
+  FT_EXPORT_DEF( FT_Orientation )
+  FT_Outline_Get_Orientation( FT_Outline*  outline )
+  {
+    FT_Orientation  result = FT_ORIENTATION_TRUETYPE;
+
+
+    if ( outline && outline->n_points > 0 )
+    {
+      FT_OrientationExtremumRec  xmin, ymin, xmax, ymax;
+      FT_Int                     n;
+      FT_Int                     first, last;
+      FT_Vector*                 points = outline->points;
+
+
+      xmin.pos = ymin.pos = +32768L;
+      xmax.pos = ymax.pos = -32768L;
+
+      xmin.index = ymin.index = xmax.index = ymax.index = -1;
+
+      first = 0;
+      for ( n = 0; n < outline->n_contours; n++, first = last + 1 )
+      {
+        last = outline->contours[n];
+
+        /* skip single-point contours; these are degenerated cases */
+        if ( last > first + 1 )
+        {
+          FT_Int  i;
+
+
+          for ( i = first; i < last; i++ )
+          {
+            FT_Pos  x = points[i].x;
+            FT_Pos  y = points[i].y;
+
+
+            if ( x < xmin.pos )
+            {
+              xmin.pos   = x;
+              xmin.index = i;
+              xmin.first = first;
+              xmin.last  = last;
+            }
+            if ( x > xmax.pos )
+            {
+              xmax.pos   = x;
+              xmax.index = i;
+              xmax.first = first;
+              xmax.last  = last;
+            }
+            if ( y < ymin.pos )
+            {
+              ymin.pos   = y;
+              ymin.index = i;
+              ymin.first = first;
+              ymin.last  = last;
+            }
+            if ( y > ymax.pos )
+            {
+              ymax.pos   = y;
+              ymax.index = i;
+              ymax.first = first;
+              ymax.last  = last;
+            }
+          }
+        }
+
+        if ( xmin.index >= 0 )
+          result = ft_orientation_extremum_compute( &xmin, outline );
+
+        else if ( xmax.index >= 0 )
+          result = ft_orientation_extremum_compute( &xmax, outline );
+
+        else if ( ymin.index >= 0 )
+          result = ft_orientation_extremum_compute( &ymin, outline );
+
+        else if ( ymax.index >= 0 )
+          result = ft_orientation_extremum_compute( &ymax, outline );
+      }
+    }
+
+    return result;
+  }
+
+
 /* END */

reactos/lib/freetype/src/base
ftpfr.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftpfr.c	15 Feb 2004 21:45:33 -0000	1.4
+++ ftpfr.c	10 May 2004 17:48:31 -0000	1.5
@@ -16,34 +16,20 @@
 /***************************************************************************/
 
 #include <ft2build.h>
-#include FT_INTERNAL_PFR_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_PFR_H
 
 
   /* check the format */
-  static FT_Error
-  ft_pfr_check( FT_Face          face,
-                FT_PFR_Service  *aservice )
+  static FT_Service_PfrMetrics
+  ft_pfr_check( FT_Face  face )
   {
-    FT_Error  error = FT_Err_Bad_Argument;
+    FT_Service_PfrMetrics  service;
 
 
-    if ( face && face->driver )
-    {
-      FT_Module    module = (FT_Module) face->driver;
-      const char*  name   = module->clazz->module_name;
-
+    FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
 
-      if ( name[0] == 'p' &&
-           name[1] == 'f' &&
-           name[2] == 'r' &&
-           name[4] == 0   )
-      {
-        *aservice = (FT_PFR_Service) module->clazz->module_interface;
-        error = 0;
-      }
-    }
-    return error;
+    return service;
   }
 
 
@@ -54,12 +40,12 @@
                       FT_Fixed  *ametrics_x_scale,
                       FT_Fixed  *ametrics_y_scale )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error = FT_Err_Ok;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_metrics( face,
                                     aoutline_resolution,
@@ -67,6 +53,27 @@
                                     ametrics_x_scale,
                                     ametrics_y_scale );
     }
+    else if ( face )
+    {
+      FT_Fixed  x_scale, y_scale;
+
+
+      /* this is not a PFR font */
+      *aoutline_resolution = face->units_per_EM;
+      *ametrics_resolution = face->units_per_EM;
+
+      x_scale = y_scale = 0x10000L;
+      if ( face->size )
+      {
+        x_scale = face->size->metrics.x_scale;
+        y_scale = face->size->metrics.y_scale;
+      }
+      *ametrics_x_scale = x_scale;
+      *ametrics_y_scale = y_scale;
+    }
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
@@ -77,15 +84,19 @@
                       FT_UInt     right,
                       FT_Vector  *avector )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
-    {
+    service = ft_pfr_check( face );
+    if ( service )
       error = service->get_kerning( face, left, right, avector );
-    }
+    else if ( face )
+      error = FT_Get_Kerning( face, left, right,
+                              FT_KERNING_UNSCALED, avector );
+    else
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 
@@ -95,15 +106,19 @@
                       FT_UInt   gindex,
                       FT_Pos   *aadvance )
   {
-    FT_Error        error;
-    FT_PFR_Service  service;
+    FT_Error               error;
+    FT_Service_PfrMetrics  service;
 
 
-    error = ft_pfr_check( face, &service );
-    if ( !error )
+    service = ft_pfr_check( face );
+    if ( service )
     {
       error = service->get_advance( face, gindex, aadvance );
     }
+    else
+      /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
+      error = FT_Err_Invalid_Argument;
+
     return error;
   }
 

reactos/lib/freetype/src/base
ftstream.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ftstream.c	1 Apr 2003 08:38:21 -0000	1.1
+++ ftstream.c	10 May 2004 17:48:31 -0000	1.2
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    I/O stream support (body).                                           */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -770,15 +770,15 @@
       p = (FT_Byte*)structure + fields->offset;
       switch ( fields->size )
       {
-      case 1:
+      case (8 / FT_CHAR_BIT):
         *(FT_Byte*)p = (FT_Byte)value;
         break;
 
-      case 2:
+      case (16 / FT_CHAR_BIT):
         *(FT_UShort*)p = (FT_UShort)value;
         break;
 
-      case 4:
+      case (32 / FT_CHAR_BIT):
         *(FT_UInt32*)p = (FT_UInt32)value;
         break;
 

reactos/lib/freetype/src/base
ftstroke.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftstroke.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftstroke.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType path stroker (body).                                        */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,8 +19,31 @@
 #include <ft2build.h>
 #include FT_STROKER_H
 #include FT_TRIGONOMETRY_H
+#include FT_OUTLINE_H
 #include FT_INTERNAL_MEMORY_H
 #include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_OBJECTS_H
+
+  FT_EXPORT_DEF( FT_StrokerBorder )
+  FT_Outline_GetInsideBorder( FT_Outline*  outline )
+  {
+    FT_Orientation  o = FT_Outline_Get_Orientation( outline );
+
+
+    return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT
+                                        : FT_STROKER_BORDER_LEFT ;
+  }
+
+
+  FT_EXPORT_DEF( FT_StrokerBorder )
+  FT_Outline_GetOutsideBorder( FT_Outline*  outline )
+  {
+    FT_Orientation  o = FT_Outline_Get_Orientation( outline );
+
+
+    return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_LEFT
+                                        : FT_STROKER_BORDER_RIGHT ;
+  }
 
 
  /***************************************************************************/
@@ -221,6 +244,7 @@
     FT_Bool     movable;
     FT_Int      start;    /* index of current sub-path start point */
     FT_Memory   memory;
+    FT_Bool     valid;
 
   } FT_StrokeBorderRec, *FT_StrokeBorder;
 
@@ -468,6 +492,7 @@
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
+    border->valid      = 0;
   }
 
 
@@ -476,6 +501,7 @@
   {
     border->num_points = 0;
     border->start      = -1;
+    border->valid      = 0;
   }
 
 
@@ -491,6 +517,7 @@
     border->num_points = 0;
     border->max_points = 0;
     border->start      = -1;
+    border->valid      = 0;
   }
 
 
@@ -520,7 +547,7 @@
       }
       else if ( in_contour == 0 )
         goto Fail;
- 
+
       if ( tags[0] & FT_STROKE_TAG_END )
       {
         if ( in_contour == 0 )
@@ -534,6 +561,8 @@
     if ( in_contour != 0 )
       goto Fail;
 
+    border->valid = 1;
+
   Exit:
     *anum_points   = num_points;
     *anum_contours = num_contours;
@@ -551,9 +580,9 @@
                            FT_Outline*      outline )
   {
     /* copy point locations */
-    FT_MEM_COPY( outline->points + outline->n_points,
-                 border->points,
-                 border->num_points * sizeof ( FT_Vector ) );
+    FT_ARRAY_COPY( outline->points + outline->n_points,
+                   border->points,
+                   border->num_points );
 
     /* copy tags */
     {
@@ -661,10 +690,18 @@
     stroker->line_join   = line_join;
     stroker->miter_limit = miter_limit;
 
-    stroker->valid = 0;
+    FT_Stroker_Rewind( stroker );
+  }
 
-    ft_stroke_border_reset( &stroker->borders[0] );
-    ft_stroke_border_reset( &stroker->borders[1] );
+
+  FT_EXPORT_DEF( void )
+  FT_Stroker_Rewind( FT_Stroker  stroker )
+  {
+    if ( stroker )
+    {
+      ft_stroke_border_reset( &stroker->borders[0] );
+      ft_stroke_border_reset( &stroker->borders[1] );
+    }
   }
 
 
@@ -1347,7 +1384,6 @@
   {
     FT_Error  error  = 0;
 
-
     if ( stroker->subpath_open )
     {
       FT_StrokeBorder  right = stroker->borders;
@@ -1380,6 +1416,14 @@
       FT_Angle  turn;
       FT_Int    inside_side;
 
+      /* close the path if needed */
+      if ( stroker->center.x != stroker->subpath_start.x ||
+           stroker->center.y != stroker->subpath_start.y )
+      {
+        error = FT_Stroker_LineTo( stroker, &stroker->subpath_start );
+        if ( error )
+          goto Exit;
+      }
 
       /* process the corner */
       stroker->angle_out = stroker->subpath_angle;
@@ -1408,17 +1452,41 @@
           goto Exit;
       }
 
-      /* we will first end our two subpaths */
+      /* then end our two subpaths */
       ft_stroke_border_close( stroker->borders + 0 );
       ft_stroke_border_close( stroker->borders + 1 );
+    }
 
-      /* now, add the reversed left subpath to "right" */
-      error = ft_stroker_add_reverse_left( stroker, 0 );
-      if ( error )
-        goto Exit;
+  Exit:
+    return error;
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Stroker_GetBorderCounts( FT_Stroker        stroker,
+                              FT_StrokerBorder  border,
+                              FT_UInt          *anum_points,
+                              FT_UInt          *anum_contours )
+  {
+    FT_UInt   num_points = 0, num_contours = 0;
+    FT_Error  error;
+
+
+    if ( !stroker || border > 1 )
+    {
+      error = FT_Err_Invalid_Argument;
+      goto Exit;
     }
 
+    error = ft_stroke_border_get_counts( stroker->borders + border,
+                                         &num_points, &num_contours );
   Exit:
+    if ( anum_points )
+      *anum_points = num_points;
+
+    if ( anum_contours )
+      *anum_contours = num_contours;
+
     return error;
   }
 
@@ -1446,8 +1514,6 @@
     num_points   = count1 + count3;
     num_contours = count2 + count4;
 
-    stroker->valid = 1;
-
   Exit:
     *anum_points   = num_points;
     *anum_contours = num_contours;
@@ -1456,17 +1522,31 @@
 
 
   FT_EXPORT_DEF( void )
-  FT_Stroker_Export( FT_Stroker   stroker,
-                     FT_Outline*  outline )
+  FT_Stroker_ExportBorder( FT_Stroker        stroker,
+                           FT_StrokerBorder  border,
+                           FT_Outline*       outline )
   {
-    if ( stroker->valid )
+    if ( border == FT_STROKER_BORDER_LEFT  ||
+         border == FT_STROKER_BORDER_RIGHT )
     {
-      ft_stroke_border_export( stroker->borders + 0, outline );
-      ft_stroke_border_export( stroker->borders + 1, outline );
+      FT_StrokeBorder  sborder = & stroker->borders[border];
+
+
+      if ( sborder->valid )
+        ft_stroke_border_export( sborder, outline );
     }
   }
 
 
+  FT_EXPORT_DEF( void )
+  FT_Stroker_Export( FT_Stroker   stroker,
+                     FT_Outline*  outline )
+  {
+    FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_LEFT, outline );
+    FT_Stroker_ExportBorder( stroker, FT_STROKER_BORDER_RIGHT, outline );
+  }
+
+
   /*
    *  The following is very similar to FT_Outline_Decompose, except
    *  that we do support opened paths, and do not scale the outline.
@@ -1494,6 +1574,8 @@
     if ( !outline || !stroker )
       return FT_Err_Invalid_Argument;
 
+    FT_Stroker_Rewind( stroker );
+
     first = 0;
 
     for ( n = 0; n < outline->n_contours; n++ )
@@ -1664,4 +1746,161 @@
   }
 
 
+  extern const FT_Glyph_Class  ft_outline_glyph_class;
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Glyph_Stroke( FT_Glyph    *pglyph,
+                   FT_Stroker   stroker,
+                   FT_Bool      destroy )
+  {
+    FT_Error  error = FT_Err_Invalid_Argument;
+    FT_Glyph  glyph = NULL;
+
+
+    if ( pglyph == NULL )
+      goto Exit;
+
+    glyph = *pglyph;
+    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+      goto Exit;
+
+    {
+      FT_Glyph  copy;
+
+
+      error = FT_Glyph_Copy( glyph, &copy );
+      if ( error )
+        goto Exit;
+
+      glyph = copy;
+    }
+
+    {
+      FT_OutlineGlyph  oglyph  = (FT_OutlineGlyph) glyph;
+      FT_Outline*      outline = &oglyph->outline;
+      FT_UInt          num_points, num_contours;
+
+
+      error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+      if ( error )
+        goto Fail;
+
+      (void)FT_Stroker_GetCounts( stroker, &num_points, &num_contours );
+
+      FT_Outline_Done( glyph->library, outline );
+
+      error = FT_Outline_New( glyph->library,
+                              num_points, num_contours, outline );
+      if ( error )
+        goto Fail;
+
+      outline->n_points   = 0;
+      outline->n_contours = 0;
+
+      FT_Stroker_Export( stroker, outline );
+    }
+
+    if ( destroy )
+      FT_Done_Glyph( *pglyph );
+
+    *pglyph = glyph;
+    goto Exit;
+
+  Fail:
+    FT_Done_Glyph( glyph );
+    glyph = NULL;
+
+    if ( !destroy )
+      *pglyph = NULL;
+
+  Exit:
+    return error;
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Glyph_StrokeBorder( FT_Glyph    *pglyph,
+                         FT_Stroker   stroker,
+                         FT_Bool      inside,
+                         FT_Bool      destroy )
+  {
+    FT_Error  error = FT_Err_Invalid_Argument;
+    FT_Glyph  glyph = NULL;
+
+
+    if ( pglyph == NULL )
+      goto Exit;
+
+    glyph = *pglyph;
+    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+      goto Exit;
+
+    {
+      FT_Glyph  copy;
+
+
+      error = FT_Glyph_Copy( glyph, &copy );
+      if ( error )
+        goto Exit;
+
+      glyph = copy;
+    }
+
+    {
+      FT_OutlineGlyph   oglyph  = (FT_OutlineGlyph) glyph;
+      FT_StrokerBorder  border;
+      FT_Outline*       outline = &oglyph->outline;
+      FT_UInt           num_points, num_contours;
+
+
+      border = FT_Outline_GetOutsideBorder( outline );
+      if ( inside )
+      {
+        if ( border == FT_STROKER_BORDER_LEFT )
+          border = FT_STROKER_BORDER_RIGHT;
+        else
+          border = FT_STROKER_BORDER_LEFT;
+      }
+
+      error = FT_Stroker_ParseOutline( stroker, outline, 0 );
+      if ( error )
+        goto Fail;
+
+      (void)FT_Stroker_GetBorderCounts( stroker, border,
+                                        &num_points, &num_contours );
+
+      FT_Outline_Done( glyph->library, outline );
+
+      error = FT_Outline_New( glyph->library,
+                              num_points,
+                              num_contours,
+                              outline );
+      if ( error )
+        goto Fail;
+
+      outline->n_points   = 0;
+      outline->n_contours = 0;
+
+      FT_Stroker_ExportBorder( stroker, border, outline );
+    }
+
+    if ( destroy )
+      FT_Done_Glyph( *pglyph );
+
+    *pglyph = glyph;
+    goto Exit;
+
+  Fail:
+    FT_Done_Glyph( glyph );
+    glyph = NULL;
+
+    if ( !destroy )
+      *pglyph = NULL;
+
+  Exit:
+    return error;
+  }
+
+
 /* END */

reactos/lib/freetype/src/base
ftsynth.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftsynth.c	15 Feb 2004 21:45:33 -0000	1.4
+++ ftsynth.c	10 May 2004 17:48:31 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType synthesizing code for emboldening and slanting (body).      */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -279,7 +279,8 @@
       first = last + 1;
     }
 
-    slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + distance*4 ) & -64;
+    slot->metrics.horiAdvance =
+      ( slot->metrics.horiAdvance + distance*4 ) & ~63;
   }
 
 

reactos/lib/freetype/src/base
fttrigon.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- fttrigon.c	15 Feb 2004 21:45:33 -0000	1.5
+++ fttrigon.c	10 May 2004 17:48:31 -0000	1.6
@@ -17,6 +17,7 @@
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
 #include FT_TRIGONOMETRY_H
 
 
@@ -271,9 +272,9 @@
 
     /* round theta */
     if ( theta >= 0 )
-      theta = ( theta + 16 ) & -32;
+      theta = FT_PAD_ROUND( theta, 32 );
     else
-      theta = - (( -theta + 16 ) & -32);
+      theta = - FT_PAD_ROUND( -theta, 32 );
 
     vec->x = x;
     vec->y = theta;

reactos/lib/freetype/src/base
fttype1.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- fttype1.c	15 Feb 2004 21:45:33 -0000	1.3
+++ fttype1.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType utility file for PS names support (body).                   */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,9 +17,9 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_TYPE42_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
 
 
   /* documentation is in t1tables.h */
@@ -28,56 +28,39 @@
   FT_Get_PS_Font_Info( FT_Face          face,
                        PS_FontInfoRec*  afont_info )
   {
-    PS_FontInfo  font_info = NULL;
-    FT_Error     error     = FT_Err_Invalid_Argument;
-    const char*  driver_name;
+    FT_Error  error = FT_Err_Invalid_Argument;
 
 
-    if ( face && face->driver && face->driver->root.clazz )
+    if ( face )
     {
-      driver_name = face->driver->root.clazz->module_name;
-      if ( ft_strcmp( driver_name, "type1" ) == 0 )
-        font_info = &((T1_Face)face)->type1.font_info;
-      else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
-        font_info = &((CID_Face)face)->cid.font_info;
-      else if ( ft_strcmp( driver_name, "type42" ) == 0 )
-        font_info = &((T42_Face)face)->type1.font_info;
-    }
-    if ( font_info != NULL )
-    {
-      *afont_info = *font_info;
-      error = FT_Err_Ok;
+      FT_Service_PsInfo  service = NULL;
+
+
+      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
+
+      if ( service && service->ps_get_font_info )
+        error = service->ps_get_font_info( face, afont_info );
     }
 
     return error;
   }
 
 
-  /* XXX: Bad hack, but I didn't want to change several drivers here. */
-
   /* documentation is in t1tables.h */
 
   FT_EXPORT_DEF( FT_Int )
   FT_Has_PS_Glyph_Names( FT_Face  face )
   {
-    FT_Int       result = 0;
-    const char*  driver_name;
+    FT_Int             result  = 0;
+    FT_Service_PsInfo  service = NULL;
 
 
-    if ( face && face->driver && face->driver->root.clazz )
+    if ( face )
     {
-      /* Currently, only the type1, type42, and cff drivers provide */
-      /* reliable glyph names...                                    */
+      FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
 
-      /* We could probably hack the TrueType driver to recognize    */
-      /* certain cases where the glyph names are most certainly     */
-      /* correct (e.g. using a 20 or 22 format `post' table), but   */
-      /* this will probably happen later...                         */
-
-      driver_name = face->driver->root.clazz->module_name;
-      result      = ( ft_strcmp( driver_name, "type1"  ) == 0 ||
-                      ft_strcmp( driver_name, "type42" ) == 0 ||
-                      ft_strcmp( driver_name, "cff"    ) == 0 );
+      if ( service && service->ps_has_glyph_names )
+        result = service->ps_has_glyph_names( face );
     }
 
     return result;

reactos/lib/freetype/src/base
ftwinfnt.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftwinfnt.c	15 Feb 2004 21:45:33 -0000	1.4
+++ ftwinfnt.c	10 May 2004 17:48:31 -0000	1.5
@@ -18,38 +18,30 @@
 
 #include <ft2build.h>
 #include FT_WINFONTS_H
-#include FT_INTERNAL_FNT_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_WINFNT_H
 
 
   FT_EXPORT_DEF( FT_Error )
   FT_Get_WinFNT_Header( FT_Face               face,
                         FT_WinFNT_HeaderRec  *header )
   {
-    FT_Error  error;
+    FT_Service_WinFnt  service;
+    FT_Error           error;
 
 
     error = FT_Err_Invalid_Argument;
 
-    if ( face != NULL && face->driver != NULL )
+    if ( face != NULL )
     {
-      FT_Module  driver = (FT_Module) face->driver;
+      FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
 
-
-      if ( driver->clazz && driver->clazz->module_name              &&
-           ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
+      if ( service != NULL )
       {
-        FNT_Face  fnt_face = (FNT_Face)face;
-        FNT_Font  font     = fnt_face->font;
-
-
-        if ( font )
-        {
-          FT_MEM_COPY( header, &font->header, sizeof ( *header ) );
-          error = FT_Err_Ok;
-        }
+        error = service->get_header( face, header );
       }
     }
+
     return error;
   }
 

reactos/lib/freetype/src/base
ftxf86.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftxf86.c	15 Feb 2004 21:45:33 -0000	1.4
+++ ftxf86.c	10 May 2004 17:48:31 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType utility file for X11 support (body).                        */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,59 +19,16 @@
 #include <ft2build.h>
 #include FT_XFREE86_H
 #include FT_INTERNAL_OBJECTS_H
-
-  /* XXX: This really is a sad hack, but I didn't want to change every     */
-  /*      driver just to support this at the moment, since other important */
-  /*      changes are coming anyway.                                       */
-
-  typedef struct  FT_FontFormatRec_
-  {
-    const char*  driver_name;
-    const char*  format_name;
-
-  } FT_FontFormatRec;
-
+#include FT_SERVICE_XFREE86_NAME_H
 
   FT_EXPORT_DEF( const char* )
   FT_Get_X11_Font_Format( FT_Face  face )
   {
-    static const FT_FontFormatRec  font_formats[] =
-    {
-      { "type1",    "Type 1" },
-      { "truetype", "TrueType" },
-      { "bdf",      "BDF" },
-      { "pcf",      "PCF" },
-      { "type42",   "Type 42" },
-      { "cidtype1", "CID Type 1" },
-      { "cff",      "CFF" },
-      { "pfr",      "PFR" },
-      { "winfonts", "Windows FNT" }
-    };
-
     const char*  result = NULL;
 
 
-    if ( face && face->driver )
-    {
-      FT_Module  driver = (FT_Module)face->driver;
-
-
-      if ( driver->clazz && driver->clazz->module_name )
-      {
-        FT_Int  n;
-        FT_Int  count = sizeof( font_formats ) / sizeof ( font_formats[0] );
-
-
-        result = driver->clazz->module_name;
-
-        for ( n = 0; n < count; n++ )
-          if ( ft_strcmp( result, font_formats[n].driver_name ) == 0 )
-          {
-            result = font_formats[n].format_name;
-            break;
-          }
-      }
-    }
+    if ( face )
+      FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
 
     return result;
   }

reactos/lib/freetype/src/base
rules.mk 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- rules.mk	21 Jan 2004 19:23:46 -0000	1.3
+++ rules.mk	10 May 2004 17:48:31 -0000	1.4
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2003 by
+# Copyright 1996-2000, 2002, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -32,16 +32,17 @@
 #
 #   ftsystem, ftinit, and ftdebug are handled by freetype.mk
 #
-BASE_SRC := $(BASE_DIR)/ftcalc.c   \
-            $(BASE_DIR)/fttrigon.c \
-            $(BASE_DIR)/ftutil.c   \
-            $(BASE_DIR)/ftstream.c \
+BASE_SRC := $(BASE_DIR)/ftapi.c    \
+            $(BASE_DIR)/ftcalc.c   \
+            $(BASE_DIR)/ftdbgmem.c \
             $(BASE_DIR)/ftgloadr.c \
-            $(BASE_DIR)/ftoutln.c  \
-            $(BASE_DIR)/ftobjs.c   \
-            $(BASE_DIR)/ftapi.c    \
             $(BASE_DIR)/ftnames.c  \
-            $(BASE_DIR)/ftdbgmem.c
+            $(BASE_DIR)/ftobjs.c   \
+            $(BASE_DIR)/ftoutln.c  \
+            $(BASE_DIR)/ftrfork.c  \
+            $(BASE_DIR)/ftstream.c \
+            $(BASE_DIR)/fttrigon.c \
+            $(BASE_DIR)/ftutil.c
 
 # Base layer `extensions' sources
 #
@@ -49,15 +50,15 @@
 # object.  It will then be linked to the final executable only if one of its
 # symbols is used by the application.
 #
-BASE_EXT_SRC := $(BASE_DIR)/ftglyph.c  \
-                $(BASE_DIR)/ftmm.c     \
+BASE_EXT_SRC := $(BASE_DIR)/ftbbox.c   \
                 $(BASE_DIR)/ftbdf.c    \
-                $(BASE_DIR)/fttype1.c  \
-                $(BASE_DIR)/ftxf86.c   \
+                $(BASE_DIR)/ftglyph.c  \
+                $(BASE_DIR)/ftmm.c     \
                 $(BASE_DIR)/ftpfr.c    \
                 $(BASE_DIR)/ftstroke.c \
+                $(BASE_DIR)/fttype1.c  \
                 $(BASE_DIR)/ftwinfnt.c \
-                $(BASE_DIR)/ftbbox.c
+                $(BASE_DIR)/ftxf86.c
 
 # Default extensions objects
 #

reactos/lib/freetype/src/bdf
bdfdrivr.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- bdfdrivr.c	15 Feb 2004 21:45:33 -0000	1.5
+++ bdfdrivr.c	10 May 2004 17:48:31 -0000	1.6
@@ -2,7 +2,7 @@
 
     FreeType font driver for bdf files
 
-    Copyright (C) 2001, 2002, 2003 by
+    Copyright (C) 2001, 2002, 2003, 2004 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,6 +31,9 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_BDF_H
 
+#include FT_SERVICE_BDF_H
+#include FT_SERVICE_XFREE86_NAME_H
+
 #include "bdf.h"
 #include "bdfdrivr.h"
 
@@ -169,6 +172,118 @@
   };
 
 
+  static FT_Error
+  bdf_interpret_style( BDF_Face  bdf )
+  {
+    FT_Error         error  = BDF_Err_Ok;
+    FT_Face          face   = FT_FACE( bdf );
+    FT_Memory        memory = face->memory;
+    bdf_font_t*      font   = bdf->bdffont;
+    bdf_property_t*  prop;
+
+    char  *istr = NULL, *bstr = NULL;
+    char  *sstr = NULL, *astr = NULL;
+
+    int  parts = 0, len = 0;
+
+
+    face->style_flags = 0;
+
+    prop = bdf_get_font_property( font, (char *)"SLANT" );
+    if ( prop && prop->format == BDF_ATOM                             &&
+         prop->value.atom                                             &&
+         ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ||
+           *(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )
+    {
+      face->style_flags |= FT_STYLE_FLAG_ITALIC;
+      istr = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' )
+               ? (char *)"Oblique"
+               : (char *)"Italic";
+      len += ft_strlen( istr );
+      parts++;
+    }
+
+    prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
+    if ( prop && prop->format == BDF_ATOM                             &&
+         prop->value.atom                                             &&
+         ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )
+    {
+      face->style_flags |= FT_STYLE_FLAG_BOLD;
+      bstr = (char *)"Bold";
+      len += ft_strlen( bstr );
+      parts++;
+    }
+
+    prop = bdf_get_font_property( font, (char *)"SETWIDTH_NAME" );
+    if ( prop && prop->format == BDF_ATOM                              &&
+         prop->value.atom && *(prop->value.atom)                       &&
+         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
+    {
+      sstr = (char *)(prop->value.atom);
+      len += ft_strlen( sstr );
+      parts++;
+    }
+
+    prop = bdf_get_font_property( font, (char *)"ADD_STYLE_NAME" );
+    if ( prop && prop->format == BDF_ATOM                              &&
+         prop->value.atom && *(prop->value.atom)                       &&
+         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
+    {
+      astr = (char *)(prop->value.atom);
+      len += ft_strlen( astr );
+      parts++;
+    }
+
+    if ( !parts || !len )
+      face->style_name = (char *)"Regular";
+    else
+    {
+      char          *style, *s;
+      unsigned int  i;
+
+
+      if ( FT_ALLOC( style, len + parts ) )
+        return error;
+
+      s = style;
+
+      if ( astr )
+      {
+        ft_strcpy( s, astr );
+        for ( i = 0; i < ft_strlen( astr ); i++, s++ )
+          if ( *s == ' ' )
+            *s = '-';                     /* replace spaces with dashes */
+        *(s++) = ' ';
+      }
+      if ( bstr )
+      {
+        ft_strcpy( s, bstr );
+        s += ft_strlen( bstr );
+        *(s++) = ' ';
+      }
+      if ( istr )
+      {
+        ft_strcpy( s, istr );
+        s += ft_strlen( istr );
+        *(s++) = ' ';
+      }
+      if ( sstr )
+      {
+        ft_strcpy( s, sstr );
+        for ( i = 0; i < ft_strlen( sstr ); i++, s++ )
+          if ( *s == ' ' )
+            *s = '-';                     /* replace spaces with dashes */
+        *(s++) = ' ';
+      }
+      *(--s) = '\0';        /* overwrite last ' ', terminate the string */
+
+      face->style_name = style;                     /* allocated string */
+    }
+
+    return error;
+  }
+
+
   FT_CALLBACK_DEF( FT_Error )
   BDF_Face_Done( BDF_Face  face )
   {
@@ -249,39 +364,17 @@
                          FT_FACE_FLAG_FAST_GLYPHS;
 
       prop = bdf_get_font_property( font, "SPACING" );
-      if ( prop != NULL )
-        if ( prop->format == BDF_ATOM )
-          if ( prop->value.atom != NULL )
-            if ( ( *(prop->value.atom) == 'M' ) ||
-                 ( *(prop->value.atom) == 'm' ) ||
-                 ( *(prop->value.atom) == 'C' ) ||
-                 ( *(prop->value.atom) == 'c' ) )
-              root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
+      if ( prop && prop->format == BDF_ATOM                             &&
+           prop->value.atom                                             &&
+           ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ||
+             *(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) )
+        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
       /* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL   */
       /* FZ XXX: I need a font to implement this */
 
-      root->style_flags = 0;
-      prop = bdf_get_font_property( font, "SLANT" );
-      if ( prop != NULL )
-        if ( prop->format == BDF_ATOM )
-          if ( prop->value.atom != NULL )
-            if ( ( *(prop->value.atom) == 'O' ) ||
-                 ( *(prop->value.atom) == 'o' ) ||
-                 ( *(prop->value.atom) == 'I' ) ||
-                 ( *(prop->value.atom) == 'i' ) )
-              root->style_flags |= FT_STYLE_FLAG_ITALIC;
-
-      prop = bdf_get_font_property( font, "WEIGHT_NAME" );
-      if ( prop != NULL )
-        if ( prop->format == BDF_ATOM )
-          if ( prop->value.atom != NULL )
-            if ( ( *(prop->value.atom) == 'B' ) ||
-                 ( *(prop->value.atom) == 'b' ) )
-              root->style_flags |= FT_STYLE_FLAG_BOLD;
-
       prop = bdf_get_font_property( font, "FAMILY_NAME" );
-      if ( ( prop != NULL ) && ( prop->value.atom != NULL ) )
+      if ( prop && prop->value.atom )
       {
         int  l = ft_strlen( prop->value.atom ) + 1;
 
@@ -293,16 +386,8 @@
       else
         root->family_name = 0;
 
-      root->style_name = (char *)"Regular";
-      if ( root->style_flags & FT_STYLE_FLAG_BOLD )
-      {
-        if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-          root->style_name = (char *)"Bold Italic";
-        else
-          root->style_name = (char *)"Bold";
-      }
-      else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-        root->style_name = (char *)"Italic";
+      if ( ( error = bdf_interpret_style( face ) ) != 0 )
+        goto Exit;
 
       root->num_glyphs = font->glyphs_size;     /* unencoded included */
 
@@ -312,43 +397,47 @@
 
       {
         FT_Bitmap_Size*  bsize = root->available_sizes;
+        FT_Short         resolution_x = 0, resolution_y = 0;
 
 
         FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
 
-        prop = bdf_get_font_property( font, "PIXEL_SIZE" );
-        if ( prop != NULL )
-          bsize->height = (FT_Short)prop->value.int32;
+        bsize->height = font->font_ascent + font->font_descent;
 
         prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
-        if ( prop != NULL )
+        if ( prop )
           bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 );
+        else
+          bsize->width = bsize->height * 2/3;
 
         prop = bdf_get_font_property( font, "POINT_SIZE" );
-        if ( prop != NULL )
+        if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
             (FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L );
 
+        prop = bdf_get_font_property( font, "PIXEL_SIZE" );
+        if ( prop )
+          bsize->y_ppem = (FT_Short)prop->value.int32 << 6;
+
         prop = bdf_get_font_property( font, "RESOLUTION_X" );
-        if ( prop != NULL )
-          bsize->x_ppem =
-            (FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
+        if ( prop )
+          resolution_x = (FT_Short)prop->value.int32;
 
         prop = bdf_get_font_property( font, "RESOLUTION_Y" );
-        if ( prop != NULL )
-          bsize->y_ppem =
-            (FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
-
-        if ( bsize->height == 0 )
-          bsize->height = (FT_Short)( ( bsize->y_ppem + 32 ) / 64 );
+        if ( prop )
+          resolution_y = (FT_Short)prop->value.int32;
 
-        if ( bsize->height == 0 )
+        if ( bsize->y_ppem == 0 )
         {
-          /* some fonts have a broken SIZE declaration (jiskan24.bdf) */
-          FT_ERROR(( "BDF_Face_Init: reading size\n" ));
-          bsize->height = (FT_Short)font->point_size;
+          bsize->y_ppem = bsize->size;
+          if ( resolution_y )
+            bsize->y_ppem = bsize->y_ppem * resolution_y / 72;
         }
+        if ( resolution_x && resolution_y )
+          bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;
+        else
+          bsize->x_ppem = bsize->y_ppem;
       }
 
       /* encoding table */
@@ -378,21 +467,21 @@
           bdf_get_font_property( font, "CHARSET_REGISTRY" );
         charset_encoding =
           bdf_get_font_property( font, "CHARSET_ENCODING" );
-        if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) )
+        if ( charset_registry && charset_encoding )
         {
-          if ( ( charset_registry->format == BDF_ATOM ) &&
-               ( charset_encoding->format == BDF_ATOM ) &&
-               ( charset_registry->value.atom != NULL ) &&
-               ( charset_encoding->value.atom != NULL ) )
+          if ( charset_registry->format == BDF_ATOM &&
+               charset_encoding->format == BDF_ATOM &&
+               charset_registry->value.atom         &&
+               charset_encoding->value.atom         )
           {
             const char*  s;
 
 
             if ( FT_NEW_ARRAY( face->charset_encoding,
-                               strlen( charset_encoding->value.atom ) + 1 ) )
+                               ft_strlen( charset_encoding->value.atom ) + 1 ) )
               goto Exit;
             if ( FT_NEW_ARRAY( face->charset_registry,
-                               strlen( charset_registry->value.atom ) + 1 ) )
+                               ft_strlen( charset_registry->value.atom ) + 1 ) )
               goto Exit;
 
             ft_strcpy( face->charset_registry, charset_registry->value.atom );
@@ -478,13 +567,14 @@
 
 
     FT_TRACE4(( "rec %d - pres %d\n",
-                size->metrics.y_ppem, root->available_sizes->height ));
+                size->metrics.y_ppem, root->available_sizes->y_ppem ));
 
-    if ( size->metrics.y_ppem == root->available_sizes->height )
+    if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 )
     {
-      size->metrics.ascender    = face->bdffont->bbx.ascent << 6;
-      size->metrics.descender   = face->bdffont->bbx.descent * ( -64 );
-      size->metrics.height      = face->bdffont->bbx.height << 6;
+      size->metrics.ascender    = face->bdffont->font_ascent << 6;
+      size->metrics.descender   = -face->bdffont->font_descent << 6;
+      size->metrics.height      = ( face->bdffont->font_ascent +
+                                    face->bdffont->font_descent ) << 6;
       size->metrics.max_advance = face->bdffont->bbx.width << 6;
 
       return BDF_Err_Ok;
@@ -630,14 +720,13 @@
       }
     }
 
-    slot->bitmap_left = 0;
+    slot->bitmap_left = glyph.bbx.x_offset;
     slot->bitmap_top  = glyph.bbx.ascent;
 
     /* FZ XXX: TODO: vertical metrics */
     slot->metrics.horiAdvance  = glyph.dwidth << 6;
     slot->metrics.horiBearingX = glyph.bbx.x_offset << 6;
-    slot->metrics.horiBearingY = ( glyph.bbx.y_offset +
-                                   glyph.bbx.height ) << 6;
+    slot->metrics.horiBearingY = glyph.bbx.ascent << 6;
     slot->metrics.width        = bitmap->width << 6;
     slot->metrics.height       = bitmap->rows << 6;
 
@@ -649,6 +738,12 @@
   }
 
 
+ /*
+  *
+  *  BDF SERVICE
+  *
+  */
+
   static FT_Error
   bdf_get_bdf_property( BDF_Face          face,
                         const char*       prop_name,
@@ -660,7 +755,7 @@
     FT_ASSERT( face && face->bdffont );
 
     prop = bdf_get_font_property( face->bdffont, prop_name );
-    if ( prop != NULL )
+    if ( prop )
     {
       switch ( prop->format )
       {
@@ -689,6 +784,38 @@
     return BDF_Err_Invalid_Argument;
   }
 
+  static FT_Error
+  bdf_get_charset_id( BDF_Face      face,
+                      const char*  *acharset_encoding,
+                      const char*  *acharset_registry )
+  {
+    *acharset_encoding = face->charset_encoding;
+    *acharset_registry = face->charset_registry;
+
+    return 0;
+  }
+
+
+  static const FT_Service_BDFRec  bdf_service_bdf =
+  {
+    (FT_BDF_GetCharsetIdFunc)bdf_get_charset_id,
+    (FT_BDF_GetPropertyFunc) bdf_get_bdf_property
+  };
+
+
+ /*
+  *
+  *  SERVICES LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  bdf_services[] =
+  {
+    { FT_SERVICE_ID_BDF,       &bdf_service_bdf },
+    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_BDF },
+    { NULL, NULL }
+  };
+
 
   static FT_Module_Interface
   bdf_driver_requester( FT_Module    module,
@@ -696,13 +823,11 @@
   {
     FT_UNUSED( module );
 
-    if ( name && ft_strcmp( name, "get_bdf_property" ) == 0 )
-      return (FT_Module_Interface)bdf_get_bdf_property;
-
-    return NULL;
+    return ft_service_list_lookup( bdf_services, name );
   }
 
 
+
   FT_CALLBACK_TABLE_DEF
   const FT_Driver_ClassRec  bdf_driver_class =
   {

reactos/lib/freetype/src/bdf
bdfdrivr.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- bdfdrivr.h	15 Feb 2004 21:45:33 -0000	1.4
+++ bdfdrivr.h	10 May 2004 17:48:31 -0000	1.5
@@ -2,7 +2,7 @@
 
     FreeType font driver for bdf fonts
 
-  Copyright (C) 2001, 2002 by
+  Copyright (C) 2001, 2002, 2003 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy

reactos/lib/freetype/src/bdf
bdflib.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- bdflib.c	15 Feb 2004 21:45:33 -0000	1.4
+++ bdflib.c	10 May 2004 17:48:31 -0000	1.5
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002, 2003 Francesco Zappa Nardelli
+ * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -163,7 +163,7 @@
     { (char *)"_MULE_RELATIVE_COMPOSE",  BDF_INTEGER,  1, { 0 } },
   };
 
-  static unsigned long
+  static const unsigned long
   _num_bdf_properties = sizeof ( _bdf_properties ) /
                         sizeof ( _bdf_properties[0] );
 
@@ -391,7 +391,7 @@
 
   /* An empty string for empty fields. */
 
-  static char  empty[1] = { 0 };   /* XXX eliminate this */
+  static const char  empty[1] = { 0 };      /* XXX eliminate this */
 
 
   /* Assume the line is NULL-terminated and that the `list' parameter */
@@ -468,7 +468,7 @@
       }
 
       /* Assign the field appropriately. */
-      list->field[list->used++] = ( ep > sp ) ? sp : empty;
+      list->field[list->used++] = ( ep > sp ) ? sp : (char*)empty;
 
       sp = ep;
 
@@ -511,7 +511,7 @@
     }
 
     if ( final_empty )
-      list->field[list->used++] = empty;
+      list->field[list->used++] = (char*)empty;
 
     if ( list->used == list->size )
     {
@@ -1770,14 +1770,14 @@
 
       /* Determine the overall font bounding box as the characters are */
       /* loaded so corrections can be done later if indicated.         */
-      p->maxas    = (short)MAX( glyph->bbx.ascent, p->maxas );
-      p->maxds    = (short)MAX( glyph->bbx.descent, p->maxds );
+      p->maxas    = (short)FT_MAX( glyph->bbx.ascent, p->maxas );
+      p->maxds    = (short)FT_MAX( glyph->bbx.descent, p->maxds );
 
       p->rbearing = (short)( glyph->bbx.width + glyph->bbx.x_offset );
 
-      p->maxrb    = (short)MAX( p->rbearing, p->maxrb );
-      p->minlb    = (short)MIN( glyph->bbx.x_offset, p->minlb );
-      p->maxlb    = (short)MAX( glyph->bbx.x_offset, p->maxlb );
+      p->maxrb    = (short)FT_MAX( p->rbearing, p->maxrb );
+      p->minlb    = (short)FT_MIN( glyph->bbx.x_offset, p->minlb );
+      p->maxlb    = (short)FT_MAX( glyph->bbx.x_offset, p->maxlb );
 
       if ( !( p->flags & _BDF_DWIDTH ) )
       {

reactos/lib/freetype/src/cache
ftcbasic.c 1.2 -> 1.3
diff -N ftcbasic.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftcbasic.c	10 May 2004 17:48:31 -0000	1.3
@@ -0,0 +1,425 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcbasic.c                                                             */
+/*                                                                         */
+/*    The FreeType basic cache interface (body).                           */
+/*                                                                         */
+/*  Copyright 2003, 2004 by                                                */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_INTERNAL_GLYPH_H
+#include FT_CACHE_INTERNAL_IMAGE_H
+#include FT_CACHE_INTERNAL_SBITS_H
+#include FT_INTERNAL_MEMORY_H
+
+#include "ftccback.h"
+#include "ftcerror.h"
+
+
+  /*
+   *  Basic Families
+   *
+   */
+  typedef struct  FTC_BasicAttrRec_
+  {
+    FTC_ScalerRec  scaler;
+    FT_UInt        load_flags;
+
+  } FTC_BasicAttrRec, *FTC_BasicAttrs;
+
+#define FTC_BASIC_ATTR_COMPARE( a, b )                           \
+          ( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) &&  \
+            (a)->load_flags == (b)->load_flags               )
+
+#define FTC_BASIC_ATTR_HASH( a )                                   \
+          ( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags )
+
+
+  typedef struct  FTC_BasicQueryRec_
+  {
+    FTC_GQueryRec     gquery;
+    FTC_BasicAttrRec  attrs;
+
+  } FTC_BasicQueryRec, *FTC_BasicQuery;
+
+
+  typedef struct  FTC_BasicFamilyRec_
+  {
+    FTC_FamilyRec     family;
+    FTC_BasicAttrRec  attrs;
+
+  } FTC_BasicFamilyRec, *FTC_BasicFamily;
+
+
+  FT_CALLBACK_DEF( FT_Bool )
+  ftc_basic_family_compare( FTC_BasicFamily  family,
+                            FTC_BasicQuery   query )
+  {
+    return FT_BOOL( FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ) );
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  ftc_basic_family_init( FTC_BasicFamily  family,
+                         FTC_BasicQuery   query,
+                         FTC_Cache        cache )
+  {
+    FTC_Family_Init( FTC_FAMILY( family ), cache );
+    family->attrs = query->attrs;
+    return 0;
+  }
+
+
+  FT_CALLBACK_DEF( FT_UInt )
+  ftc_basic_family_get_count( FTC_BasicFamily  family,
+                              FTC_Manager      manager )
+  {
+    FT_Error  error;
+    FT_Face   face;
+    FT_UInt   result = 0;
+
+
+    error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
+                                    &face );
+    if ( !error )
+      result = face->num_glyphs;
+
+    return result;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  ftc_basic_family_load_bitmap( FTC_BasicFamily  family,
+                                FT_UInt          gindex,
+                                FTC_Manager      manager,
+                                FT_Face         *aface )
+  {
+    FT_Error  error;
+    FT_Size   size;
+
+
+    error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size );
+    if ( !error )
+    {
+      FT_Face  face = size->face;
+
+
+      error = FT_Load_Glyph( face, gindex,
+                             family->attrs.load_flags | FT_LOAD_RENDER );
+      if ( !error )
+        *aface = face;
+    }
+
+    return error;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
+  ftc_basic_family_load_glyph( FTC_BasicFamily  family,
+                               FT_UInt          gindex,
+                               FTC_Cache        cache,
+                               FT_Glyph        *aglyph )
+  {
+    FT_Error    error;
+    FTC_Scaler  scaler = &family->attrs.scaler;
+    FT_Face     face;
+    FT_Size     size;
+
+
+    /* we will now load the glyph image */
+    error = FTC_Manager_LookupSize( cache->manager,
+                                    scaler,
+                                    &size );
+    if ( !error )
+    {
+      face = size->face;
+
+      error = FT_Load_Glyph( face, gindex, family->attrs.load_flags );
+      if ( !error )
+      {
+        if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP  ||
+             face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )
+        {
+          /* ok, copy it */
+          FT_Glyph  glyph;
+
+
+          error = FT_Get_Glyph( face->glyph, &glyph );
+          if ( !error )
+          {
+            *aglyph = glyph;
+            goto Exit;
+          }
+        }
+        else
+          error = FTC_Err_Invalid_Argument;
+      }
+    }
+
+  Exit:
+    return error;
+  }
+
+
+  FT_CALLBACK_DEF( FT_Bool )
+  ftc_basic_gnode_compare_faceid( FTC_GNode   gnode,
+                                  FTC_FaceID  face_id,
+                                  FTC_Cache   cache )
+  {
+    FTC_BasicFamily  family = (FTC_BasicFamily)gnode->family;
+    FT_Bool          result;
+
+
+    result = FT_BOOL( family->attrs.scaler.face_id == face_id );
+    if ( result )
+    {
+      /* we must call this function to avoid this node from appearing
+       * in later lookups with the same face_id!
+       */
+      FTC_GNode_UnselectFamily( gnode, cache );
+    }
+    return result;
+  }
+
+
+ /*
+  *
+  * basic image cache
+  *
+  */
+
+  FT_CALLBACK_TABLE_DEF
+  const FTC_IFamilyClassRec  ftc_basic_image_family_class =
+  {
+    {
+      sizeof( FTC_BasicFamilyRec ),
+      (FTC_MruNode_CompareFunc)ftc_basic_family_compare,
+      (FTC_MruNode_InitFunc)   ftc_basic_family_init,
+      (FTC_MruNode_ResetFunc)  NULL,
+      (FTC_MruNode_DoneFunc)   NULL
+    },
+    (FTC_IFamily_LoadGlyphFunc)ftc_basic_family_load_glyph
+  };
+
+
+  FT_CALLBACK_TABLE_DEF
+  const FTC_GCacheClassRec  ftc_basic_image_cache_class =
+  {
+    {
+      (FTC_Node_NewFunc)    ftc_inode_new,
+      (FTC_Node_WeightFunc) ftc_inode_weight,
+      (FTC_Node_CompareFunc)ftc_gnode_compare,
+      (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid,
+      (FTC_Node_FreeFunc)   ftc_inode_free,
+
+      sizeof( FTC_GCacheRec ),
+      (FTC_Cache_InitFunc)  ftc_gcache_init,
+      (FTC_Cache_DoneFunc)  ftc_gcache_done
+    },
+    (FTC_MruListClass)&ftc_basic_image_family_class
+  };
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_ImageCache_New( FTC_Manager      manager,
+                      FTC_ImageCache  *acache )
+  {
+    return FTC_GCache_New( manager, &ftc_basic_image_cache_class,
+                           (FTC_GCache*)acache );
+  }
+
+
+  /* documentation is in ftcimage.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_ImageCache_Lookup( FTC_ImageCache  cache,
+                         FTC_ImageType   type,
+                         FT_UInt         gindex,
+                         FT_Glyph       *aglyph,
+                         FTC_Node       *anode )
+  {
+    FTC_BasicQueryRec  query;
+    FTC_INode          node;
+    FT_Error           error;
+    FT_UInt32          hash;
+
+
+    /* some argument checks are delayed to FTC_Cache_Lookup */
+    if ( !aglyph )
+    {
+      error = FTC_Err_Invalid_Argument;
+      goto Exit;
+    }
+
+    *aglyph = NULL;
+    if ( anode )
+      *anode  = NULL;
+
+    query.attrs.scaler.face_id = type->face_id;
+    query.attrs.scaler.width   = type->width;
+    query.attrs.scaler.height  = type->height;
+    query.attrs.scaler.pixel   = 1;
+    query.attrs.load_flags     = type->flags;
+
+    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
+    query.attrs.scaler.y_res   = 0;
+
+    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
+
+#if 1  /* inlining is about 50% faster! */
+    FTC_GCACHE_LOOKUP_CMP( cache,
+                           ftc_basic_family_compare,
+                           FTC_GNode_Compare,
+                           hash, gindex,
+                           &query,
+                           node,
+                           error );
+#else
+    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
+                               hash, gindex,
+                               FTC_GQUERY( &query ),
+                               (FTC_Node*) &node );
+#endif
+    if ( !error )
+    {
+      *aglyph = FTC_INODE( node )->glyph;
+
+      if ( anode )
+      {
+        *anode = FTC_NODE( node );
+        FTC_NODE( node )->ref_count++;
+      }
+    }
+
+  Exit:
+    return error;
+  }
+
+
+ /*
+  *
+  * basic small bitmap cache
+  *
+  */
+
+
+  FT_CALLBACK_TABLE_DEF
+  const FTC_SFamilyClassRec  ftc_basic_sbit_family_class =
+  {
+    {
+      sizeof( FTC_BasicFamilyRec ),
+      (FTC_MruNode_CompareFunc)ftc_basic_family_compare,
+      (FTC_MruNode_InitFunc)   ftc_basic_family_init,
+      (FTC_MruNode_ResetFunc)  NULL,
+      (FTC_MruNode_DoneFunc)   NULL
+    },
+    (FTC_SFamily_GetCountFunc) ftc_basic_family_get_count,
+    (FTC_SFamily_LoadGlyphFunc)ftc_basic_family_load_bitmap
+  };
+
+
+  FT_CALLBACK_TABLE_DEF
+  const FTC_GCacheClassRec  ftc_basic_sbit_cache_class =
+  {
+    {
+      (FTC_Node_NewFunc)    ftc_snode_new,
+      (FTC_Node_WeightFunc) ftc_snode_weight,
+      (FTC_Node_CompareFunc)ftc_snode_compare,
+      (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid,
+      (FTC_Node_FreeFunc)   ftc_snode_free,
+
+      sizeof( FTC_GCacheRec ),
+      (FTC_Cache_InitFunc)  ftc_gcache_init,
+      (FTC_Cache_DoneFunc)  ftc_gcache_done
+    },
+    (FTC_MruListClass)&ftc_basic_sbit_family_class
+  };
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_SBitCache_New( FTC_Manager     manager,
+                     FTC_SBitCache  *acache )
+  {
+    return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class,
+                           (FTC_GCache*)acache );
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_SBitCache_Lookup( FTC_SBitCache  cache,
+                        FTC_ImageType  type,
+                        FT_UInt        gindex,
+                        FTC_SBit      *ansbit,
+                        FTC_Node      *anode )
+  {
+    FT_Error           error;
+    FTC_BasicQueryRec  query;
+    FTC_SNode          node;
+    FT_UInt32          hash;
+
+
+    if ( anode )
+      *anode = NULL;
+
+    /* other argument checks delayed to FTC_Cache_Lookup */
+    if ( !ansbit )
+      return FTC_Err_Invalid_Argument;
+
+    *ansbit = NULL;
+
+    query.attrs.scaler.face_id = type->face_id;
+    query.attrs.scaler.width   = type->width;
+    query.attrs.scaler.height  = type->height;
+    query.attrs.scaler.pixel   = 1;
+    query.attrs.load_flags     = type->flags;
+
+    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
+    query.attrs.scaler.y_res   = 0;
+
+    /* beware, the hash must be the same for all glyph ranges! */
+    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
+           gindex / FTC_SBIT_ITEMS_PER_NODE;
+
+#if 1  /* inlining is about 50% faster! */
+    FTC_GCACHE_LOOKUP_CMP( cache,
+                           ftc_basic_family_compare,
+                           FTC_SNode_Compare,
+                           hash, gindex,
+                           &query,
+                           node,
+                           error );
+#else
+    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
+                               hash,
+                               gindex,
+                               FTC_GQUERY( &query ),
+                               (FTC_Node*)&node );
+#endif
+    if ( error )
+      goto Exit;
+
+    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
+
+    if ( anode )
+    {
+      *anode = FTC_NODE( node );
+      FTC_NODE( node )->ref_count++;
+    }
+
+  Exit:
+    return error;
+  }
+
+
+/* END */

reactos/lib/freetype/src/cache
ftccback.h added at 1.1
diff -N ftccback.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftccback.h	10 May 2004 17:48:31 -0000	1.1
@@ -0,0 +1,82 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftccback.h                                                             */
+/*                                                                         */
+/*    Callback functions of the caching sub-system (specification only).   */
+/*                                                                         */
+/*  Copyright 2004 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+#ifndef __FTCCBACK_H__
+#define __FTCCBACK_H__
+
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_INTERNAL_MRU_H
+#include FT_CACHE_INTERNAL_IMAGE_H
+#include FT_CACHE_INTERNAL_MANAGER_H
+#include FT_CACHE_INTERNAL_GLYPH_H
+#include FT_CACHE_INTERNAL_SBITS_H
+
+
+  FT_LOCAL( void )
+  ftc_inode_free( FTC_INode  inode,
+                  FTC_Cache  cache );
+
+  FT_LOCAL( FT_Error )
+  ftc_inode_new( FTC_INode   *pinode,
+                 FTC_GQuery   gquery,
+                 FTC_Cache    cache );
+
+  FT_LOCAL( FT_ULong )
+  ftc_inode_weight( FTC_INode  inode );
+
+
+  FT_LOCAL( void )
+  ftc_snode_free( FTC_SNode  snode,
+                  FTC_Cache  cache );
+
+  FT_LOCAL( FT_Error )
+  ftc_snode_new( FTC_SNode  *psnode,
+                 FTC_GQuery  gquery,
+                 FTC_Cache   cache );
+
+  FT_LOCAL( FT_ULong )
+  ftc_snode_weight( FTC_SNode  snode );
+
+  FT_LOCAL( FT_Bool )
+  ftc_snode_compare( FTC_SNode   snode,
+                     FTC_GQuery  gquery,
+                     FTC_Cache   cache );
+
+
+  FT_LOCAL( FT_Bool )
+  ftc_gnode_compare( FTC_GNode   gnode,
+                     FTC_GQuery  gquery );
+
+
+  FT_LOCAL( FT_Error )
+  ftc_gcache_init( FTC_GCache  cache );
+
+  FT_LOCAL( void )
+  ftc_gcache_done( FTC_GCache  cache );
+
+
+  FT_LOCAL( FT_Error )
+  ftc_cache_init( FTC_Cache  cache );
+
+  FT_LOCAL( void )
+  ftc_cache_done( FTC_Cache  cache );
+
+
+#endif /* __FTCCBACK_H__ */
+
+/* END */

reactos/lib/freetype/src/cache
ftcmru.c 1.2 -> 1.3
diff -N ftcmru.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftcmru.c	10 May 2004 17:48:31 -0000	1.3
@@ -0,0 +1,355 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftcmru.c                                                               */
+/*                                                                         */
+/*    FreeType MRU support (body).                                         */
+/*                                                                         */
+/*  Copyright 2003, 2004 by                                                */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_INTERNAL_MRU_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
+
+#include "ftcerror.h"
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruNode_Prepend( FTC_MruNode  *plist,
+                       FTC_MruNode   node )
+  {
+    FTC_MruNode  first = *plist;
+
+
+    if ( first )
+    {
+      FTC_MruNode  last = first->prev;
+
+
+#ifdef FT_DEBUG_ERROR
+      {
+        FTC_MruNode  cnode = first;
+
+
+        do
+        {
+          if ( cnode == node )
+          {
+            fprintf( stderr, "FTC_MruNode_Prepend: invalid action!\n" );
+            exit( 2 );
+          }
+          cnode = cnode->next;
+
+        } while ( cnode != first );
+      }
+#endif
+
+      first->prev = node;
+      last->next  = node;
+      node->next  = first;
+      node->prev  = last;
+    }
+    else
+    {
+      node->next = node;
+      node->prev = node;
+    }
+    *plist = node;
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruNode_Up( FTC_MruNode  *plist,
+                  FTC_MruNode   node )
+  {
+    FTC_MruNode  first = *plist;
+
+
+    FT_ASSERT( first != NULL );
+
+    if ( first != node )
+    {
+      FTC_MruNode  prev, next, last;
+
+
+#ifdef FT_DEBUG_ERROR
+      {
+        FTC_MruNode  cnode = first;
+        do
+        {
+          if ( cnode == node )
+            goto Ok;
+          cnode = cnode->next;
+
+        } while ( cnode != first );
+
+        fprintf( stderr, "FTC_MruNode_Up: invalid action!\n" );
+        exit( 2 );
+      Ok:
+      }
+#endif
+      prev = node->prev;
+      next = node->next;
+
+      prev->next = next;
+      next->prev = prev;
+
+      last = first->prev;
+
+      last->next  = node;
+      first->prev = node;
+
+      node->next = first;
+      node->prev = last;
+
+      *plist = node;
+    }
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruNode_Remove( FTC_MruNode  *plist,
+                      FTC_MruNode   node )
+  {
+    FTC_MruNode  first = *plist;
+    FTC_MruNode  prev, next;
+
+
+    FT_ASSERT( first != NULL );
+
+#ifdef FT_DEBUG_ERROR
+      {
+        FTC_MruNode  cnode = first;
+
+
+        do
+        {
+          if ( cnode == node )
+            goto Ok;
+          cnode = cnode->next;
+
+        } while ( cnode != first );
+
+        fprintf( stderr, "FTC_MruNode_Remove: invalid action!\n" );
+        exit( 2 );
+      Ok:
+      }
+#endif
+
+    prev = node->prev;
+    next = node->next;
+
+    prev->next = next;
+    next->prev = prev;
+
+    if ( node == next )
+    {
+      FT_ASSERT( first == node );
+      FT_ASSERT( prev  == node );
+
+      *plist = NULL;
+    }
+    else if ( node == first )
+        *plist = next;
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruList_Init( FTC_MruList       list,
+                    FTC_MruListClass  clazz,
+                    FT_UInt           max_nodes,
+                    FT_Pointer        data,
+                    FT_Memory         memory )
+  {
+    list->num_nodes = 0;
+    list->max_nodes = max_nodes;
+    list->nodes     = NULL;
+    list->clazz     = *clazz;
+    list->data      = data;
+    list->memory    = memory;
+  }
+
+
+  FT_EXPORT( void )
+  FTC_MruList_Reset( FTC_MruList  list )
+  {
+    while ( list->nodes )
+      FTC_MruList_Remove( list, list->nodes );
+
+    FT_ASSERT( list->num_nodes == 0 );
+  }
+
+
+  FT_EXPORT( void )
+  FTC_MruList_Done( FTC_MruList  list )
+  {
+    FTC_MruList_Reset( list );
+  }
+
+
+  FT_EXPORT_DEF( FTC_MruNode )
+  FTC_MruList_Find( FTC_MruList  list,
+                    FT_Pointer   key )
+  {
+    FTC_MruNode_CompareFunc  compare = list->clazz.node_compare;
+    FTC_MruNode              first, node;
+
+
+    first = list->nodes;
+    node  = NULL;
+
+    if ( first )
+    {
+      node = first;
+      do
+      {
+        if ( compare( node, key ) )
+        {
+          if ( node != first )
+            FTC_MruNode_Up( &list->nodes, node );
+
+          return node;
+        }
+
+        node = node->next;
+
+      } while ( node != first);
+    }
+
+    return NULL;
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_MruList_New( FTC_MruList   list,
+                   FT_Pointer    key,
+                   FTC_MruNode  *anode )
+  {
+    FT_Error     error;
+    FTC_MruNode  node;
+    FT_Memory    memory = list->memory;
+
+
+    if ( list->num_nodes >= list->max_nodes && list->max_nodes > 0 )
+    {
+      node = list->nodes->prev;
+
+      FT_ASSERT( node );
+
+      if ( list->clazz.node_reset )
+      {
+        FTC_MruNode_Up( &list->nodes, node );
+
+        error = list->clazz.node_reset( node, key, list->data );
+        if ( !error )
+          goto Exit;
+      }
+
+      FTC_MruNode_Remove( &list->nodes, node );
+      list->num_nodes--;
+
+      if ( list->clazz.node_done )
+        list->clazz.node_done( node, list->data );
+    }
+    else if ( FT_ALLOC( node, list->clazz.node_size ) )
+        goto Exit;
+
+    error = list->clazz.node_init( node, key, list->data );
+    if ( error )
+      goto Fail;
+
+      FTC_MruNode_Prepend( &list->nodes, node );
+      list->num_nodes++;
+
+  Exit:
+    *anode = node;
+    return error;
+
+  Fail:
+    if ( list->clazz.node_done )
+      list->clazz.node_done( node, list->data );
+
+    FT_FREE( node );
+    goto Exit;
+  }
+
+
+  FT_EXPORT( FT_Error )
+  FTC_MruList_Lookup( FTC_MruList   list,
+                      FT_Pointer    key,
+                      FTC_MruNode  *anode )
+  {
+    FTC_MruNode  node;
+
+
+    node = FTC_MruList_Find( list, key );
+    if ( node == NULL )
+      return FTC_MruList_New( list, key, anode );
+
+    *anode = node;
+    return 0;
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruList_Remove( FTC_MruList  list,
+                      FTC_MruNode  node )
+  {
+    FTC_MruNode_Remove( &list->nodes, node );
+    list->num_nodes--;
+
+    {
+      FT_Memory  memory = list->memory;
+
+
+      if ( list->clazz.node_done )
+       list->clazz.node_done( node, list->data );
+
+      FT_FREE( node );
+    }
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_MruList_RemoveSelection( FTC_MruList              list,
+                               FTC_MruNode_CompareFunc  selection,
+                               FT_Pointer               key )
+  {
+    FTC_MruNode  first, node, next;
+
+
+    first = list->nodes;
+    while ( first && ( selection == NULL || selection( first, key ) ) )
+    {
+      FTC_MruList_Remove( list, first );
+      first = list->nodes;
+    }
+
+    if ( first )
+    {
+      node = first->next;
+      while ( node != first )
+      {
+        next = node->next;
+
+        if ( selection( node, key ) )
+          FTC_MruList_Remove( list, node );
+
+        node = next;
+      }
+    }
+  }
+
+
+/* END */

reactos/lib/freetype/src/cache
Jamfile 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Jamfile	15 Feb 2004 21:45:33 -0000	1.3
+++ Jamfile	10 May 2004 17:48:31 -0000	1.4
@@ -1,4 +1,4 @@
-# FreeType 2 src/cache Jamfile (c) 2001 David Turner
+# FreeType 2 src/cache Jamfile (c) 2001, 2003, 2004 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) cache ;
@@ -14,7 +14,15 @@
 
   if $(FT2_MULTI)
   {
-    _sources = ftlru ftcmanag ftccache ftcglyph ftcsbits ftcimage ftccmap ;
+    _sources = ftcmru
+               ftcmanag
+               ftccache
+               ftcglyph
+               ftcsbits
+               ftcimage
+               ftcbasic
+               ftccmap
+               ;
   }
   else
   {

reactos/lib/freetype/src/cache
descrip.mms 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- descrip.mms	15 Feb 2004 21:45:33 -0000	1.3
+++ descrip.mms	10 May 2004 17:48:31 -0000	1.4
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001, 2002 by
+# Copyright 2001, 2002, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -20,7 +20,6 @@
 all : $(OBJS)
         library [--.lib]freetype.olb $(OBJS)
 
-ftcache.obj : ftcache.c ftlru.c ftcmanag.c ftccache.c ftcglyph.c ftcimage.c \
-              ftcsbits.c ftccmap.c 
+ftcache.obj : ftcache.c
 
 # EOF

reactos/lib/freetype/src/cache
ftcache.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcache.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftcache.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType Caching sub-system (body only).                         */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2003 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,13 +19,13 @@
 #define FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include <ft2build.h>
-#include "ftlru.c"
+#include "ftcmru.c"
 #include "ftcmanag.c"
 #include "ftccache.c"
+#include "ftccmap.c"
 #include "ftcglyph.c"
 #include "ftcimage.c"
 #include "ftcsbits.c"
-#include "ftccmap.c"
-
+#include "ftcbasic.c"
 
 /* END */

reactos/lib/freetype/src/cache
ftccache.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftccache.c	15 Feb 2004 21:45:33 -0000	1.5
+++ ftccache.c	10 May 2004 17:48:31 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType internal cache interface (body).                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,10 +17,11 @@
 
 
 #include <ft2build.h>
-#include FT_CACHE_MANAGER_H
+#include FT_CACHE_INTERNAL_MANAGER_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 
+#include "ftccback.h"
 #include "ftcerror.h"
 
 
@@ -40,208 +41,194 @@
   /*************************************************************************/
   /*************************************************************************/
 
-  FT_EXPORT_DEF( void )
-  ftc_node_done( FTC_Node   node,
-                 FTC_Cache  cache )
+  /* add a new node to the head of the manager's circular MRU list */
+  static void
+  ftc_node_mru_link( FTC_Node     node,
+                     FTC_Manager  manager )
   {
-    FTC_Family       family;
-    FTC_FamilyEntry  entry;
-
+    FTC_MruNode_Prepend( (FTC_MruNode*)&manager->nodes_list,
+                         (FTC_MruNode)node );
+    manager->num_nodes++;
+  }
 
-    entry  = cache->manager->families.entries + node->fam_index;
-    family = entry->family;
 
-    /* remove from parent set table - eventually destroy the set */
-    if ( --family->num_nodes == 0 )
-      FT_LruList_Remove( cache->families, (FT_LruNode) family );
+  /* remove a node from the manager's MRU list */
+  static void
+  ftc_node_mru_unlink( FTC_Node     node,
+                       FTC_Manager  manager )
+  {
+    FTC_MruNode_Remove( (FTC_MruNode*)&manager->nodes_list,
+                        (FTC_MruNode)node );
+    manager->num_nodes--;
   }
 
 
-  /* add a new node to the head of the manager's circular MRU list */
+  /* move a node to the head of the manager's MRU list */
   static void
-  ftc_node_mru_link( FTC_Node     node,
-                     FTC_Manager  manager )
+  ftc_node_mru_up( FTC_Node     node,
+                   FTC_Manager  manager )
   {
-    FTC_Node  first = manager->nodes_list;
+    FTC_MruNode_Up( (FTC_MruNode*)&manager->nodes_list,
+                    (FTC_MruNode)node );
+  }
 
 
-    if ( first )
+  /* Note that this function cannot fail.  If we cannot re-size the
+   * buckets array appropriately, we simply degrade the hash table's
+   * performance!
+   */
+  static void
+  ftc_cache_resize( FTC_Cache  cache )
+  {
+    for (;;)
     {
-      FTC_Node  last = first->mru_prev;
+      FTC_Node  node, *pnode;
+      FT_UInt   p      = cache->p;
+      FT_UInt   mask   = cache->mask;
+      FT_UInt   count  = mask + p + 1;    /* number of buckets */
 
 
-      FT_ASSERT( last->mru_next == first );
+      /* do we need to shrink the buckets array? */
+      if ( cache->slack < 0 )
+      {
+        FTC_Node  new_list = NULL;
 
-      node->mru_prev = last;
-      node->mru_next = first;
 
-      last->mru_next  = node;
-      first->mru_prev = node;
-    }
-    else
-    {
-      FT_ASSERT( manager->num_nodes == 0 );
+        /* try to expand the buckets array _before_ splitting
+         * the bucket lists
+         */
+        if ( p >= mask )
+        {
+          FT_Memory  memory = cache->memory;
 
-      node->mru_next = node;
-      node->mru_prev = node;
-    }
 
-    manager->nodes_list = node;
-    manager->num_nodes++;
-  }
+          /* if we can't expand the array, leave immediately */
+          if ( FT_MEM_RENEW_ARRAY( cache->buckets, (mask+1)*2, (mask+1)*4 ) )
+            break;
+        }
 
+        /* split a single bucket */
+        pnode = cache->buckets + p;
 
-  /* remove a node from the manager's MRU list */
-  static void
-  ftc_node_mru_unlink( FTC_Node     node,
-                       FTC_Manager  manager )
-  {
-    FTC_Node  first = manager->nodes_list;
-    FTC_Node  prev  = node->mru_prev;
-    FTC_Node  next  = node->mru_next;
+        for (;;)
+        {
+          node = *pnode;
+          if ( node == NULL )
+            break;
 
+          if ( node->hash & ( mask + 1 ) )
+          {
+            *pnode     = node->link;
+            node->link = new_list;
+            new_list   = node;
+          }
+          else
+            pnode = &node->link;
+        }
 
-    FT_ASSERT( first != NULL && manager->num_nodes > 0 );
-    FT_ASSERT( next->mru_prev == node );
-    FT_ASSERT( prev->mru_next == node );
+        cache->buckets[p + mask + 1] = new_list;
 
-    next->mru_prev = prev;
-    prev->mru_next = next;
+        cache->slack += FTC_HASH_MAX_LOAD;
 
-    if ( node == first )
-    {
-      /* this is the last node in the list; update its head pointer */
-      if ( node == next )
-        manager->nodes_list = NULL;
-      else
-        manager->nodes_list = next;
-    }
+        if ( p >= mask )
+        {
+          cache->mask = 2 * mask + 1;
+          cache->p    = 0;
+        }
+        else
+          cache->p = p + 1;
+      }
 
-    node->mru_next = NULL;
-    node->mru_prev = NULL;
-    manager->num_nodes--;
-  }
+      /* do we need to expand the buckets array? */
+      else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )
+      {
+        FT_UInt    old_index = p + mask;
+        FTC_Node*  pold;
 
 
-  /* move a node to the head of the manager's MRU list */
-  static void
-  ftc_node_mru_up( FTC_Node     node,
-                   FTC_Manager  manager )
-  {
-    FTC_Node  first = manager->nodes_list;
+        if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )
+          break;
 
+        if ( p == 0 )
+        {
+          FT_Memory  memory = cache->memory;
 
-    if ( node != first )
-    {
-      FTC_Node  prev = node->mru_prev;
-      FTC_Node  next = node->mru_next;
-      FTC_Node  last;
 
+          /* if we can't shrink the array, leave immediately */
+          if ( FT_MEM_RENEW_ARRAY( cache->buckets,
+                                   ( mask + 1 ) * 2, mask + 1 ) )
+            break;
 
-      prev->mru_next = next;
-      next->mru_prev = prev;
+          cache->mask >>= 1;
+          p             = cache->mask;
+        }
+        else
+          p--;
 
-      last            = first->mru_prev;
-      node->mru_next  = first;
-      node->mru_prev  = last;
-      first->mru_prev = node;
-      last->mru_next  = node;
+        pnode = cache->buckets + p;
+        while ( *pnode )
+          pnode = &(*pnode)->link;
+
+        pold   = cache->buckets + old_index;
+        *pnode = *pold;
+        *pold  = NULL;
 
-      manager->nodes_list = node;
+        cache->slack -= FTC_HASH_MAX_LOAD;
+        cache->p      = p;
+      }
+      else /* the hash table is balanced */
+        break;
     }
   }
 
 
   /* remove a node from its cache's hash table */
-  static FT_Error
-  ftc_node_hash_unlink( FTC_Node   node,
+  static void
+  ftc_node_hash_unlink( FTC_Node   node0,
                         FTC_Cache  cache )
   {
-    FT_Error   error = 0;
     FTC_Node  *pnode;
-    FT_UInt    idx, num_buckets;
+    FT_UInt    idx;
 
 
-    idx = (FT_UInt)( node->hash & cache->mask );
+    idx = (FT_UInt)( node0->hash & cache->mask );
     if ( idx < cache->p )
-      idx = (FT_UInt)( node->hash & ( 2 * cache->mask + 1 ) );
+      idx = (FT_UInt)( node0->hash & ( 2 * cache->mask + 1 ) );
 
     pnode = cache->buckets + idx;
 
     for (;;)
     {
-      if ( *pnode == NULL )
+      FTC_Node  node = *pnode;
+
+
+      if ( node == NULL )
       {
         FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
-        return FTC_Err_Ok;
+        return;
       }
 
-      if ( *pnode == node )
-      {
-        *pnode     = node->link;
-        node->link = NULL;
+      if ( node == node0 )
         break;
-      }
 
       pnode = &(*pnode)->link;
     }
 
-    num_buckets = ( cache->p + cache->mask + 1 );
-
-    if ( ++cache->slack > (FT_Long)num_buckets * FTC_HASH_SUB_LOAD )
-    {
-      FT_UInt    p         = cache->p;
-      FT_UInt    mask      = cache->mask;
-      FT_UInt    old_index = p + mask;
-      FTC_Node*  pold;
-
-
-      if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )
-        goto Exit;
-
-      if ( p == 0 )
-      {
-        FT_Memory  memory = cache->memory;
-
-
-        cache->mask >>= 1;
-        p             = cache->mask;
-
-        if ( FT_RENEW_ARRAY( cache->buckets, ( mask + 1 ) * 2, (mask+1) ) )
-        {
-          FT_ERROR(( "ftc_node_hash_unlink: couldn't shunk buckets!\n" ));
-          goto Exit;
-        }
-      }
-      else
-        p--;
-
-      pnode = cache->buckets + p;
-      while ( *pnode )
-        pnode = &(*pnode)->link;
-
-      pold   = cache->buckets + old_index;
-      *pnode = *pold;
-      *pold  = NULL;
-
-      cache->slack -= FTC_HASH_MAX_LOAD;
-      cache->p      = p;
-    }
+    *pnode      = node0->link;
+    node0->link = NULL;
 
-  Exit:
-    return error;
+    cache->slack++;
+    ftc_cache_resize( cache );
   }
 
 
-
-  /* add a node to the "top" of its cache's hash table */
-  static FT_Error
+  /* add a node to the `top' of its cache's hash table */
+  static void
   ftc_node_hash_link( FTC_Node   node,
                       FTC_Cache  cache )
   {
     FTC_Node  *pnode;
     FT_UInt    idx;
-    FT_Error   error = 0;
 
 
     idx = (FT_UInt)( node->hash & cache->mask );
@@ -253,85 +240,29 @@
     node->link = *pnode;
     *pnode     = node;
 
-    if ( --cache->slack < 0 )
-    {
-      FT_UInt    p     = cache->p;
-      FT_UInt    mask  = cache->mask;
-      FTC_Node   new_list;
-
-
-      /* split a single bucket */
-      new_list = NULL;
-      pnode    = cache->buckets + p;
-
-      for (;;)
-      {
-        node = *pnode;
-        if ( node == NULL )
-          break;
-
-        if ( node->hash & ( mask + 1 ) )
-        {
-          *pnode     = node->link;
-          node->link = new_list;
-          new_list   = node;
-        }
-        else
-          pnode = &node->link;
-      }
-
-      cache->buckets[p + mask + 1] = new_list;
-
-      cache->slack += FTC_HASH_MAX_LOAD;
-
-      if ( p >= mask )
-      {
-        FT_Memory  memory = cache->memory;
-
-
-        if ( FT_RENEW_ARRAY( cache->buckets,
-                             ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) )
-        {
-          FT_ERROR(( "ftc_node_hash_link: couldn't expand buckets!\n" ));
-          goto Exit;
-        }
-
-        cache->mask = 2 * mask + 1;
-        cache->p    = 0;
-      }
-      else
-        cache->p = p + 1;
-    }
-
-  Exit:
-    return error;
+    cache->slack--;
+    ftc_cache_resize( cache );
   }
 
 
-
-
   /* remove a node from the cache manager */
   FT_EXPORT_DEF( void )
   ftc_node_destroy( FTC_Node     node,
                     FTC_Manager  manager )
   {
-    FT_Memory        memory  = manager->library->memory;
-    FTC_Cache        cache;
-    FTC_FamilyEntry  entry;
-    FTC_Cache_Class  clazz;
+    FTC_Cache  cache;
 
 
 #ifdef FT_DEBUG_ERROR
     /* find node's cache */
-    if ( node->fam_index >= manager->families.count )
+    if ( node->cache_index >= manager->num_caches )
     {
       FT_ERROR(( "ftc_node_destroy: invalid node handle\n" ));
       return;
     }
 #endif
 
-    entry = manager->families.entries + node->fam_index;
-    cache = entry->cache;
+    cache = manager->caches[node->cache_index];
 
 #ifdef FT_DEBUG_ERROR
     if ( cache == NULL )
@@ -341,9 +272,7 @@
     }
 #endif
 
-    clazz = cache->clazz;
-
-    manager->cur_weight -= clazz->node_weight( node, cache );
+    manager->cur_weight -= cache->clazz.node_weight( node, cache );
 
     /* remove node from mru list */
     ftc_node_mru_unlink( node, manager );
@@ -352,10 +281,7 @@
     ftc_node_hash_unlink( node, cache );
 
     /* now finalize it */
-    if ( clazz->node_done )
-      clazz->node_done( node, cache );
-
-    FT_FREE( node );
+    cache->clazz.node_free( node, cache );
 
 #if 0
     /* check, just in case of general corruption :-) */
@@ -369,120 +295,42 @@
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
-  /*****                   CACHE FAMILY DEFINITIONS                    *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  FT_EXPORT_DEF( FT_Error )
-  ftc_family_init( FTC_Family  family,
-                   FTC_Query   query,
-                   FTC_Cache   cache )
-  {
-    FT_Error         error;
-    FTC_Manager      manager = cache->manager;
-    FT_Memory        memory  = manager->library->memory;
-    FTC_FamilyEntry  entry;
-
-
-    family->cache     = cache;
-    family->num_nodes = 0;
-
-    /* now add to manager's family table */
-    error = ftc_family_table_alloc( &manager->families, memory, &entry );
-    if ( !error )
-    {
-      entry->cache      = cache;
-      entry->family     = family;
-      family->fam_index = entry->index;
-
-      query->family = family;   /* save family in query */
-    }
-
-    return error;
-  }
-
-
-  FT_EXPORT_DEF( void )
-  ftc_family_done( FTC_Family  family )
-  {
-    if ( family && family->cache )
-    {
-      FTC_Manager  manager = family->cache->manager;
-
-
-      /* remove from manager's family table */
-      ftc_family_table_free( &manager->families, family->fam_index );
-    }
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
   /*****                    ABSTRACT CACHE CLASS                       *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
 
-
   FT_EXPORT_DEF( FT_Error )
-  ftc_cache_init( FTC_Cache  cache )
+  FTC_Cache_Init( FTC_Cache  cache )
   {
-    FT_Memory        memory = cache->memory;
-    FTC_Cache_Class  clazz  = cache->clazz;
-    FT_Error         error;
+    FT_Memory  memory = cache->memory;
 
 
     cache->p     = 0;
     cache->mask  = FTC_HASH_INITIAL_SIZE - 1;
     cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD;
 
-    if ( FT_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 ) )
-      goto Exit;
-
-    /* now, initialize the lru list of families for this cache */
-    if ( clazz->family_size > 0 )
-    {
-      FT_LruList_ClassRec*  lru_class = &cache->family_class;
-
+    return ( FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 ) );
+  }
 
-      lru_class->list_size = sizeof( FT_LruListRec );
-      lru_class->list_init = NULL;
-      lru_class->list_done = NULL;
-
-      lru_class->node_size    = clazz->family_size;
-      lru_class->node_init    = (FT_LruNode_InitFunc)   clazz->family_init;
-      lru_class->node_done    = (FT_LruNode_DoneFunc)   clazz->family_done;
-      lru_class->node_flush   = (FT_LruNode_FlushFunc)  NULL;
-      lru_class->node_compare = (FT_LruNode_CompareFunc)clazz->family_compare;
-
-      error = FT_LruList_New( (FT_LruList_Class) lru_class,
-                              0,    /* max items == 0 => unbounded list */
-                              cache,
-                              memory,
-                              &cache->families );
-      if ( error )
-        FT_FREE( cache->buckets );
-    }
 
-  Exit:
-    return error;
+  FT_LOCAL_DEF( FT_Error )
+  ftc_cache_init( FTC_Cache  cache )
+  {
+    return FTC_Cache_Init( cache );
   }
 
 
   FT_EXPORT_DEF( void )
-  ftc_cache_clear( FTC_Cache  cache )
+  FTC_Cache_Clear( FTC_Cache  cache )
   {
     if ( cache )
     {
-      FT_Memory        memory  = cache->memory;
-      FTC_Cache_Class  clazz   = cache->clazz;
-      FTC_Manager      manager = cache->manager;
-      FT_UFast         i;
-      FT_UInt          count;
+      FTC_Manager  manager = cache->manager;
+      FT_UFast     i;
+      FT_UInt      count;
+
 
       count = cache->p + cache->mask + 1;
 
@@ -500,309 +348,256 @@
           ftc_node_mru_unlink( node, manager );
 
           /* now finalize it */
-          manager->cur_weight -= clazz->node_weight( node, cache );
-
-          if ( clazz->node_done )
-            clazz->node_done( node, cache );
+          manager->cur_weight -= cache->clazz.node_weight( node, cache );
 
-          FT_FREE( node );
+          cache->clazz.node_free( node, cache );
           node = next;
         }
         cache->buckets[i] = NULL;
       }
-
-      cache->p = 0;
-
-      /* destroy the families */
-      if ( cache->families )
-        FT_LruList_Reset( cache->families );
+      ftc_cache_resize( cache );
     }
   }
 
 
   FT_EXPORT_DEF( void )
-  ftc_cache_done( FTC_Cache  cache )
+  FTC_Cache_Done( FTC_Cache  cache )
   {
-    if ( cache )
+    if ( cache->memory )
     {
       FT_Memory  memory = cache->memory;
 
 
-      ftc_cache_clear( cache );
+      FTC_Cache_Clear( cache );
 
       FT_FREE( cache->buckets );
       cache->mask  = 0;
+      cache->p     = 0;
       cache->slack = 0;
 
-      if ( cache->families )
-      {
-        FT_LruList_Destroy( cache->families );
-        cache->families = NULL;
-      }
+      cache->memory = NULL;
     }
   }
 
 
-  /* Look up a node in "top" of its cache's hash table. */
-  /* If not found, create a new node.                   */
-  /*                                                    */
-  FT_EXPORT_DEF( FT_Error )
-  ftc_cache_lookup( FTC_Cache   cache,
-                    FTC_Query   query,
-                    FTC_Node   *anode )
+  FT_LOCAL_DEF( void )
+  ftc_cache_done( FTC_Cache  cache )
   {
-    FT_Error     error = FTC_Err_Ok;
-    FTC_Manager  manager;
-    FT_LruNode   lru;
-    FT_UInt      free_count = 0;
-
-
-    if ( !cache || !query || !anode )
-      return FTC_Err_Invalid_Argument;
-
-    *anode = NULL;
-
-    query->hash   = 0;
-    query->family = NULL;
-
-    manager = cache->manager;
-
-   /*  here's a small note explaining what's happening in the code below.
-    *
-    *  We need to deal intelligently with out-of-memory (OOM) conditions
-    *  when trying to create a new family or cache node during the lookup.
-    *
-    *  When an OOM is detected, we try to free one or more "old" nodes
-    *  from the cache, then try again.  It may be necessary to do that
-    *  several times, so a loop is needed.
-    *
-    *  The local variable "free_count" holds the number of "old" nodes to
-    *  discard on each attempt.  It starts at 1 and doubles on each
-    *  iteration.  The loop stops when:
-    *
-    *   - a non-OOM error is detected
-    *   - a succesful lookup is performed
-    *   - there are no more unused nodes in the cache
-    *
-    *  For the record, remember that all used nodes appear _before_
-    *  unused ones in the manager's MRU node list.
-    */
+    FTC_Cache_Done( cache );
+  }
 
-    for (;;)
-    {
-      {
-        /* first of all, find the relevant family */
-        FT_LruList              list    = cache->families;
-        FT_LruNode              fam, *pfam;
-        FT_LruNode_CompareFunc  compare = list->clazz->node_compare;
 
-        pfam = &list->nodes;
-        for (;;)
-        {
-          fam = *pfam;
-          if ( fam == NULL )
-          {
-            error = FT_LruList_Lookup( list, query, &lru );
-            if ( error )
-              goto Fail;
+  static void
+  ftc_cache_add( FTC_Cache  cache,
+                 FT_UInt32  hash,
+                 FTC_Node   node )
+  {
+    node->hash = hash;
+    node->cache_index = (FT_UInt16) cache->index;
+    node->ref_count   = 0;
 
-            goto Skip;
-          }
+    ftc_node_hash_link( node, cache );
+    ftc_node_mru_link( node, cache->manager );
 
-          if ( compare( fam, query, list->data ) )
-            break;
+    {
+      FTC_Manager  manager = cache->manager;
 
-          pfam = &fam->next;
-        }
 
-        FT_ASSERT( fam != NULL );
+      manager->cur_weight += cache->clazz.node_weight( node, cache );
 
-        /* move to top of list when needed */
-        if ( fam != list->nodes )
-        {
-          *pfam       = fam->next;
-          fam->next   = list->nodes;
-          list->nodes = fam;
-        }
+      if ( manager->cur_weight >= manager->max_weight )
+      {
+        node->ref_count++;
+        FTC_Manager_Compress( manager );
+        node->ref_count--;
+      }
+    }
+  }
 
-        lru = fam;
 
-      Skip:
-        ;
-      }
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Cache_NewNode( FTC_Cache   cache,
+                     FT_UInt32   hash,
+                     FT_Pointer  query,
+                     FTC_Node   *anode )
+  {
+    FT_Error  error;
+    FTC_Node  node;
+
+    /*
+     *  Try to allocate a new cache node.  Note that in case of
+     *  out-of-memory error (OOM), we'll flush the cache a bit,
+     *  then try again.
+     *
+     *  On each try, the `tries' variable gives the number
+     *  of old nodes we want to flush from the manager's global list
+     *  before the next allocation attempt.  It barely doubles on
+     *  each iteration.
+     *
+     */
+    error = cache->clazz.node_new( &node, query, cache );
+    if ( error )
+      goto FlushCache;
+
+  AddNode:
+    /* don't assume that the cache has the same number of buckets, since
+     * our allocation request might have triggered global cache flushing
+     */
+    ftc_cache_add( cache, hash, node );
 
-      {
-        FTC_Family   family  = (FTC_Family) lru;
-        FT_UFast     hash    = query->hash;
-        FTC_Node*    bucket;
-        FT_UInt      idx;
+  Exit:
+    *anode = node;
+    return error;
 
+  FlushCache:
+    node = NULL;
+    if ( error != FT_Err_Out_Of_Memory )
+      goto Exit;
 
-        idx = hash & cache->mask;
-        if ( idx < cache->p )
-          idx = hash & ( cache->mask * 2 + 1 );
+    {
+      FTC_Manager  manager = cache->manager;
+      FT_UInt      count, tries = 1;
 
-        bucket  = cache->buckets + idx;
 
+      for (;;)
+      {
+        error = cache->clazz.node_new( &node, query, cache );
+        if ( !error )
+          break;
 
-        if ( query->family     != family                 ||
-             family->fam_index >= manager->families.size )
-        {
-          FT_ERROR((
-            "ftc_cache_lookup: invalid query (bad 'family' field)\n" ));
-          error = FTC_Err_Invalid_Argument;
+        node = NULL;
+        if ( error != FT_Err_Out_Of_Memory )
           goto Exit;
-        }
-
-        if ( *bucket )
-        {
-          FTC_Node*             pnode   = bucket;
-          FTC_Node_CompareFunc  compare = cache->clazz->node_compare;
 
+        count = FTC_Manager_FlushN( manager, tries );
+        if ( count == 0 )
+          goto Exit;
 
-          for ( ;; )
-          {
-            FTC_Node  node;
+        if ( count == tries )
+        {
+          count = tries * 2;
+          if ( count < tries || count > manager->num_nodes )
+            count = manager->num_nodes;
+        }
+        tries = count;
+      }
+    }
+    goto AddNode;
+  }
 
 
-            node = *pnode;
-            if ( node == NULL )
-              break;
-
-            if ( node->hash == hash                            &&
-                 (FT_UInt)node->fam_index == family->fam_index &&
-                 compare( node, query, cache ) )
-            {
-              /* move to head of bucket list */
-              if ( pnode != bucket )
-              {
-                *pnode     = node->link;
-                node->link = *bucket;
-                *bucket    = node;
-              }
-
-              /* move to head of MRU list */
-              if ( node != manager->nodes_list )
-                ftc_node_mru_up( node, manager );
-
-              *anode = node;
-              goto Exit;
-            }
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Cache_Lookup( FTC_Cache   cache,
+                    FT_UInt32   hash,
+                    FT_Pointer  query,
+                    FTC_Node   *anode )
+  {
+    FT_UFast   idx;
+    FTC_Node*  bucket;
+    FTC_Node*  pnode;
+    FTC_Node   node;
+    FT_Error   error = 0;
 
-            pnode = &node->link;
-          }
-        }
+    FTC_Node_CompareFunc  compare = cache->clazz.node_compare;
 
-        /* didn't find a node, create a new one */
-        {
-          FTC_Cache_Class  clazz   = cache->clazz;
-          FT_Memory        memory  = cache->memory;
-          FTC_Node         node;
 
+    if ( cache == NULL || anode == NULL )
+      return FT_Err_Invalid_Argument;
 
-          if ( FT_ALLOC( node, clazz->node_size ) )
-            goto Fail;
+    idx = hash & cache->mask;
+    if ( idx < cache->p )
+      idx = hash & ( cache->mask * 2 + 1 );
 
-          node->fam_index = (FT_UShort) family->fam_index;
-          node->hash      = query->hash;
-          node->ref_count = 0;
+    bucket = cache->buckets + idx;
+    pnode  = bucket;
+    for (;;)
+    {
+      node = *pnode;
+      if ( node == NULL )
+        goto NewNode;
 
-          error = clazz->node_init( node, query, cache );
-          if ( error )
-          {
-            FT_FREE( node );
-            goto Fail;
-          }
+      if ( node->hash == hash && compare( node, query, cache ) )
+        break;
 
-          error = ftc_node_hash_link( node, cache );
-          if ( error )
-          {
-            clazz->node_done( node, cache );
-            FT_FREE( node );
-            goto Fail;
-          }
+      pnode = &node->link;
+    }
 
-          ftc_node_mru_link( node, cache->manager );
+    if ( node != *bucket )
+    {
+      *pnode     = node->link;
+      node->link = *bucket;
+      *bucket    = node;
+    }
 
-          cache->manager->cur_weight += clazz->node_weight( node, cache );
+    /* move to head of MRU list */
+    {
+      FTC_Manager  manager = cache->manager;
 
-          /* now try to compress the node pool when necessary */
-          if ( manager->cur_weight >= manager->max_weight )
-          {
-            node->ref_count++;
-            FTC_Manager_Compress( manager );
-            node->ref_count--;
-          }
 
-          *anode = node;
-        }
+      if ( node != manager->nodes_list )
+        ftc_node_mru_up( node, manager );
+    }
+    *anode = node;
+    return error;
 
-       /* all is well, exit now
-        */
-        goto Exit;
-      }
+  NewNode:
+    return FTC_Cache_NewNode( cache, hash, query, anode );
+  }
 
-    Fail:
-      if ( error != FTC_Err_Out_Of_Memory )
-        goto Exit;
-
-     /* There is not enough memory; try to release some unused nodes
-      * from the cache to make room for a new one.
-      */
-      {
-        FT_UInt  new_count;
 
+  FT_EXPORT_DEF( void )
+  FTC_Cache_RemoveFaceID( FTC_Cache   cache,
[truncated at 1000 lines; 90 more skipped]

reactos/lib/freetype/src/cache
ftccmap.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftccmap.c	15 Feb 2004 21:45:33 -0000	1.5
+++ ftccmap.c	10 May 2004 17:48:31 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,17 +19,18 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_CACHE_H
-#include FT_CACHE_CHARMAP_H
-#include FT_CACHE_MANAGER_H
+#include FT_CACHE_INTERNAL_MANAGER_H
 #include FT_INTERNAL_MEMORY_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_TRUETYPE_IDS_H
 
+#include "ftccback.h"
 #include "ftcerror.h"
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_cache
 
+
   /*************************************************************************/
   /*                                                                       */
   /* Each FTC_CMapNode contains a simple array to map a range of character */
@@ -47,56 +48,44 @@
   /* number of glyph indices / character code per node */
 #define FTC_CMAP_INDICES_MAX  128
 
+  /* compute a query/node hash */
+#define FTC_CMAP_HASH( faceid, index, charcode )           \
+          ( FTC_FACE_ID_HASH( faceid ) + 211 * ( index ) + \
+            ( (char_code) / FTC_CMAP_INDICES_MAX )       )
+
+  /* the charmap query */
+  typedef struct  FTC_CMapQueryRec_
+  {
+    FTC_FaceID  face_id;
+    FT_UInt     cmap_index;
+    FT_UInt32   char_code;
+
+  } FTC_CMapQueryRec, *FTC_CMapQuery;
 
+#define FTC_CMAP_QUERY( x )  ((FTC_CMapQuery)(x))
+#define FTC_CMAP_QUERY_HASH( x )                                         \
+          FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
+
+  /* the cmap cache node */
   typedef struct  FTC_CMapNodeRec_
   {
     FTC_NodeRec  node;
+    FTC_FaceID   face_id;
+    FT_UInt      cmap_index;
     FT_UInt32    first;                         /* first character in node */
     FT_UInt16    indices[FTC_CMAP_INDICES_MAX]; /* array of glyph indices  */
 
   } FTC_CMapNodeRec, *FTC_CMapNode;
 
-
 #define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )
-
-
-  /* compute node hash value from cmap family and "requested" glyph index */
-#define FTC_CMAP_HASH( cfam, cquery )                                       \
-          ( (cfam)->hash + ( (cquery)->char_code / FTC_CMAP_INDICES_MAX ) )
+#define FTC_CMAP_NODE_HASH( x )                                      \
+          FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
 
   /* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
   /* glyph indices haven't been queried through FT_Get_Glyph_Index() yet   */
 #define FTC_CMAP_UNKNOWN  ( (FT_UInt16)-1 )
 
 
-  /* the charmap query */
-  typedef struct  FTC_CMapQueryRec_
-  {
-    FTC_QueryRec  query;
-    FTC_CMapDesc  desc;
-    FT_UInt32     char_code;
-
-  } FTC_CMapQueryRec, *FTC_CMapQuery;
-
-
-#define FTC_CMAP_QUERY( x )  ( (FTC_CMapQuery)( x ) )
-
-
-  /* the charmap family */
-  typedef struct FTC_CMapFamilyRec_
-  {
-    FTC_FamilyRec    family;
-    FT_UInt32        hash;
-    FTC_CMapDescRec  desc;
-    FT_UInt          index;
-
-  } FTC_CMapFamilyRec, *FTC_CMapFamily;
-
-
-#define FTC_CMAP_FAMILY( x )         ( (FTC_CMapFamily)( x ) )
-#define FTC_CMAP_FAMILY_MEMORY( x )  FTC_FAMILY( x )->memory
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -106,27 +95,44 @@
   /*************************************************************************/
 
 
-  /* no need for specific finalizer; we use "ftc_node_done" directly */
+  /* no need for specific finalizer; we use `ftc_node_done' directly */
+
+  FT_CALLBACK_DEF( void )
+  ftc_cmap_node_free( FTC_CMapNode  node,
+                      FTC_Cache     cache )
+  {
+    FT_Memory  memory = cache->memory;
+
+
+    FT_FREE( node );
+  }
+
 
   /* initialize a new cmap node */
   FT_CALLBACK_DEF( FT_Error )
-  ftc_cmap_node_init( FTC_CMapNode   cnode,
-                      FTC_CMapQuery  cquery,
-                      FTC_Cache      cache )
+  ftc_cmap_node_new( FTC_CMapNode  *anode,
+                     FTC_CMapQuery  query,
+                     FTC_Cache      cache )
   {
-    FT_UInt32  first;
-    FT_UInt    n;
-    FT_UNUSED( cache );
+    FT_Error      error;
+    FT_Memory     memory  = cache->memory;
+    FTC_CMapNode  node;
+    FT_UInt       nn;
 
 
-    first = ( cquery->char_code / FTC_CMAP_INDICES_MAX ) *
-            FTC_CMAP_INDICES_MAX;
+    if ( !FT_NEW( node ) )
+    {
+      node->face_id    = query->face_id;
+      node->cmap_index = query->cmap_index;
+      node->first      = (query->char_code / FTC_CMAP_INDICES_MAX) *
+                         FTC_CMAP_INDICES_MAX;
 
-    cnode->first = first;
-    for ( n = 0; n < FTC_CMAP_INDICES_MAX; n++ )
-      cnode->indices[n] = FTC_CMAP_UNKNOWN;
+      for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )
+        node->indices[nn] = FTC_CMAP_UNKNOWN;
+    }
 
-    return 0;
+    *anode = node;
+    return error;
   }
 
 
@@ -142,185 +148,27 @@
 
   /* compare a cmap node to a given query */
   FT_CALLBACK_DEF( FT_Bool )
-  ftc_cmap_node_compare( FTC_CMapNode   cnode,
-                         FTC_CMapQuery  cquery )
-  {
-    FT_UInt32  offset = (FT_UInt32)( cquery->char_code - cnode->first );
-
-
-    return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    CHARMAP FAMILY                             *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_cmap_family_init( FTC_CMapFamily  cfam,
-                        FTC_CMapQuery   cquery,
-                        FTC_Cache       cache )
+  ftc_cmap_node_compare( FTC_CMapNode   node,
+                         FTC_CMapQuery  query )
   {
-    FTC_Manager   manager = cache->manager;
-    FTC_CMapDesc  desc = cquery->desc;
-    FT_UInt32     hash = 0;
-    FT_Error      error;
-    FT_Face       face;
-
-
-    /* setup charmap descriptor */
-    cfam->desc = *desc;
-
-    /* let's see whether the rest is correct too */
-    error = FTC_Manager_Lookup_Face( manager, desc->face_id, &face );
-    if ( !error )
+    if ( node->face_id    == query->face_id    &&
+         node->cmap_index == query->cmap_index )
     {
-      FT_UInt      count = face->num_charmaps;
-      FT_UInt      idx   = count;
-      FT_CharMap*  cur   = face->charmaps;
-
-
-      switch ( desc->type )
-      {
-      case FTC_CMAP_BY_INDEX:
-        idx  = desc->u.index;
-        hash = idx * 33;
-        break;
-
-      case FTC_CMAP_BY_ENCODING:
-        if ( desc->u.encoding == FT_ENCODING_UNICODE )
-        {
-          /* Since the `interesting' table, pid/eid (3,10), is normally the
-           * last one, we loop backwards.  This looses with type1 fonts with
-           * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
-           * chars (.01% ?), and this is the same about 99.99% of the time!
-           */
-
-          FT_UInt  unicmap_idx = count;  /* some UCS-2 map, if we found it */
-
-
-          cur += count - 1;
-
-          for ( idx = 0; idx < count; idx++, cur-- )
-          {
-            if ( cur[0]->encoding == FT_ENCODING_UNICODE )
-            {
-              unicmap_idx = idx;  /* record we found a Unicode charmap */
-
-              /* XXX If some new encodings to represent UCS-4 are added,
-               *     they should be added here.
-               */
-              if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
-                     cur[0]->encoding_id == TT_MS_ID_UCS_4        )      ||
-                   ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
-                     cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32    )  )
-
-              /* Hurray! We found a UCS-4 charmap.  We can stop the scan! */
-              {
-                idx = count - 1 - idx;
-                goto Found_idx_for_FTC_CMAP_BY_ENCODING;
-              }
-            }
-          }
-
-          /* We do not have any UCS-4 charmap. Sigh.
-           * Let's see if we have some other kind of Unicode charmap, though.
-           */
-          if ( unicmap_idx < count )
-            idx = count - 1 - unicmap_idx;
-        }
-        else
-        {
-          for ( idx = 0; idx < count; idx++, cur++ )
-            if ( cur[0]->encoding == desc->u.encoding )
-              break;
-        }
-
-      Found_idx_for_FTC_CMAP_BY_ENCODING:
-        hash = idx * 67;
-        break;
-
-      case FTC_CMAP_BY_ID:
-        for ( idx = 0; idx < count; idx++, cur++ )
-        {
-          if ( (FT_UInt)cur[0]->platform_id == desc->u.id.platform &&
-               (FT_UInt)cur[0]->encoding_id == desc->u.id.encoding )
-          {
-            hash = ( ( desc->u.id.platform << 8 ) | desc->u.id.encoding ) * 7;
-            break;
-          }
-        }
-        break;
-
-      default:
-        ;
-      }
-
-      if ( idx >= count )
-        goto Bad_Descriptor;
+      FT_UInt32  offset = (FT_UInt32)( query->char_code - node->first );
 
-      /* compute hash value, both in family and query */
-      cfam->index               = idx;
-      cfam->hash                = hash ^ FTC_FACE_ID_HASH( desc->face_id );
-      FTC_QUERY( cquery )->hash = FTC_CMAP_HASH( cfam, cquery );
 
-      error = ftc_family_init( FTC_FAMILY( cfam ),
-                               FTC_QUERY( cquery ), cache );
+      return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
     }
 
-    return error;
-
-  Bad_Descriptor:
-    FT_TRACE1(( "ftp_cmap_family_init: invalid charmap descriptor\n" ));
-    return FTC_Err_Invalid_Argument;
+    return 0;
   }
 
 
   FT_CALLBACK_DEF( FT_Bool )
-  ftc_cmap_family_compare( FTC_CMapFamily  cfam,
-                           FTC_CMapQuery   cquery )
+  ftc_cmap_node_remove_faceid( FTC_CMapNode  node,
+                               FTC_FaceID    face_id )
   {
-    FT_Int  result = 0;
-
-
-    /* first, compare face id and type */
-    if ( cfam->desc.face_id != cquery->desc->face_id ||
-         cfam->desc.type    != cquery->desc->type    )
-      goto Exit;
-
-    switch ( cfam->desc.type )
-    {
-    case FTC_CMAP_BY_INDEX:
-      result = ( cfam->desc.u.index == cquery->desc->u.index );
-      break;
-
-    case FTC_CMAP_BY_ENCODING:
-      result = ( cfam->desc.u.encoding == cquery->desc->u.encoding );
-      break;
-
-    case FTC_CMAP_BY_ID:
-      result = ( cfam->desc.u.id.platform == cquery->desc->u.id.platform &&
-                 cfam->desc.u.id.encoding == cquery->desc->u.id.encoding );
-      break;
-
-    default:
-      ;
-    }
-
-    if ( result )
-    {
-      /* when found, update the 'family' and 'hash' field of the query */
-      FTC_QUERY( cquery )->family = FTC_FAMILY( cfam );
-      FTC_QUERY( cquery )->hash   = FTC_CMAP_HASH( cfam, cquery );
-    }
-
-  Exit:
-    return FT_BOOL( result );
+    return FT_BOOL( node->face_id == face_id );
   }
 
 
@@ -334,23 +182,17 @@
 
 
   FT_CALLBACK_TABLE_DEF
-  const FTC_Cache_ClassRec  ftc_cmap_cache_class =
+  const FTC_CacheClassRec  ftc_cmap_cache_class =
   {
-    sizeof ( FTC_CacheRec ),
-    (FTC_Cache_InitFunc) ftc_cache_init,
-    (FTC_Cache_ClearFunc)ftc_cache_clear,
-    (FTC_Cache_DoneFunc) ftc_cache_done,
-
-    sizeof ( FTC_CMapFamilyRec ),
-    (FTC_Family_InitFunc)   ftc_cmap_family_init,
-    (FTC_Family_CompareFunc)ftc_cmap_family_compare,
-    (FTC_Family_DoneFunc)   ftc_family_done,
-
-    sizeof ( FTC_CMapNodeRec ),
-    (FTC_Node_InitFunc)   ftc_cmap_node_init,
+    (FTC_Node_NewFunc)    ftc_cmap_node_new,
     (FTC_Node_WeightFunc) ftc_cmap_node_weight,
     (FTC_Node_CompareFunc)ftc_cmap_node_compare,
-    (FTC_Node_DoneFunc)   ftc_node_done
+    (FTC_Node_CompareFunc)ftc_cmap_node_remove_faceid,
+    (FTC_Node_FreeFunc)   ftc_cmap_node_free,
+
+    sizeof ( FTC_CacheRec ),
+    (FTC_Cache_InitFunc)  ftc_cache_init,
+    (FTC_Cache_DoneFunc)  ftc_cache_done,
   };
 
 
@@ -360,99 +202,84 @@
   FTC_CMapCache_New( FTC_Manager     manager,
                      FTC_CMapCache  *acache )
   {
-    return FTC_Manager_Register_Cache(
-             manager,
-             (FTC_Cache_Class)&ftc_cmap_cache_class,
-             FTC_CACHE_P( acache ) );
+    return FTC_Manager_RegisterCache( manager,
+                                      &ftc_cmap_cache_class,
+                                      FTC_CACHE_P( acache ) );
   }
 
 
-#ifdef FTC_CACHE_USE_INLINE
-
-#define GEN_CACHE_FAMILY_COMPARE( f, q, c ) \
-          ftc_cmap_family_compare( (FTC_CMapFamily)(f), (FTC_CMapQuery)(q) )
-
-#define GEN_CACHE_NODE_COMPARE( n, q, c ) \
-          ftc_cmap_node_compare( (FTC_CMapNode)(n), (FTC_CMapQuery)(q) )
-
-#define GEN_CACHE_LOOKUP  ftc_cmap_cache_lookup
-
-#include "ftccache.i"
-
-#else  /* !FTC_CACHE_USE_INLINE */
-
-#define ftc_cmap_cache_lookup  ftc_cache_lookup
-
-#endif /* !FTC_CACHE_USE_INLINE */
-
-
   /* documentation is in ftccmap.h */
 
   FT_EXPORT_DEF( FT_UInt )
-  FTC_CMapCache_Lookup( FTC_CMapCache  cache,
-                        FTC_CMapDesc   desc,
+  FTC_CMapCache_Lookup( FTC_CMapCache  cmap_cache,
+                        FTC_FaceID     face_id,
+                        FT_Int         cmap_index,
                         FT_UInt32      char_code )
   {
-    FTC_CMapQueryRec  cquery;
+    FTC_Cache         cache = FTC_CACHE( cmap_cache );
+    FTC_CMapQueryRec  query;
     FTC_CMapNode      node;
     FT_Error          error;
     FT_UInt           gindex = 0;
+    FT_UInt32         hash;
 
 
-    if ( !cache || !desc )
+    if ( !cache )
     {
       FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" ));
       return 0;
     }
 
-    cquery.desc      = desc;
-    cquery.char_code = char_code;
-
-    error = ftc_cmap_cache_lookup( FTC_CACHE( cache ),
-                                   FTC_QUERY( &cquery ),
-                                   (FTC_Node*)&node );
-    if ( !error )
-    {
-      FT_UInt  offset = (FT_UInt)( char_code - node->first );
+    query.face_id    = face_id;
+    query.cmap_index = (FT_UInt)cmap_index;
+    query.char_code  = char_code;
+
+    hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );
+
+#if 1
+    FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
+                          node, error );
+#else
+    error = FTC_Cache_Lookup( cache, hash, &query, (FTC_Node*) &node );
+#endif
+    if ( error )
+      goto Exit;
 
+    FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
 
-      FT_ASSERT( offset < FTC_CMAP_INDICES_MAX );
+    gindex = node->indices[char_code - node->first];
+    if ( gindex == FTC_CMAP_UNKNOWN )
+    {
+      FT_Face  face;
 
-      gindex = node->indices[offset];
-      if ( gindex == FTC_CMAP_UNKNOWN )
-      {
-        FT_Face  face;
 
+      gindex = 0;
 
-        /* we need to use FT_Get_Char_Index */
-        gindex = 0;
+      error = FTC_Manager_LookupFace( cache->manager, node->face_id, &face );
+      if ( error )
+        goto Exit;
 
-        error = FTC_Manager_Lookup_Face( FTC_CACHE(cache)->manager,
-                                         desc->face_id,
-                                         &face );
-        if ( !error )
-        {
-          FT_CharMap  old, cmap  = NULL;
-          FT_UInt     cmap_index;
+      if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
+      {
+        FT_CharMap  old, cmap  = NULL;
 
 
-          /* save old charmap, select new one */
-          old        = face->charmap;
-          cmap_index = FTC_CMAP_FAMILY( FTC_QUERY( &cquery )->family )->index;
-          cmap       = face->charmaps[cmap_index];
+        old  = face->charmap;
+        cmap = face->charmaps[cmap_index];
 
+        if ( old != cmap )
           FT_Set_Charmap( face, cmap );
 
-          /* perform lookup */
-          gindex                = FT_Get_Char_Index( face, char_code );
-          node->indices[offset] = (FT_UInt16)gindex;
+        gindex = FT_Get_Char_Index( face, char_code );
 
-          /* restore old charmap */
+        if ( old != cmap )
           FT_Set_Charmap( face, old );
-        }
       }
+
+      node->indices[char_code - node->first] = gindex;
     }
 
+  Exit:
     return gindex;
   }
 

reactos/lib/freetype/src/cache
ftcglyph.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcglyph.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftcglyph.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Glyph Image (FT_Glyph) cache (body).                        */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2003, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,54 +20,64 @@
 #include FT_CACHE_H
 #include FT_CACHE_INTERNAL_GLYPH_H
 #include FT_ERRORS_H
-#include FT_LIST_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 
+#include "ftccback.h"
 #include "ftcerror.h"
 
 
   /* create a new chunk node, setting its cache index and ref count */
   FT_EXPORT_DEF( void )
-  ftc_glyph_node_init( FTC_GlyphNode     gnode,
-                       FT_UInt           gindex,
-                       FTC_GlyphFamily   gfam )
+  FTC_GNode_Init( FTC_GNode   gnode,
+                  FT_UInt     gindex,
+                  FTC_Family  family )
   {
-    FT_UInt  len;
-    FT_UInt  start = FTC_GLYPH_FAMILY_START( gfam, gindex );
+    gnode->family = family;
+    gnode->gindex = gindex;
+    family->num_nodes++;
+  }
 
 
-    gnode->item_start = (FT_UShort)start;
+  FT_EXPORT_DEF( void )
+  FTC_GNode_UnselectFamily( FTC_GNode  gnode,
+                            FTC_Cache  cache )
+  {
+    FTC_Family  family = gnode->family;
 
-    len = gfam->item_total - start;
-    if ( len > gfam->item_count )
-      len = gfam->item_count;
 
-    gnode->item_count = (FT_UShort)len;
-    gfam->family.num_nodes++;
+    gnode->family = NULL;
+    if ( family && --family->num_nodes <= 0 )
+      FTC_MruList_Remove( &FTC_GCACHE( cache )->families,
+                          (FTC_MruNode)family );
   }
 
 
   FT_EXPORT_DEF( void )
-  ftc_glyph_node_done( FTC_GlyphNode  gnode,
-                       FTC_Cache      cache )
+  FTC_GNode_Done( FTC_GNode  gnode,
+                  FTC_Cache  cache )
   {
     /* finalize the node */
-    gnode->item_count = 0;
-    gnode->item_start = 0;
+    gnode->gindex = 0;
 
-    ftc_node_done( FTC_NODE( gnode ), cache );
+    FTC_GNode_UnselectFamily( gnode, cache );
   }
 
 
   FT_EXPORT_DEF( FT_Bool )
-  ftc_glyph_node_compare( FTC_GlyphNode   gnode,
-                          FTC_GlyphQuery  gquery )
+  FTC_GNode_Compare( FTC_GNode   gnode,
+                     FTC_GQuery  gquery )
   {
-    FT_UInt  start = (FT_UInt)gnode->item_start;
-    FT_UInt  count = (FT_UInt)gnode->item_count;
+    return FT_BOOL(  gnode->family == gquery->family &&
+                     gnode->gindex == gquery->gindex );
+  }
+
 
-    return FT_BOOL( (FT_UInt)( gquery->gindex - start ) < count );
+  FT_LOCAL_DEF( FT_Bool )
+  ftc_gnode_compare( FTC_GNode   gnode,
+                     FTC_GQuery  gquery )
+  {
+    return FTC_GNode_Compare( gnode, gquery );
   }
 
 
@@ -79,36 +89,89 @@
   /*************************************************************************/
   /*************************************************************************/
 
+  FT_EXPORT_DEF( void )
+  FTC_Family_Init( FTC_Family  family,
+                   FTC_Cache   cache )
+  {
+    FTC_GCacheClass  clazz = FTC_CACHE__GCACHE_CLASS( cache );
+
+
+    family->clazz     = clazz->family_class;
+    family->num_nodes = 0;
+    family->cache     = cache;
+  }
+
 
   FT_EXPORT_DEF( FT_Error )
-  ftc_glyph_family_init( FTC_GlyphFamily  gfam,
-                         FT_UInt32        hash,
-                         FT_UInt          item_count,
-                         FT_UInt          item_total,
-                         FTC_GlyphQuery   gquery,
-                         FTC_Cache        cache )
+  FTC_GCache_Init( FTC_GCache  cache )
   {
-    FT_Error  error;
+    FT_Error error;
 
-
-    error = ftc_family_init( FTC_FAMILY( gfam ), FTC_QUERY( gquery ), cache );
+    error = FTC_Cache_Init( FTC_CACHE( cache ) );
     if ( !error )
     {
-      gfam->hash       = hash;
-      gfam->item_total = item_total;
-      gfam->item_count = item_count;
-      
-      FTC_GLYPH_FAMILY_FOUND( gfam, gquery );
+      FTC_GCacheClass   clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
+
+      FTC_MruList_Init( &cache->families,
+                        clazz->family_class,
+                        0,  /* no maximum here! */
+                        cache,
+                        FTC_CACHE( cache )->memory );
     }
 
     return error;
   }
 
 
+  FT_LOCAL_DEF( FT_Error )
+  ftc_gcache_init( FTC_GCache  cache )
+  {
+    return FTC_GCache_Init( cache );
+  }
+
+
   FT_EXPORT_DEF( void )
-  ftc_glyph_family_done( FTC_GlyphFamily  gfam )
+  FTC_GCache_Done( FTC_GCache  cache )
+  {
+    FTC_Cache_Done( (FTC_Cache)cache );
+    FTC_MruList_Done( &cache->families );
+  }
+
+
+  FT_LOCAL_DEF( void )
+  ftc_gcache_done( FTC_GCache  cache )
+  {
+    FTC_GCache_Done( cache );
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_GCache_New( FTC_Manager       manager,
+                  FTC_GCacheClass   clazz,
+                  FTC_GCache       *acache )
+  {
+    return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
+                                      (FTC_Cache*)acache );
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_GCache_Lookup( FTC_GCache   cache,
+                     FT_UInt32    hash,
+                     FT_UInt      gindex,
+                     FTC_GQuery   query,
+                     FTC_Node    *anode )
   {
-    ftc_family_done( FTC_FAMILY( gfam ) );
+    FT_Error  error;
+
+
+    query->gindex = gindex;
+
+    FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
+    if ( !error )
+      error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
+
+    return error;
   }
 
 

reactos/lib/freetype/src/cache
ftcimage.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcimage.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftcimage.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Image cache (body).                                         */
 /*                                                                         */
-/*  Copyright 2000-2001 by                                                 */
+/*  Copyright 2000-2001, 2003, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,133 +18,83 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-#include FT_CACHE_IMAGE_H
-#include FT_CACHE_INTERNAL_GLYPH_H
+#include FT_CACHE_INTERNAL_IMAGE_H
 #include FT_INTERNAL_MEMORY_H
 
+#include "ftccback.h"
 #include "ftcerror.h"
 
 
-  /* the FT_Glyph image node type */
-  typedef struct  FTC_ImageNodeRec_
+  /* finalize a given glyph image node */
+  FT_EXPORT_DEF( void )
+  FTC_INode_Free( FTC_INode  inode,
+                  FTC_Cache  cache )
   {
-    FTC_GlyphNodeRec  gnode;
-    FT_Glyph          glyph;
+    FT_Memory  memory = cache->memory;
 
-  } FTC_ImageNodeRec, *FTC_ImageNode;
 
+    if ( inode->glyph )
+    {
+      FT_Done_Glyph( inode->glyph );
+      inode->glyph = NULL;
+    }
 
-#define FTC_IMAGE_NODE( x )         ( (FTC_ImageNode)( x ) )
-#define FTC_IMAGE_NODE_GINDEX( x )  FTC_GLYPH_NODE_GINDEX( x )
+    FTC_GNode_Done( FTC_GNODE( inode ), cache );
+    FT_FREE( inode );
+  }
 
 
-  /* the glyph image query */
-  typedef struct  FTC_ImageQueryRec_
+  FT_LOCAL_DEF( void )
+  ftc_inode_free( FTC_INode  inode,
+                  FTC_Cache  cache )
   {
-    FTC_GlyphQueryRec  gquery;
-    FTC_ImageTypeRec   type;
-
-  } FTC_ImageQueryRec, *FTC_ImageQuery;
-
-
-#define FTC_IMAGE_QUERY( x )  ( (FTC_ImageQuery)( x ) )
+    FTC_INode_Free( inode, cache );
+  }
 
 
-  /* the glyph image set type */
-  typedef struct  FTC_ImageFamilyRec_
+  /* initialize a new glyph image node */
+  FT_EXPORT_DEF( FT_Error )
+  FTC_INode_New( FTC_INode   *pinode,
+                 FTC_GQuery   gquery,
+                 FTC_Cache    cache )
   {
-    FTC_GlyphFamilyRec  gfam;
-    FTC_ImageTypeRec    type;
-
-  } FTC_ImageFamilyRec, *FTC_ImageFamily;
+    FT_Memory  memory = cache->memory;
+    FT_Error   error;
+    FTC_INode  inode;
 
 
-#define FTC_IMAGE_FAMILY( x )         ( (FTC_ImageFamily)( x ) )
-#define FTC_IMAGE_FAMILY_MEMORY( x )  FTC_GLYPH_FAMILY_MEMORY( &(x)->gfam )
-
+    if ( !FT_NEW( inode ) )
+    {
+      FTC_GNode         gnode  = FTC_GNODE( inode );
+      FTC_Family        family = gquery->family;
+      FT_UInt           gindex = gquery->gindex;
+      FTC_IFamilyClass  clazz  = FTC_CACHE__IFAMILY_CLASS( cache );
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    GLYPH IMAGE NODES                          *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
 
+      /* initialize its inner fields */
+      FTC_GNode_Init( gnode, gindex, family );
 
-  /* finalize a given glyph image node */
-  FT_CALLBACK_DEF( void )
-  ftc_image_node_done( FTC_ImageNode  inode,
-                       FTC_Cache      cache )
-  {
-    if ( inode->glyph )
-    {
-      FT_Done_Glyph( inode->glyph );
-      inode->glyph = NULL;
+      /* we will now load the glyph image */
+      error = clazz->family_load_glyph( family, gindex, cache,
+                                        &inode->glyph );
     }
 
-    ftc_glyph_node_done( FTC_GLYPH_NODE( inode ), cache );
+    *pinode = inode;
+    return error;
   }
 
 
-  /* initialize a new glyph image node */
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_image_node_init( FTC_ImageNode   inode,
-                       FTC_GlyphQuery  gquery,
-                       FTC_Cache       cache )
+  FT_LOCAL_DEF( FT_Error )
+  ftc_inode_new( FTC_INode   *pinode,
+                 FTC_GQuery   gquery,
+                 FTC_Cache    cache )
   {
-    FTC_ImageFamily  ifam = FTC_IMAGE_FAMILY( gquery->query.family );
-    FT_Error         error;
-    FT_Face          face;
-    FT_Size          size;
-
-
-    /* initialize its inner fields */
-    ftc_glyph_node_init( FTC_GLYPH_NODE( inode ),
-                         gquery->gindex,
-                         FTC_GLYPH_FAMILY( ifam ) );
-
-    /* we will now load the glyph image */
-    error = FTC_Manager_Lookup_Size( FTC_FAMILY( ifam )->cache->manager,
-                                     &ifam->type.font,
-                                     &face, &size );
-    if ( !error )
-    {
-      FT_UInt  gindex = FTC_GLYPH_NODE_GINDEX( inode );
-
-
-      error = FT_Load_Glyph( face, gindex, ifam->type.flags );
-      if ( !error )
-      {
-        if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP  ||
-             face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )
-        {
-          /* ok, copy it */
-          FT_Glyph  glyph;
-
-
-          error = FT_Get_Glyph( face->glyph, &glyph );
-          if ( !error )
-          {
-            inode->glyph = glyph;
-            goto Exit;
-          }
-        }
-        else
-          error = FTC_Err_Invalid_Argument;
-      }
-    }
-
-    /* in case of error */
-    ftc_glyph_node_done( FTC_GLYPH_NODE(inode), cache );
-
-  Exit:
-    return error;
+    return FTC_INode_New( pinode, gquery, cache );
   }
 
 
-  FT_CALLBACK_DEF( FT_ULong )
-  ftc_image_node_weight( FTC_ImageNode  inode )
+  FT_EXPORT_DEF( FT_ULong )
+  FTC_INode_Weight( FTC_INode  inode )
   {
     FT_ULong  size  = 0;
     FT_Glyph  glyph = inode->glyph;
@@ -185,214 +135,10 @@
   }
 
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    GLYPH IMAGE SETS                           *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_image_family_init( FTC_ImageFamily  ifam,
-                         FTC_ImageQuery   iquery,
-                         FTC_Cache        cache )
-  {
-    FTC_Manager  manager = cache->manager;
-    FT_Error     error;
-    FT_Face      face;
-
-
-    ifam->type = iquery->type;
-
-    /* we need to compute "iquery.item_total" now */
-    error = FTC_Manager_Lookup_Face( manager,
-                                     iquery->type.font.face_id,
-                                     &face );
-    if ( !error )
-    {
-      error = ftc_glyph_family_init( FTC_GLYPH_FAMILY( ifam ),
-                                     FTC_IMAGE_TYPE_HASH( &ifam->type ),
-                                     1,
-                                     face->num_glyphs,
-                                     FTC_GLYPH_QUERY( iquery ),
-                                     cache );
-    }
-
-    return error;
-  }
-
-
-  FT_CALLBACK_DEF( FT_Bool )
-  ftc_image_family_compare( FTC_ImageFamily  ifam,
-                            FTC_ImageQuery   iquery )
-  {
-    FT_Bool  result;
-
-
-    result = FT_BOOL( FTC_IMAGE_TYPE_COMPARE( &ifam->type, &iquery->type ) );
-    if ( result )
-      FTC_GLYPH_FAMILY_FOUND( ifam, iquery );
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    GLYPH IMAGE CACHE                          *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-
-  FT_CALLBACK_TABLE_DEF
-  const FTC_Cache_ClassRec  ftc_image_cache_class =
+  FT_LOCAL_DEF( FT_ULong )
+  ftc_inode_weight( FTC_INode  inode )
   {
-    sizeof ( FTC_CacheRec ),
-    (FTC_Cache_InitFunc) ftc_cache_init,
-    (FTC_Cache_ClearFunc)ftc_cache_clear,
-    (FTC_Cache_DoneFunc) ftc_cache_done,
-
-    sizeof ( FTC_ImageFamilyRec ),
-    (FTC_Family_InitFunc)   ftc_image_family_init,
-    (FTC_Family_CompareFunc)ftc_image_family_compare,
-    (FTC_Family_DoneFunc)   ftc_glyph_family_done,
-
-    sizeof ( FTC_ImageNodeRec ),
-    (FTC_Node_InitFunc)   ftc_image_node_init,
-    (FTC_Node_WeightFunc) ftc_image_node_weight,
-    (FTC_Node_CompareFunc)ftc_glyph_node_compare,
-    (FTC_Node_DoneFunc)   ftc_image_node_done
-  };
-
-
-  /* documentation is in ftcimage.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_ImageCache_New( FTC_Manager      manager,
-                      FTC_ImageCache  *acache )
-  {
-    return FTC_Manager_Register_Cache(
-             manager,
-             (FTC_Cache_Class)&ftc_image_cache_class,
-             FTC_CACHE_P( acache ) );
-  }
-
-
-  /* documentation is in ftcimage.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_ImageCache_Lookup( FTC_ImageCache  cache,
-                         FTC_ImageType   type,
-                         FT_UInt         gindex,
-                         FT_Glyph       *aglyph,
-                         FTC_Node       *anode )
-  {
-    FTC_ImageQueryRec  iquery;
-    FTC_ImageNode      node;
-    FT_Error           error;
-
-
-    /* some argument checks are delayed to ftc_cache_lookup */
-    if ( !aglyph )
-      return FTC_Err_Invalid_Argument;
-
-    if ( anode )
-      *anode  = NULL;
-
-    iquery.gquery.gindex = gindex;
-    iquery.type          = *type;
-
-    error = ftc_cache_lookup( FTC_CACHE( cache ),
-                              FTC_QUERY( &iquery ),
-                              (FTC_Node*)&node );
-    if ( !error )
-    {
-      *aglyph = node->glyph;
-
-      if ( anode )
-      {
-        *anode = (FTC_Node)node;
-        FTC_NODE( node )->ref_count++;
-      }
-    }
-
-    return error;
-  }
-
-
-  /* backwards-compatibility functions */
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_Image_Cache_New( FTC_Manager       manager,
-                       FTC_Image_Cache  *acache )
-  {
-    return FTC_ImageCache_New( manager, (FTC_ImageCache*)acache );
-  }
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_Image_Cache_Lookup( FTC_Image_Cache  icache,
-                          FTC_Image_Desc*  desc,
-                          FT_UInt          gindex,
-                          FT_Glyph        *aglyph )
-  {
-    FTC_ImageTypeRec  type0;
-
-
-    if ( !desc )
-      return FTC_Err_Invalid_Argument;
-
-    type0.font = desc->font;
-
-    /* convert image type flags to load flags */
-    {
-      FT_UInt  load_flags = FT_LOAD_DEFAULT;
-      FT_UInt  type       = desc->image_type;
-
-
-      /* determine load flags, depending on the font description's */
-      /* image type                                                */
-
-      if ( ftc_image_format( type ) == ftc_image_format_bitmap )
-      {
-        if ( type & ftc_image_flag_monochrome )
-          load_flags |= FT_LOAD_MONOCHROME;
-
-        /* disable embedded bitmaps loading if necessary */
-        if ( type & ftc_image_flag_no_sbits )
-          load_flags |= FT_LOAD_NO_BITMAP;
-      }
-      else
-      {
-        /* we want an outline, don't load embedded bitmaps */
-        load_flags |= FT_LOAD_NO_BITMAP;
-
-        if ( type & ftc_image_flag_unscaled )
-          load_flags |= FT_LOAD_NO_SCALE;
-      }
-
-      /* always render glyphs to bitmaps */
-      load_flags |= FT_LOAD_RENDER;
-
-      if ( type & ftc_image_flag_unhinted )
-        load_flags |= FT_LOAD_NO_HINTING;
-
-      if ( type & ftc_image_flag_autohinted )
-        load_flags |= FT_LOAD_FORCE_AUTOHINT;
-
-      type0.flags = load_flags;
-    }
-
-    return FTC_ImageCache_Lookup( (FTC_ImageCache)icache,
-                                   &type0,
-                                   gindex,
-                                   aglyph,
-                                   NULL );
+    return FTC_INode_Weight( inode );
   }
 
 

reactos/lib/freetype/src/cache
ftcmanag.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftcmanag.c	15 Feb 2004 21:45:33 -0000	1.3
+++ ftcmanag.c	10 May 2004 17:48:31 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType Cache Manager (body).                                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,8 +18,7 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-#include FT_CACHE_MANAGER_H
-#include FT_CACHE_INTERNAL_LRU_H
+#include FT_CACHE_INTERNAL_MANAGER_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_SIZES_H
@@ -33,124 +32,151 @@
 #define FTC_LRU_GET_MANAGER( lru )  ( (FTC_Manager)(lru)->user_data )
 
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    FACE LRU IMPLEMENTATION                    *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
+  static FT_Error
+  ftc_scaler_lookup_size( FTC_Manager  manager,
+                          FTC_Scaler   scaler,
+                          FT_Size     *asize )
+  {
+    FT_Face   face;
+    FT_Size   size = NULL;
+    FT_Error  error;
 
-  typedef struct FTC_FaceNodeRec_*  FTC_FaceNode;
-  typedef struct FTC_SizeNodeRec_*  FTC_SizeNode;
 
+    error = FTC_Manager_LookupFace( manager, scaler->face_id, &face );
+    if ( error )
+      goto Exit;
 
-  typedef struct  FTC_FaceNodeRec_
-  {
-    FT_LruNodeRec  lru;
-    FT_Face        face;
+    error = FT_New_Size( face, &size );
+    if ( error )
+      goto Exit;
 
-  } FTC_FaceNodeRec;
+    FT_Activate_Size( size );
+
+    if ( scaler->pixel )
+      error = FT_Set_Pixel_Sizes( face, scaler->width, scaler->height );
+    else
+      error = FT_Set_Char_Size( face, scaler->width, scaler->height,
+                                scaler->x_res, scaler->y_res );
+    if ( error )
+    {
+      FT_Done_Size( size );
+      size = NULL;
+    }
+
+  Exit:
+    *asize = size;
+    return error;
+  }
 
 
   typedef struct  FTC_SizeNodeRec_
   {
-    FT_LruNodeRec  lru;
-    FT_Size        size;
+    FTC_MruNodeRec  node;
+    FT_Size         size;
+    FTC_ScalerRec   scaler;
 
-  } FTC_SizeNodeRec;
+  } FTC_SizeNodeRec, *FTC_SizeNode;
 
 
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_face_node_init( FTC_FaceNode  node,
-                      FTC_FaceID    face_id,
-                      FTC_Manager   manager )
+  FT_CALLBACK_DEF( void )
+  ftc_size_node_done( FTC_SizeNode  node )
   {
-    FT_Error  error;
-
+    FT_Size  size = node->size;
 
-    error = manager->request_face( face_id,
-                                   manager->library,
-                                   manager->request_data,
-                                   &node->face );
-    if ( !error )
-    {
-      /* destroy initial size object; it will be re-created later */
-      if ( node->face->size )
-        FT_Done_Size( node->face->size );
-    }
 
-    return error;
+    if ( size )
+      FT_Done_Size( size );
   }
 
 
-  /* helper function for ftc_face_node_done() */
   FT_CALLBACK_DEF( FT_Bool )
-  ftc_size_node_select( FTC_SizeNode  node,
-                        FT_Face       face )
+  ftc_size_node_compare( FTC_SizeNode  node,
+                         FTC_Scaler    scaler )
   {
-    return FT_BOOL( node->size->face == face );
+    FTC_Scaler  scaler0 = &node->scaler;
+
+
+    if ( FTC_SCALER_COMPARE( scaler0, scaler ) )
+    {
+      FT_Activate_Size( node->size );
+      return 1;
+    }
+    return 0;
   }
 
 
-  FT_CALLBACK_DEF( void )
-  ftc_face_node_done( FTC_FaceNode  node,
+  FT_CALLBACK_DEF( FT_Error )
+  ftc_size_node_init( FTC_SizeNode  node,
+                      FTC_Scaler    scaler,
                       FTC_Manager   manager )
   {
-    FT_Face  face    = node->face;
+    node->scaler = scaler[0];
 
+    return ftc_scaler_lookup_size( manager, scaler, &node->size );
+  }
 
-    /* we must begin by removing all sizes for the target face */
-    /* from the manager's list                                 */
-    FT_LruList_Remove_Selection( manager->sizes_list,
-                                 (FT_LruNode_SelectFunc)ftc_size_node_select,
-                                 face );
 
-    /* all right, we can discard the face now */
-    FT_Done_Face( face );
-    node->face = NULL;
+  FT_CALLBACK_DEF( FT_Error )
+  ftc_size_node_reset( FTC_SizeNode  node,
+                       FTC_Scaler    scaler,
+                       FTC_Manager   manager )
+  {
+    FT_Done_Size( node->size );
+
+    node->scaler = scaler[0];
+
+    return ftc_scaler_lookup_size( manager, scaler, &node->size );
   }
 
 
   FT_CALLBACK_TABLE_DEF
-  const FT_LruList_ClassRec  ftc_face_list_class =
+  const FTC_MruListClassRec  ftc_size_list_class =
   {
-    sizeof ( FT_LruListRec ),
-    (FT_LruList_InitFunc)0,
-    (FT_LruList_DoneFunc)0,
-
-    sizeof ( FTC_FaceNodeRec ),
-    (FT_LruNode_InitFunc)   ftc_face_node_init,
-    (FT_LruNode_DoneFunc)   ftc_face_node_done,
-    (FT_LruNode_FlushFunc)  0,  /* no flushing needed                      */
-    (FT_LruNode_CompareFunc)0,  /* direct comparison of FTC_FaceID handles */
+    sizeof( FTC_SizeNodeRec ),
+    (FTC_MruNode_CompareFunc)ftc_size_node_compare,
+    (FTC_MruNode_InitFunc)   ftc_size_node_init,
+    (FTC_MruNode_ResetFunc)  ftc_size_node_reset,
+    (FTC_MruNode_DoneFunc)   ftc_size_node_done
   };
 
 
-  /* documentation is in ftcache.h */
+  /* helper function used by ftc_face_node_done */
+  static FT_Bool
+  ftc_size_node_compare_faceid( FTC_SizeNode  node,
+                                FTC_FaceID    face_id )
+  {
+    return FT_BOOL( node->scaler.face_id == face_id );
+  }
+
 
   FT_EXPORT_DEF( FT_Error )
-  FTC_Manager_Lookup_Face( FTC_Manager  manager,
-                           FTC_FaceID   face_id,
-                           FT_Face     *aface )
+  FTC_Manager_LookupSize( FTC_Manager  manager,
+                          FTC_Scaler   scaler,
+                          FT_Size     *asize )
   {
     FT_Error      error;
-    FTC_FaceNode  node;
+    FTC_SizeNode  node;
 
 
-    if ( aface == NULL )
+    if ( asize == NULL )
       return FTC_Err_Bad_Argument;
 
-    *aface = NULL;
+    *asize = NULL;
 
     if ( !manager )
       return FTC_Err_Invalid_Cache_Handle;
 
-    error = FT_LruList_Lookup( manager->faces_list,
-                               (FT_LruKey)face_id,
-                               (FT_LruNode*)&node );
+#ifdef FTC_INLINE
+
+    FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,
+                            node, error );
+
+#else
+    error = FTC_MruList_Lookup( &manager->sizes, scaler, (FTC_MruNode*)&node );
+#endif
+
     if ( !error )
-      *aface = node->face;
+      *asize = node->size;
 
     return error;
   }
@@ -159,280 +185,119 @@
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
-  /*****                      SIZES LRU IMPLEMENTATION                 *****/
+  /*****                    FACE MRU IMPLEMENTATION                    *****/
   /*****                                                               *****/
   /*************************************************************************/
   /*************************************************************************/
 
-
-  typedef struct  FTC_SizeQueryRec_
+  typedef struct  FTC_FaceNodeRec_
   {
-    FT_Face  face;
-    FT_UInt  width;
-    FT_UInt  height;
+    FTC_MruNodeRec  node;
+    FTC_FaceID      face_id;
+    FT_Face         face;
 
-  } FTC_SizeQueryRec, *FTC_SizeQuery;
+  } FTC_FaceNodeRec, *FTC_FaceNode;
 
 
   FT_CALLBACK_DEF( FT_Error )
-  ftc_size_node_init( FTC_SizeNode   node,
-                      FTC_SizeQuery  query )
+  ftc_face_node_init( FTC_FaceNode  node,
+                      FTC_FaceID    face_id,
+                      FTC_Manager   manager )
   {
-    FT_Face   face = query->face;
-    FT_Size   size;
     FT_Error  error;
 
 
-    node->size = NULL;
-    error = FT_New_Size( face, &size );
+    node->face_id = face_id;
+
+    error = manager->request_face( face_id,
+                                   manager->library,
+                                   manager->request_data,
+                                   &node->face );
     if ( !error )
     {
-      FT_Activate_Size( size );
-      error = FT_Set_Pixel_Sizes( query->face,
-                                  query->width,
-                                  query->height );
-      if ( error )
-        FT_Done_Size( size );
-      else
-        node->size = size;
+      /* destroy initial size object; it will be re-created later */
+      if ( node->face->size )
+        FT_Done_Size( node->face->size );
     }
+
     return error;
   }
 
 
   FT_CALLBACK_DEF( void )
-  ftc_size_node_done( FTC_SizeNode  node )
-  {
-    if ( node->size )
-    {
-      FT_Done_Size( node->size );
-      node->size = NULL;
-    }
-  }
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_size_node_flush( FTC_SizeNode   node,
-                       FTC_SizeQuery  query )
+  ftc_face_node_done( FTC_FaceNode  node,
+                      FTC_Manager   manager )
   {
-    FT_Size   size = node->size;
-    FT_Error  error;
+    /* we must begin by removing all scalers for the target face */
+    /* from the manager's list                                   */
+    FTC_MruList_RemoveSelection(
+      & manager->sizes,
+      (FTC_MruNode_CompareFunc)ftc_size_node_compare_faceid,
+      node->face_id );
 
-
-    if ( size->face == query->face )
-    {
-      FT_Activate_Size( size );
-      error = FT_Set_Pixel_Sizes( query->face, query->width, query->height );
-      if ( error )
-      {
-        FT_Done_Size( size );
-        node->size = NULL;
-      }
-    }
-    else
-    {
-      FT_Done_Size( size );
-      node->size = NULL;
-
-      error = ftc_size_node_init( node, query );
-    }
-    return error;
+    /* all right, we can discard the face now */
+    FT_Done_Face( node->face );
+    node->face    = NULL;
+    node->face_id = NULL;
   }
 
 
   FT_CALLBACK_DEF( FT_Bool )
-  ftc_size_node_compare( FTC_SizeNode   node,
-                         FTC_SizeQuery  query )
+  ftc_face_node_compare( FTC_FaceNode  node,
+                         FTC_FaceID    face_id )
   {
-    FT_Size  size = node->size;
-
-
-    return FT_BOOL( size->face                    == query->face   &&
-                    (FT_UInt)size->metrics.x_ppem == query->width  &&
-                    (FT_UInt)size->metrics.y_ppem == query->height );
+    return FT_BOOL( node->face_id == face_id );
   }
 
 
   FT_CALLBACK_TABLE_DEF
-  const FT_LruList_ClassRec  ftc_size_list_class =
+  const FTC_MruListClassRec  ftc_face_list_class =
   {
-    sizeof ( FT_LruListRec ),
-    (FT_LruList_InitFunc)0,
-    (FT_LruList_DoneFunc)0,
-
-    sizeof ( FTC_SizeNodeRec ),
-    (FT_LruNode_InitFunc)   ftc_size_node_init,
-    (FT_LruNode_DoneFunc)   ftc_size_node_done,
-    (FT_LruNode_FlushFunc)  ftc_size_node_flush,
-    (FT_LruNode_CompareFunc)ftc_size_node_compare
+    sizeof( FTC_FaceNodeRec),
+
+    (FTC_MruNode_CompareFunc)ftc_face_node_compare,
+    (FTC_MruNode_InitFunc)   ftc_face_node_init,
+    (FTC_MruNode_ResetFunc)  NULL,
+    (FTC_MruNode_DoneFunc)   ftc_face_node_done
   };
 
 
   /* documentation is in ftcache.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FTC_Manager_Lookup_Size( FTC_Manager  manager,
-                           FTC_Font     font,
-                           FT_Face     *aface,
-                           FT_Size     *asize )
-  {
-    FT_Error  error;
-
-
-    /* check for valid `manager' delayed to FTC_Manager_Lookup_Face() */
-    if ( aface )
-      *aface = 0;
-
-    if ( asize )
-      *asize = 0;
-
-    error = FTC_Manager_Lookup_Face( manager, font->face_id, aface );
-    if ( !error )
-    {
-      FTC_SizeQueryRec  query;
-      FTC_SizeNode      node;
-
-
-      query.face   = *aface;
-      query.width  = font->pix_width;
-      query.height = font->pix_height;
-
-      error = FT_LruList_Lookup( manager->sizes_list,
-                                 (FT_LruKey)&query,
-                                 (FT_LruNode*)&node );
-      if ( !error )
-      {
-        /* select the size as the current one for this face */
-        FT_Activate_Size( node->size );
-
-        if ( asize )
-          *asize = node->size;
-      }
-    }
-
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                    SET TABLE MANAGEMENT                       *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  static void
-  ftc_family_table_init( FTC_FamilyTable  table )
-  {
-    table->count   = 0;
-    table->size    = 0;
-    table->entries = NULL;
-    table->free    = FTC_FAMILY_ENTRY_NONE;
-  }
-
-
-  static void
-  ftc_family_table_done( FTC_FamilyTable  table,
-                         FT_Memory        memory )
-  {
-    FT_FREE( table->entries );
-    table->free  = 0;
-    table->count = 0;
-    table->size  = 0;
-  }
-
-
-  FT_EXPORT_DEF( FT_Error )
-  ftc_family_table_alloc( FTC_FamilyTable   table,
-                          FT_Memory         memory,
-                          FTC_FamilyEntry  *aentry )
+  FTC_Manager_LookupFace( FTC_Manager  manager,
+                          FTC_FaceID   face_id,
+                          FT_Face     *aface )
   {
-    FTC_FamilyEntry  entry;
-    FT_Error         error = 0;
-
-
-    /* re-allocate table size when needed */
-    if ( table->free == FTC_FAMILY_ENTRY_NONE && table->count >= table->size )
-    {
-      FT_UInt  old_size = table->size;
-      FT_UInt  new_size, idx;
-
-
-      if ( old_size == 0 )
-        new_size = 8;
-      else
-      {
-        new_size = old_size * 2;
+    FT_Error      error;
+    FTC_FaceNode  node;
 
-        /* check for (unlikely) overflow */
-        if ( new_size < old_size )
-          new_size = 65534;
-      }
 
-      if ( FT_RENEW_ARRAY( table->entries, old_size, new_size ) )
-        return error;
+    if ( aface == NULL )
+      return FTC_Err_Bad_Argument;
 
-      table->size = new_size;
+    *aface = NULL;
 
-      entry       = table->entries + old_size;
-      table->free = old_size;
+    if ( !manager )
+      return FTC_Err_Invalid_Cache_Handle;
 
-      for ( idx = old_size; idx + 1 < new_size; idx++, entry++ )
-      {
-        entry->link  = idx + 1;
-        entry->index = idx;
-      }
+    /* we break encapsulation for the sake of speed */
+#ifdef FTC_INLINE
 
-      entry->link  = FTC_FAMILY_ENTRY_NONE;
-      entry->index = idx;
-    }
+    FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,
+                            node, error );
 
-    if ( table->free != FTC_FAMILY_ENTRY_NONE )
-    {
-      entry       = table->entries + table->free;
-      table->free = entry->link;
-    }
-    else if ( table->count < table->size )
-    {
-      entry = table->entries + table->count++;
-    }
-    else
-    {
-      FT_ERROR(( "ftc_family_table_alloc: internal bug!" ));
-      return FTC_Err_Invalid_Argument;
-    }
+#else
+    error = FTC_MruList_Lookup( &manager->faces, face_id, (FTC_MruNode*)&node );
+#endif
 
-    entry->link = FTC_FAMILY_ENTRY_NONE;
-    table->count++;
+    if ( !error )
+      *aface = node->face;
 
-    *aentry = entry;
     return error;
   }
 
 
-  FT_EXPORT_DEF( void )
-  ftc_family_table_free( FTC_FamilyTable  table,
-                         FT_UInt          idx )
-  {
-    /* simply add it to the linked list of free entries */
-    if ( idx < table->count )
-    {
-      FTC_FamilyEntry  entry = table->entries + idx;
-
-
-      if ( entry->link != FTC_FAMILY_ENTRY_NONE )
-        FT_ERROR(( "ftc_family_table_free: internal bug!\n" ));
-      else
-      {
-        entry->link = table->free;
-        table->free = entry->index;
-        table->count--;
-      }
-    }
-  }
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -475,41 +340,28 @@
     if ( max_bytes == 0 )
       max_bytes = FTC_MAX_BYTES_DEFAULT;
 
-    error = FT_LruList_New( &ftc_face_list_class,
-                            max_faces,
-                            manager,
-                            memory,
-                            &manager->faces_list );
-    if ( error )
-      goto Exit;
-
-    error = FT_LruList_New( &ftc_size_list_class,
-                            max_sizes,
-                            manager,
-                            memory,
-                            &manager->sizes_list );
-    if ( error )
-      goto Exit;
-
     manager->library      = library;
+    manager->memory       = memory;
     manager->max_weight   = max_bytes;
-    manager->cur_weight   = 0;
 
     manager->request_face = requester;
     manager->request_data = req_data;
 
-    ftc_family_table_init( &manager->families );
+    FTC_MruList_Init( &manager->faces,
+                      &ftc_face_list_class,
+                      max_faces,
+                      manager,
+                      memory );
+
+    FTC_MruList_Init( &manager->sizes,
+                      &ftc_size_list_class,
+                      max_sizes,
+                      manager,
+                      memory );
 
     *amanager = manager;
 
   Exit:
-    if ( error && manager )
-    {
-      FT_LruList_Destroy( manager->faces_list );
-      FT_LruList_Destroy( manager->sizes_list );
-      FT_FREE( manager );
-    }
-
     return error;
   }
 
@@ -526,31 +378,29 @@
     if ( !manager || !manager->library )
       return;
 
-    memory = manager->library->memory;
+    memory = manager->memory;
 
     /* now discard all caches */
-    for (idx = 0; idx < FTC_MAX_CACHES; idx++ )
+    for (idx = manager->num_caches; idx-- > 0; )
     {
       FTC_Cache  cache = manager->caches[idx];
 
 
       if ( cache )
       {
-        cache->clazz->cache_done( cache );
+        cache->clazz.cache_done( cache );
         FT_FREE( cache );
-        manager->caches[idx] = 0;
+        manager->caches[idx] = NULL;
       }
     }
-
-    /* discard families table */
-    ftc_family_table_done( &manager->families, memory );
+    manager->num_caches = 0;
 
     /* discard faces and sizes */
-    FT_LruList_Destroy( manager->faces_list );
-    manager->faces_list = 0;
+    FTC_MruList_Done( &manager->sizes );
+    FTC_MruList_Done( &manager->faces );
 
-    FT_LruList_Destroy( manager->sizes_list );
-    manager->sizes_list = 0;
+    manager->library = NULL;
+    manager->memory  = NULL;
 
     FT_FREE( manager );
   }
@@ -563,8 +413,8 @@
   {
     if ( manager )
     {
-      FT_LruList_Reset( manager->sizes_list );
-      FT_LruList_Reset( manager->faces_list );
+      FTC_MruList_Reset( &manager->sizes );
+      FTC_MruList_Reset( &manager->faces );
     }
     /* XXX: FIXME: flush the caches? */
   }
@@ -576,7 +426,7 @@
   FTC_Manager_Check( FTC_Manager  manager )
   {
     FTC_Node  node, first;
-    
+
 
     first = manager->nodes_list;
 
@@ -584,26 +434,22 @@
     if ( first )
     {
       FT_ULong  weight = 0;
-      
+
 
       node = first;
 
       do
       {
-        FTC_FamilyEntry  entry = manager->families.entries + node->fam_index;
-        FTC_Cache     cache;
+        FTC_Cache  cache = manager->caches[node->cache_index];
 
-        if ( (FT_UInt)node->fam_index >= manager->families.count ||
-             entry->link              != FTC_FAMILY_ENTRY_NONE  )
-          FT_ERROR(( "FTC_Manager_Check: invalid node (family index = %ld\n",
-                     node->fam_index ));
+
+        if ( (FT_UInt)node->cache_index >= manager->num_caches )
+          FT_ERROR(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
+                     node->cache_index ));
         else
-        {
-          cache   = entry->cache;
-          weight += cache->clazz->node_weight( node, cache );
-        }
+          weight += cache->clazz.node_weight( node, cache );
 
-        node = node->mru_next;
+        node = FTC_NODE__NEXT( node );
 
       } while ( node != first );
 
@@ -622,7 +468,7 @@
       do
       {
         count++;
-        node = node->mru_next;
+        node = FTC_NODE__NEXT( node );
 
       } while ( node != first );
 
@@ -664,14 +510,14 @@
     if ( manager->cur_weight < manager->max_weight || first == NULL )
       return;
 
-    /* go to last node - it's a circular list */
-    node = first->mru_prev;
+    /* go to last node -- it's a circular list */
+    node = FTC_NODE__PREV( first );
     do
     {
-      FTC_Node  prev = node->mru_prev;
+      FTC_Node  prev;
 
 
-      prev = ( node == first ) ? NULL : node->mru_prev;
+      prev = ( node == first ) ? NULL : FTC_NODE__PREV( node );
 
       if ( node->ref_count <= 0 )
         ftc_node_destroy( node, manager );
@@ -685,9 +531,9 @@
   /* documentation is in ftcmanag.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FTC_Manager_Register_Cache( FTC_Manager      manager,
-                              FTC_Cache_Class  clazz,
-                              FTC_Cache       *acache )
+  FTC_Manager_RegisterCache( FTC_Manager      manager,
+                             FTC_CacheClass   clazz,
+                             FTC_Cache       *acache )
   {
     FT_Error   error = FTC_Err_Invalid_Argument;
     FTC_Cache  cache = NULL;
@@ -695,50 +541,37 @@
 
     if ( manager && clazz && acache )
     {
-      FT_Memory  memory = manager->library->memory;
-      FT_UInt    idx  = 0;
-
+      FT_Memory  memory = manager->memory;
 
-      /* check for an empty cache slot in the manager's table */
-      for ( idx = 0; idx < FTC_MAX_CACHES; idx++ )
-      {
-        if ( manager->caches[idx] == 0 )
-          break;
-      }
 
-      /* return an error if there are too many registered caches */
-      if ( idx >= FTC_MAX_CACHES )
+      if ( manager->num_caches >= FTC_MAX_CACHES )
       {
         error = FTC_Err_Too_Many_Caches;
-        FT_ERROR(( "FTC_Manager_Register_Cache:" ));
-        FT_ERROR(( " too many registered caches\n" ));
+        FT_ERROR(( "%s: too many registered caches\n",
+                   "FTC_Manager_Register_Cache" ));
         goto Exit;
       }
 
       if ( !FT_ALLOC( cache, clazz->cache_size ) )
       {
-        cache->manager = manager;
-        cache->memory  = memory;
-        cache->clazz   = clazz;
+        cache->manager   = manager;
+        cache->memory    = memory;
+        cache->clazz     = clazz[0];
+        cache->org_class = clazz;
 
         /* THIS IS VERY IMPORTANT!  IT WILL WRETCH THE MANAGER */
         /* IF IT IS NOT SET CORRECTLY                          */
-        cache->cache_index = idx;
+        cache->index = manager->num_caches;
 
-        if ( clazz->cache_init )
+        error = clazz->cache_init( cache );
+        if ( error )
         {
-          error = clazz->cache_init( cache );
-          if ( error )
-          {
-            if ( clazz->cache_done )
-              clazz->cache_done( cache );
-
-            FT_FREE( cache );
-            goto Exit;
-          }
+          clazz->cache_done( cache );
+          FT_FREE( cache );
+          goto Exit;
         }
 
-        manager->caches[idx] = cache;
+        manager->caches[manager->num_caches++] = cache;
       }
     }
 
@@ -748,17 +581,66 @@
   }
 
 
+  FT_EXPORT_DEF( FT_UInt )
+  FTC_Manager_FlushN( FTC_Manager  manager,
+                      FT_UInt      count )
+  {
+    FTC_Node  first = manager->nodes_list;
+    FTC_Node  node;
+    FT_UInt   result;
+
+
+    /* try to remove `count' nodes from the list */
+    if ( first == NULL )  /* empty list! */
+      return 0;
+
+    /* go to last node - it's a circular list */
+    node = FTC_NODE__PREV(first);
+    for ( result = 0; result < count; )
+    {
+      FTC_Node  prev = FTC_NODE__PREV( node );
+
+
+      /* don't touch locked nodes */
+      if ( node->ref_count <= 0 )
+      {
+        ftc_node_destroy( node, manager );
+        result++;
+      }
+
+      if ( prev == manager->nodes_list )
+        break;
+
+      node = prev;
+    }
+    return  result;
+  }
+
+
+  FT_EXPORT_DEF( void )
+  FTC_Manager_RemoveFaceID( FTC_Manager  manager,
+                            FTC_FaceID   face_id )
+  {
+    FT_UInt  nn;
+
+    /* this will remove all FTC_SizeNode that correspond to
+     * the face_id as well
+     */
+    FTC_MruList_RemoveSelection( &manager->faces, NULL, face_id );
+
+    for ( nn = 0; nn < manager->num_caches; nn++ )
+      FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );
+  }
+
+
   /* documentation is in ftcmanag.h */
 
   FT_EXPORT_DEF( void )
   FTC_Node_Unref( FTC_Node     node,
                   FTC_Manager  manager )
   {
-    if ( node && (FT_UInt)node->fam_index < manager->families.count &&
-         manager->families.entries[node->fam_index].cache )
-    {
+    if ( node && (FT_UInt)node->cache_index < manager->num_caches )
       node->ref_count--;
-    }
   }
 
 

reactos/lib/freetype/src/cache
ftcsbits.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ftcsbits.c	15 Feb 2004 21:45:33 -0000	1.5
+++ ftcsbits.c	10 May 2004 17:48:31 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType sbits manager (body).                                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,57 +18,15 @@
 
 #include <ft2build.h>
 #include FT_CACHE_H
-#include FT_CACHE_SMALL_BITMAPS_H
-#include FT_CACHE_INTERNAL_GLYPH_H
+#include FT_CACHE_INTERNAL_SBITS_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_ERRORS_H
 
+#include "ftccback.h"
 #include "ftcerror.h"
 
 
-#define FTC_SBIT_ITEMS_PER_NODE  16
-
-
-  typedef struct FTC_SBitNodeRec_*  FTC_SBitNode;
-
-  typedef struct  FTC_SBitNodeRec_
-  {
-    FTC_GlyphNodeRec  gnode;
-    FTC_SBitRec       sbits[FTC_SBIT_ITEMS_PER_NODE];
-
-  } FTC_SBitNodeRec;
-
-
-#define FTC_SBIT_NODE( x )  ( (FTC_SBitNode)( x ) )
-
-
-  typedef struct  FTC_SBitQueryRec_
-  {
-    FTC_GlyphQueryRec  gquery;
-    FTC_ImageTypeRec   type;
-
-  } FTC_SBitQueryRec, *FTC_SBitQuery;
-
-
-#define FTC_SBIT_QUERY( x ) ( (FTC_SBitQuery)( x ) )
-
-
-  typedef struct FTC_SBitFamilyRec_*  FTC_SBitFamily;
-
-  /* sbit family structure */
-  typedef struct  FTC_SBitFamilyRec_
-  {
-    FTC_GlyphFamilyRec  gfam;
-    FTC_ImageTypeRec    type;
-
-  } FTC_SBitFamilyRec;
-
-
-#define FTC_SBIT_FAMILY( x )         ( (FTC_SBitFamily)( x ) )
-#define FTC_SBIT_FAMILY_MEMORY( x )  FTC_GLYPH_FAMILY_MEMORY( &( x )->cset )
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -100,454 +58,275 @@
   }
 
 
-  FT_CALLBACK_DEF( void )
-  ftc_sbit_node_done( FTC_SBitNode  snode,
-                      FTC_Cache     cache )
+  FT_EXPORT_DEF( void )
+  FTC_SNode_Free( FTC_SNode  snode,
+                  FTC_Cache  cache )
   {
     FTC_SBit   sbit   = snode->sbits;
-    FT_UInt    count  = FTC_GLYPH_NODE( snode )->item_count;
+    FT_UInt    count  = snode->count;
     FT_Memory  memory = cache->memory;
 
 
     for ( ; count > 0; sbit++, count-- )
       FT_FREE( sbit->buffer );
 
-    ftc_glyph_node_done( FTC_GLYPH_NODE( snode ), cache );
+    FTC_GNode_Done( FTC_GNODE( snode ), cache );
+
+    FT_FREE( snode );
+  }
+
+
+  FT_LOCAL_DEF( void )
+  ftc_snode_free( FTC_SNode  snode,
+                  FTC_Cache  cache )
+  {
+    FTC_SNode_Free( snode, cache );
   }
 
 
   static FT_Error
-  ftc_sbit_node_load( FTC_SBitNode    snode,
-                      FTC_Manager     manager,
-                      FTC_SBitFamily  sfam,
-                      FT_UInt         gindex,
-                      FT_ULong       *asize )
+  ftc_snode_load( FTC_SNode    snode,
+                  FTC_Manager  manager,
+                  FT_UInt      gindex,
+                  FT_ULong    *asize )
   {
-    FT_Error       error;
-    FTC_GlyphNode  gnode = FTC_GLYPH_NODE( snode );
-    FT_Memory      memory;
-    FT_Face        face;
-    FT_Size        size;
-    FTC_SBit       sbit;
+    FT_Error          error;
+    FTC_GNode         gnode  = FTC_GNODE( snode );
+    FTC_Family        family = gnode->family;
+    FT_Memory         memory = manager->memory;
+    FT_Face           face;
+    FTC_SBit          sbit;
+    FTC_SFamilyClass  clazz;
 
 
-    if ( gindex <  (FT_UInt)gnode->item_start                     ||
-         gindex >= (FT_UInt)gnode->item_start + gnode->item_count )
+    if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )
     {
-      FT_ERROR(( "ftc_sbit_node_load: invalid glyph index" ));
+      FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
       return FTC_Err_Invalid_Argument;
     }
 
-    memory = manager->library->memory;
+    sbit  = snode->sbits + ( gindex - gnode->gindex );
+    clazz = (FTC_SFamilyClass)family->clazz;
+
+    sbit->buffer = 0;
 
-    sbit = snode->sbits + ( gindex - gnode->item_start );
+    error = clazz->family_load_glyph( family, gindex, manager, &face );
+    if ( error )
+      goto BadGlyph;
 
-    error = FTC_Manager_Lookup_Size( manager, &sfam->type.font,
-                                     &face, &size );
-    if ( !error )
     {
-      /* by default, indicates a `missing' glyph */
-      sbit->buffer = 0;
+      FT_Int        temp;
+      FT_GlyphSlot  slot   = face->glyph;
+      FT_Bitmap*    bitmap = &slot->bitmap;
+      FT_Int        xadvance, yadvance;
 
-      error = FT_Load_Glyph( face, gindex, sfam->type.flags | FT_LOAD_RENDER );
-      if ( !error )
-      {
-        FT_Int        temp;
-        FT_GlyphSlot  slot   = face->glyph;
-        FT_Bitmap*    bitmap = &slot->bitmap;
-        FT_Int        xadvance, yadvance;
 
+      if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
+      {
+        FT_ERROR(( "%s: glyph loaded didn't return a bitmap!\n",
+                   "ftc_snode_load" ));
+        goto BadGlyph;
+      }
 
-        /* check that our values fit into 8-bit containers!       */
-        /* If this is not the case, our bitmap is too large       */
-        /* and we will leave it as `missing' with sbit.buffer = 0 */
+      /* Check that our values fit into 8-bit containers!       */
+      /* If this is not the case, our bitmap is too large       */
+      /* and we will leave it as `missing' with sbit.buffer = 0 */
 
 #define CHECK_CHAR( d )  ( temp = (FT_Char)d, temp == d )
 #define CHECK_BYTE( d )  ( temp = (FT_Byte)d, temp == d )
 
-        /* XXX: FIXME: add support for vertical layouts maybe */
-
-        /* horizontal advance in pixels */
-        xadvance = ( slot->metrics.horiAdvance + 32 ) >> 6;
-        yadvance = ( slot->metrics.vertAdvance + 32 ) >> 6;
-
-        if ( CHECK_BYTE( bitmap->rows  )     &&
-             CHECK_BYTE( bitmap->width )     &&
-             CHECK_CHAR( bitmap->pitch )     &&
-             CHECK_CHAR( slot->bitmap_left ) &&
-             CHECK_CHAR( slot->bitmap_top  ) &&
-             CHECK_CHAR( xadvance )          &&
-             CHECK_CHAR( yadvance )          )
-        {
-          sbit->width     = (FT_Byte)bitmap->width;
-          sbit->height    = (FT_Byte)bitmap->rows;
-          sbit->pitch     = (FT_Char)bitmap->pitch;
-          sbit->left      = (FT_Char)slot->bitmap_left;
-          sbit->top       = (FT_Char)slot->bitmap_top;
-          sbit->xadvance  = (FT_Char)xadvance;
-          sbit->yadvance  = (FT_Char)yadvance;
-          sbit->format    = (FT_Byte)bitmap->pixel_mode;
-          sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
-
-#if 0 /* this doesn't work well with embedded bitmaps */
-
-          /* grab the bitmap when possible - this is a hack! */
-          if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
-          {
-            slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
-            sbit->buffer           = bitmap->buffer;
-          }
-          else
-#endif
-          {
-            /* copy the bitmap into a new buffer -- ignore error */
-            error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );
-          }
-
-          /* now, compute size */
-          if ( asize )
-            *asize = ABS( sbit->pitch ) * sbit->height;
-
-        }  /* glyph dimensions ok */
-
-      } /* glyph loading successful */
-
-      /* ignore the errors that might have occurred --   */
-      /* we mark unloaded glyphs with `sbit.buffer == 0' */
-      /* and 'width == 255', 'height == 0'               */
-      /*                                                 */
-      if ( error && error != FTC_Err_Out_Of_Memory )
-      {
-        sbit->width = 255;
-        error       = 0;
-        /* sbit->buffer == NULL too! */
-      }
+      /* horizontal advance in pixels */
+      xadvance = ( slot->metrics.horiAdvance + 32 ) >> 6;
+      yadvance = ( slot->metrics.vertAdvance + 32 ) >> 6;
+
+      if ( !CHECK_BYTE( bitmap->rows  )     ||
+           !CHECK_BYTE( bitmap->width )     ||
+           !CHECK_CHAR( bitmap->pitch )     ||
+           !CHECK_CHAR( slot->bitmap_left ) ||
+           !CHECK_CHAR( slot->bitmap_top  ) ||
+           !CHECK_CHAR( xadvance )          ||
+           !CHECK_CHAR( yadvance )          )
+        goto BadGlyph;
+
+      sbit->width     = (FT_Byte)bitmap->width;
+      sbit->height    = (FT_Byte)bitmap->rows;
+      sbit->pitch     = (FT_Char)bitmap->pitch;
+      sbit->left      = (FT_Char)slot->bitmap_left;
+      sbit->top       = (FT_Char)slot->bitmap_top;
+      sbit->xadvance  = (FT_Char)xadvance;
+      sbit->yadvance  = (FT_Char)yadvance;
+      sbit->format    = (FT_Byte)bitmap->pixel_mode;
+      sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
+
+      /* copy the bitmap into a new buffer -- ignore error */
+      error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );
+
+      /* now, compute size */
+      if ( asize )
+        *asize = FT_ABS( sbit->pitch ) * sbit->height;
+
+    } /* glyph loading successful */
+
+    /* ignore the errors that might have occurred --   */
+    /* we mark unloaded glyphs with `sbit.buffer == 0' */
+    /* and `width == 255', `height == 0'               */
+    /*                                                 */
+    if ( error && error != FTC_Err_Out_Of_Memory )
+    {
+    BadGlyph:
+      sbit->width  = 255;
+      sbit->height = 0;
+      sbit->buffer = NULL;
+      error        = 0;
+      if ( asize )
+        *asize = 0;
     }
 
     return error;
   }
 
 
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_sbit_node_init( FTC_SBitNode    snode,
-                      FTC_GlyphQuery  gquery,
-                      FTC_Cache       cache )
-  {
-    FT_Error  error;
-
-
-    ftc_glyph_node_init( FTC_GLYPH_NODE( snode ),
-                         gquery->gindex,
-                         FTC_GLYPH_FAMILY( gquery->query.family ) );
-
-    error = ftc_sbit_node_load( snode,
-                                cache->manager,
-                                FTC_SBIT_FAMILY( FTC_QUERY( gquery )->family ),
-                                gquery->gindex,
-                                NULL );
-    if ( error )
-      ftc_glyph_node_done( FTC_GLYPH_NODE( snode ), cache );
-
-    return error;
-  }
-
-
-  FT_CALLBACK_DEF( FT_ULong )
-  ftc_sbit_node_weight( FTC_SBitNode  snode )
-  {
-    FTC_GlyphNode  gnode = FTC_GLYPH_NODE( snode );
-    FT_UInt        count = gnode->item_count;
-    FTC_SBit       sbit  = snode->sbits;
-    FT_Int         pitch;
-    FT_ULong       size;
-
+  FT_EXPORT_DEF( FT_Error )
+  FTC_SNode_New( FTC_SNode  *psnode,
+                 FTC_GQuery  gquery,
+                 FTC_Cache   cache )
+  {
+    FT_Memory   memory = cache->memory;
+    FT_Error    error;
+    FTC_SNode   snode  = NULL;
+    FT_UInt     gindex = gquery->gindex;
+    FTC_Family  family = gquery->family;
 
-    /* the node itself */
-    size = sizeof ( *snode );
+    FTC_SFamilyClass  clazz = FTC_CACHE__SFAMILY_CLASS( cache );
+    FT_UInt           total;
 
-    /* the sbit records */
-    size += FTC_GLYPH_NODE( snode )->item_count * sizeof ( FTC_SBitRec );
 
-    for ( ; count > 0; count--, sbit++ )
+    total = clazz->family_get_count( family, cache->manager );
+    if ( total == 0 || gindex >= total )
     {
-      if ( sbit->buffer )
-      {
-        pitch = sbit->pitch;
-        if ( pitch < 0 )
-          pitch = -pitch;
-
-        /* add the size of a given glyph image */
-        size += pitch * sbit->height;
-      }
+      error = FT_Err_Invalid_Argument;
+      goto Exit;
     }
 
-    return size;
-  }
-
+    if ( !FT_NEW( snode ) )
+    {
+      FT_UInt  count, start;
 
-  FT_CALLBACK_DEF( FT_Bool )
-  ftc_sbit_node_compare( FTC_SBitNode   snode,
-                         FTC_SBitQuery  squery,
-                         FTC_Cache      cache )
-  {
-    FTC_GlyphQuery  gquery = FTC_GLYPH_QUERY( squery );
-    FTC_GlyphNode   gnode  = FTC_GLYPH_NODE( snode );
-    FT_Bool         result;
 
+      start = gindex - ( gindex % FTC_SBIT_ITEMS_PER_NODE );
+      count = total - start;
+      if ( count > FTC_SBIT_ITEMS_PER_NODE )
+        count = FTC_SBIT_ITEMS_PER_NODE;
 
-    result = ftc_glyph_node_compare( gnode, gquery );
-    if ( result )
-    {
-      /* check if we need to load the glyph bitmap now */
-      FT_UInt   gindex = gquery->gindex;
-      FTC_SBit  sbit   = snode->sbits + ( gindex - gnode->item_start );
+      FTC_GNode_Init( FTC_GNODE( snode ), start, family );
 
+      snode->count = count;
 
-      if ( sbit->buffer == NULL && sbit->width != 255 )
+      error = ftc_snode_load( snode,
+                              cache->manager,
+                              gindex,
+                              NULL );
+      if ( error )
       {
-        FT_ULong  size;
-
-
-        if ( !ftc_sbit_node_load(
-                snode, cache->manager,
-                FTC_SBIT_FAMILY( FTC_QUERY( squery )->family ),
-                gindex, &size ) )
-          cache->manager->cur_weight += size;
+        FTC_SNode_Free( snode, cache );
+        snode = NULL;
       }
     }
 
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                     SBITS FAMILIES                            *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  FT_CALLBACK_DEF( FT_Error )
-  ftc_sbit_family_init( FTC_SBitFamily  sfam,
-                        FTC_SBitQuery   squery,
-                        FTC_Cache       cache )
-  {
-    FTC_Manager  manager = cache->manager;
-    FT_Error     error;
-    FT_Face      face;
-
-
-    sfam->type = squery->type;
-
-    /* we need to compute "cquery.item_total" now */
-    error = FTC_Manager_Lookup_Face( manager,
-                                     squery->type.font.face_id,
-                                     &face );
-    if ( !error )
-    {
-      error = ftc_glyph_family_init( FTC_GLYPH_FAMILY( sfam ),
-                                     FTC_IMAGE_TYPE_HASH( &sfam->type ),
-                                     FTC_SBIT_ITEMS_PER_NODE,
-                                     face->num_glyphs,
-                                     FTC_GLYPH_QUERY( squery ),
-                                     cache );
-    }
-
+  Exit:
+    *psnode = snode;
     return error;
   }
 
 
-  FT_CALLBACK_DEF( FT_Bool )
-  ftc_sbit_family_compare( FTC_SBitFamily  sfam,
-                           FTC_SBitQuery   squery )
+  FT_LOCAL_DEF( FT_Error )
+  ftc_snode_new( FTC_SNode  *psnode,
+                 FTC_GQuery  gquery,
+                 FTC_Cache   cache )
   {
-    FT_Bool  result;
-
-
-    /* we need to set the "cquery.cset" field or our query for */
-    /* faster glyph comparisons in ftc_sbit_node_compare       */
-    /*                                                         */
-    result = FT_BOOL( FTC_IMAGE_TYPE_COMPARE( &sfam->type, &squery->type ) );
-    if ( result )
-      FTC_GLYPH_FAMILY_FOUND( sfam, squery );
-
-    return result;
+    return FTC_SNode_New( psnode, gquery, cache );
   }
 
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                     SBITS CACHE                               *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  FT_CALLBACK_TABLE_DEF
-  const FTC_Cache_ClassRec  ftc_sbit_cache_class =
-  {
-    sizeof ( FTC_CacheRec ),
-    (FTC_Cache_InitFunc) ftc_cache_init,
-    (FTC_Cache_ClearFunc)ftc_cache_clear,
-    (FTC_Cache_DoneFunc) ftc_cache_done,
-
-    sizeof ( FTC_SBitFamilyRec ),
-    (FTC_Family_InitFunc)   ftc_sbit_family_init,
-    (FTC_Family_CompareFunc)ftc_sbit_family_compare,
-    (FTC_Family_DoneFunc)   ftc_glyph_family_done,
-
-    sizeof ( FTC_SBitNodeRec ),
-    (FTC_Node_InitFunc)   ftc_sbit_node_init,
-    (FTC_Node_WeightFunc) ftc_sbit_node_weight,
-    (FTC_Node_CompareFunc)ftc_sbit_node_compare,
-    (FTC_Node_DoneFunc)   ftc_sbit_node_done
-  };
-
-
-  /* documentation is in ftcsbits.h */
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBitCache_New( FTC_Manager     manager,
-                     FTC_SBitCache  *acache )
-  {
-    return FTC_Manager_Register_Cache( manager,
-                                       &ftc_sbit_cache_class,
-                                       (FTC_Cache*)acache );
-  }
-
-
-  /* documentation is in ftcsbits.h */
-
-#ifdef FTC_CACHE_USE_INLINE
-
-#define GEN_CACHE_FAMILY_COMPARE( f, q, c ) \
-          ftc_sbit_family_compare( (FTC_SBitFamily)(f), (FTC_SBitQuery)(q) )
-
-#define GEN_CACHE_NODE_COMPARE( n, q, c ) \
-          ftc_sbit_node_compare( (FTC_SBitNode)(n), (FTC_SBitQuery)(q), c )
-
-#define GEN_CACHE_LOOKUP  ftc_sbit_cache_lookup
-#include "ftccache.i"
-
-#else  /* !FTC_CACHE_USE_INLINE */
-
-#define ftc_sbit_cache_lookup  ftc_cache_lookup
-
-#endif /* !FTC_CACHE_USE_INLINE */
-
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBitCache_Lookup( FTC_SBitCache   cache,
-                        FTC_ImageType   type,
-                        FT_UInt         gindex,
-                        FTC_SBit       *ansbit,
-                        FTC_Node       *anode )
+  FT_EXPORT_DEF( FT_ULong )
+  FTC_SNode_Weight( FTC_SNode  snode )
   {
-    FT_Error          error;
-    FTC_SBitQueryRec  squery;
-    FTC_SBitNode      node;
-
+    FT_UInt    count = snode->count;
+    FTC_SBit   sbit  = snode->sbits;
+    FT_Int     pitch;
+    FT_ULong   size;
 
-    /* other argument checks delayed to ftc_cache_lookup */
-    if ( !ansbit )
-      return FTC_Err_Invalid_Argument;
-
-    *ansbit = NULL;
 
-    if ( anode )
-      *anode = NULL;
+    FT_ASSERT( snode->count <= FTC_SBIT_ITEMS_PER_NODE );
 
-    squery.gquery.gindex = gindex;
-    squery.type          = *type;
+    /* the node itself */
+    size = sizeof ( *snode );
 
-    error = ftc_sbit_cache_lookup( FTC_CACHE( cache ),
-                                   FTC_QUERY( &squery ),
-                                   (FTC_Node*)&node );
-    if ( !error )
+    for ( ; count > 0; count--, sbit++ )
     {
-      *ansbit = node->sbits + ( gindex - FTC_GLYPH_NODE( node )->item_start );
-
-      if ( anode )
+      if ( sbit->buffer )
       {
-        *anode = FTC_NODE( node );
-        FTC_NODE( node )->ref_count++;
+        pitch = sbit->pitch;
+        if ( pitch < 0 )
+          pitch = -pitch;
+
+        /* add the size of a given glyph image */
+        size += pitch * sbit->height;
       }
     }
-    return error;
-  }
 
+    return size;
+  }
 
-  /* backwards-compatibility functions */
 
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBit_Cache_New( FTC_Manager      manager,
-                      FTC_SBit_Cache  *acache )
+  FT_LOCAL_DEF( FT_ULong )
+  ftc_snode_weight( FTC_SNode  snode )
   {
-    return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache );
+    return FTC_SNode_Weight( snode );
   }
 
 
-  FT_EXPORT_DEF( FT_Error )
-  FTC_SBit_Cache_Lookup( FTC_SBit_Cache   cache,
-                         FTC_Image_Desc*  desc,
-                         FT_UInt          gindex,
-                         FTC_SBit        *ansbit )
+  FT_EXPORT_DEF( FT_Bool )
+  FTC_SNode_Compare( FTC_SNode   snode,
+                     FTC_GQuery  gquery,
+                     FTC_Cache   cache )
   {
-    FTC_ImageTypeRec  type0;
-
+    FTC_GNode  gnode  = FTC_GNODE( snode );
+    FT_UInt    gindex = gquery->gindex;
+    FT_Bool    result;
 
-    if ( !desc )
-      return FTC_Err_Invalid_Argument;
 
-    type0.font  = desc->font;
-    type0.flags = 0;
-
-    /* convert image type flags to load flags */
+    result = FT_BOOL( gnode->family == gquery->family                    &&
+                      (FT_UInt)( gindex - gnode->gindex ) < snode->count );
+    if ( result )
     {
-      FT_UInt  load_flags = FT_LOAD_DEFAULT;
-      FT_UInt  type       = desc->image_type;
-
+      /* check if we need to load the glyph bitmap now */
+      FTC_SBit  sbit = snode->sbits + ( gindex - gnode->gindex );
 
-      /* determine load flags, depending on the font description's */
-      /* image type                                                */
 
-      if ( ftc_image_format( type ) == ftc_image_format_bitmap )
+      if ( sbit->buffer == NULL && sbit->width != 255 )
       {
-        if ( type & ftc_image_flag_monochrome )
-          load_flags |= FT_LOAD_MONOCHROME;
+        FT_ULong  size;
 
-        /* disable embedded bitmaps loading if necessary */
-        if ( type & ftc_image_flag_no_sbits )
-          load_flags |= FT_LOAD_NO_BITMAP;
-      }
-      else
-      {
-        /* we want an outline, don't load embedded bitmaps */
-        load_flags |= FT_LOAD_NO_BITMAP;
 
-        if ( type & ftc_image_flag_unscaled )
-          load_flags |= FT_LOAD_NO_SCALE;
+        if ( !ftc_snode_load( snode, cache->manager,
+                              gindex, &size ) )
+        {
+          cache->manager->cur_weight += size;
+        }
       }
+    }
 
-      /* always render glyphs to bitmaps */
-      load_flags |= FT_LOAD_RENDER;
-
-      if ( type & ftc_image_flag_unhinted )
-        load_flags |= FT_LOAD_NO_HINTING;
-
-      if ( type & ftc_image_flag_autohinted )
-        load_flags |= FT_LOAD_FORCE_AUTOHINT;
+    return result;
+  }
 
-      type0.flags = load_flags;
-    }
 
-    return FTC_SBitCache_Lookup( (FTC_SBitCache)cache,
-                                  &type0,
-                                  gindex,
-                                  ansbit,
-                                  NULL );
+  FT_LOCAL_DEF( FT_Bool )
+  ftc_snode_compare( FTC_SNode   snode,
+                     FTC_GQuery  gquery,
+                     FTC_Cache   cache )
+  {
+    return FTC_SNode_Compare( snode, gquery, cache );
   }
 
 

reactos/lib/freetype/src/cache
rules.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- rules.mk	15 Feb 2004 21:45:33 -0000	1.4
+++ rules.mk	10 May 2004 17:48:31 -0000	1.5
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2000, 2001, 2003 by
+# Copyright 2000, 2001, 2003, 2004 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -25,8 +25,9 @@
 
 # Cache driver sources (i.e., C files)
 #
-CACHE_DRV_SRC := $(CACHE_DIR)/ftlru.c    \
+CACHE_DRV_SRC := $(CACHE_DIR)/ftcmru.c   \
                  $(CACHE_DIR)/ftcmanag.c \
+                 $(CACHE_DIR)/ftcbasic.c \
                  $(CACHE_DIR)/ftccache.c \
                  $(CACHE_DIR)/ftcglyph.c \
                  $(CACHE_DIR)/ftcsbits.c \
@@ -35,11 +36,13 @@
 
 # Cache driver headers
 #
-CACHE_DRV_H := $(CACHE_H_DIR)/ftlru.h    \
+CACHE_DRV_H := $(CACHE_H_DIR)/ftcmru.h   \
                $(CACHE_H_DIR)/ftcmanag.h \
                $(CACHE_H_DIR)/ftcglyph.h \
                $(CACHE_H_DIR)/ftcimage.h \
-               $(CACHE_DIR)/ftcerror.h
+               $(CACHE_H_DIR)/ftccmap.h  \
+               $(CACHE_DIR)/ftcerror.h   \
+               $(CACHE_DIR)/ftccback.h
 
 
 # Cache driver object(s)

reactos/lib/freetype/src/cache
ftccache.i removed after 1.1
diff -N ftccache.i
--- ftccache.i	1 Apr 2003 08:38:22 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,157 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftccache.i                                                             */
-/*                                                                         */
-/*    FreeType template for generic cache.                                 */
-/*                                                                         */
-/*  Copyright 2002 by                                                      */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef GEN_CACHE_FAMILY_COMPARE
-#error "GEN_CACHE_FAMILY_COMPARE not defined in template instantiation"
-#endif
-
-#ifndef GEN_CACHE_NODE_COMPARE
-#error "GEN_CACHE_NODE_COMPARE not defined in template instantiation"
-#endif
-
-
-  static FT_Error
-  GEN_CACHE_LOOKUP( FTC_Cache   cache,
-                    FTC_Query   query,
-                    FTC_Node   *anode )
-  {
-    FT_LruNode  lru;
-    FTC_Family  family;
-    FT_UFast    hash;
-
-
-    query->hash   = 0;
-    query->family = NULL;
-
-    /* XXX: we break encapsulation for the sake of speed! */
-    {
-      /* first of all, find the relevant family */
-      FT_LruList  list  = cache->families;
-      FT_LruNode  fam, *pfam;
-
-
-      pfam = &list->nodes;
-      for (;;)
-      {
-        fam = *pfam;
-        if ( fam == NULL )
-          goto Normal;
-
-        if ( GEN_CACHE_FAMILY_COMPARE( fam, query, list->data ) )
-          break;
-
-        pfam = &fam->next;
-      }
-
-      FT_ASSERT( fam != NULL );
-
-      /* move to top of list when needed */
-      if ( fam != list->nodes )
-      {
-        *pfam       = fam->next;
-        fam->next   = list->nodes;
-        list->nodes = fam;
-      }
-
-      lru = fam;
-    }
-
-    {
-      FTC_Node  node, *pnode, *bucket;
-
-
-      family = (FTC_Family)lru;
-      hash   = query->hash;
-
-      {
-        FT_UInt  idx;
-
-
-        idx = hash & cache->mask;
-        if ( idx < cache->p )
-          idx = hash & ( cache->mask * 2 + 1 );
-
-        bucket  = cache->buckets + idx;
-      }
-
-      pnode = bucket;
-
-      for ( ;; )
-      {
-        node = *pnode;
-        if ( node == NULL )
-          goto Normal;
-
-        if ( node->hash == hash                            &&
-             (FT_UInt)node->fam_index == family->fam_index &&
-             GEN_CACHE_NODE_COMPARE( node, query, cache )  )
-        {
-          /* we place the following out of the loop to make it */
-          /* as small as possible...                           */
-          goto Found;
-        }
-
-        pnode = &node->link;
-      }
-
-  Normal:
-      return ftc_cache_lookup( cache, query, anode );
-
-  Found:
-      /* move to head of bucket list */
-      if ( pnode != bucket )
-      {
-        *pnode     = node->link;
-        node->link = *bucket;
-        *bucket    = node;
-      }
-
-      /* move to head of MRU list */
-      if ( node != cache->manager->nodes_list )
-      {
-        /* XXX: again, this is an inlined version of ftc_node_mru_up */
-        FTC_Manager  manager = cache->manager;
-        FTC_Node     first   = manager->nodes_list;
-        FTC_Node     prev = node->mru_prev;
-        FTC_Node     next = node->mru_next;
-        FTC_Node     last;
-
-
-        prev->mru_next = next;
-        next->mru_prev = prev;
-
-        last            = first->mru_prev;
-        node->mru_next  = first;
-        node->mru_prev  = last;
-        first->mru_prev = node;
-        last->mru_next  = node;
-
-        manager->nodes_list = node;
-      }
-
-      *anode = node;
-      return 0;
-    }
-  }
-
-#undef GEN_CACHE_NODE_COMPARE
-#undef GEN_CACHE_FAMILY_COMPARE
-#undef GEN_CACHE_LOOKUP
-
-
-/* END */

reactos/lib/freetype/src/cache
ftlru.c removed after 1.3
diff -N ftlru.c
--- ftlru.c	21 Jan 2004 19:23:46 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,390 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftlru.c                                                                */
-/*                                                                         */
-/*    Simple LRU list-cache (body).                                        */
-/*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_INTERNAL_LRU_H
-#include FT_LIST_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-
-#include "ftcerror.h"
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_LruList_New( FT_LruList_Class  clazz,
-                  FT_UInt           max_nodes,
-                  FT_Pointer        user_data,
-                  FT_Memory         memory,
-                  FT_LruList       *alist )
-  {
-    FT_Error    error;
-    FT_LruList  list;
-
-
-    if ( !alist || !clazz )
-      return FTC_Err_Invalid_Argument;
-
-    *alist = NULL;
-    if ( !FT_ALLOC( list, clazz->list_size ) )
-    {
-      /* initialize common fields */
-      list->clazz      = clazz;
-      list->memory     = memory;
-      list->max_nodes  = max_nodes;
-      list->data       = user_data;
-
-      if ( clazz->list_init )
-      {
-        error = clazz->list_init( list );
-        if ( error )
-        {
-          if ( clazz->list_done )
-            clazz->list_done( list );
-
-          FT_FREE( list );
-        }
-      }
-
-      *alist = list;
-    }
-
-    return error;
-  }
-
-
-  FT_EXPORT_DEF( void )
-  FT_LruList_Destroy( FT_LruList  list )
-  {
-    FT_Memory         memory;
-    FT_LruList_Class  clazz;
-
-
-    if ( !list )
-      return;
-
-    memory = list->memory;
-    clazz  = list->clazz;
-
-    FT_LruList_Reset( list );
-
-    if ( clazz->list_done )
-      clazz->list_done( list );
-
-    FT_FREE( list );
-  }
-
-
-  FT_EXPORT_DEF( void )
-  FT_LruList_Reset( FT_LruList  list )
-  {
-    FT_LruNode        node;
-    FT_LruList_Class  clazz;
-    FT_Memory         memory;
-
-
-    if ( !list )
-      return;
-
-    node   = list->nodes;
-    clazz  = list->clazz;
-    memory = list->memory;
-
-    while ( node )
-    {
-      FT_LruNode  next = node->next;
-
-
-      if ( clazz->node_done )
-        clazz->node_done( node, list->data );
-
-      FT_FREE( node );
-      node = next;
-    }
-
-    list->nodes     = NULL;
-    list->num_nodes = 0;
-  }
-
-
-  FT_EXPORT_DEF( FT_Error )
-  FT_LruList_Lookup( FT_LruList   list,
-                     FT_LruKey    key,
-                     FT_LruNode  *anode )
-  {
-    FT_Error          error = 0;
-    FT_LruNode        node, *pnode;
-    FT_LruList_Class  clazz;
-    FT_LruNode        result = NULL;
-    FT_Memory         memory;
-
-
-    if ( !list || !key || !anode )
-      return FTC_Err_Invalid_Argument;
-
-    pnode  = &list->nodes;
-    node   = NULL;
-    clazz  = list->clazz;
-    memory = list->memory;
-
-    if ( clazz->node_compare )
-    {
-      for (;;)
-      {
-        node = *pnode;
-        if ( node == NULL )
-          break;
-
-        if ( clazz->node_compare( node, key, list->data ) )
-          break;
-
-        pnode = &(*pnode)->next;
-      }
-    }
-    else
-    {
-      for (;;)
-      {
-        node = *pnode;
-        if ( node == NULL )
-          break;
-
-        if ( node->key == key )
-          break;
-
-        pnode = &(*pnode)->next;
-      }
-    }
-
-    if ( node )
-    {
-      /* move element to top of list */
-      if ( list->nodes != node )
-      {
-        *pnode      = node->next;
-        node->next  = list->nodes;
-        list->nodes = node;
-      }
-      result = node;
-      goto Exit;
-    }
-
-   /* Since we haven't found the relevant element in our LRU list,
-    * we're going to "create" a new one.
-    *
-    * The following code is a bit special, because it tries to handle
-    * out-of-memory conditions (OOM) in an intelligent way.
-    *
-    * More precisely, if not enough memory is available to create a
-    * new node or "flush" an old one, we need to remove the oldest
-    * elements from our list, and try again.  Since several tries may
-    * be necessary, a loop is needed.
-    *
-    * This loop will only exit when:
-    *
-    *   - a new node was successfully created, or an old node flushed
-    *   - an error other than FTC_Err_Out_Of_Memory is detected
-    *   - the list of nodes is empty, and it isn't possible to create
-    *     new nodes
-    *
-    * On each unsuccessful attempt, one node will be removed from the list.
-    *
-    */
-    
-    {
-      FT_Int  drop_last = ( list->max_nodes > 0 && 
-                            list->num_nodes >= list->max_nodes );
-
-      for (;;)
-      {
-        node = NULL;
-
-        /* If "drop_last" is true, we should free the last node in
-         * the list to make room for a new one.  Note that we reuse
-         * its memory block to save allocation calls.
-         */
-        if ( drop_last )
-        {
-         /* find the last node in the list
-          */
-          pnode = &list->nodes;
-          node  = *pnode;
-  
-          if ( node == NULL )
-          {
-            FT_ASSERT( list->num_nodes == 0 );
-            error = FTC_Err_Out_Of_Memory;
-            goto Exit;
-          }
-
-          FT_ASSERT( list->num_nodes > 0 );
-
-          while ( node->next )
-          {
-            pnode = &node->next;
-            node  = *pnode;
-          }
-  
-          /* Remove it from the list, and try to "flush" it.  Doing this will
-           * save a significant number of dynamic allocations compared to
-           * a classic destroy/create cycle.
-           */
-          *pnode = NULL;
-          list->num_nodes--;
-  
-          if ( clazz->node_flush )
-          {
-            error = clazz->node_flush( node, key, list->data );
-            if ( !error )
-              goto Success;
-
-           /* Note that if an error occured during the flush, we need to
-            * finalize it since it is potentially in incomplete state.
-            */
-          }
-
-          /* We finalize, but do not destroy the last node, we
-           * simply reuse its memory block!
-           */
-          if ( clazz->node_done )
-            clazz->node_done( node, list->data );
-            
-          FT_MEM_ZERO( node, clazz->node_size );
-        }
-        else
-        {
-         /* Try to allocate a new node when "drop_last" is not TRUE.
-          * This usually happens on the first pass, when the LRU list
-          * is not already full.
-          */
-          if ( FT_ALLOC( node, clazz->node_size ) )
-            goto Fail;
-        }
-  
-        FT_ASSERT( node != NULL );
-
-        node->key = key;
-        error = clazz->node_init( node, key, list->data );
-        if ( error )
-        {
-          if ( clazz->node_done )
-            clazz->node_done( node, list->data );
-
-          FT_FREE( node );
-          goto Fail;
-        }
-
-      Success:
-        result = node;
-
-        node->next  = list->nodes;
-        list->nodes = node;
-        list->num_nodes++;
-        goto Exit;
-  
-      Fail:
-        if ( error != FTC_Err_Out_Of_Memory )
-          goto Exit;
-        
-        drop_last = 1;
-        continue;
-      }
-    }
-
-  Exit:
-    *anode = result;
-    return error;
-  }
-
-
-  FT_EXPORT_DEF( void )
-  FT_LruList_Remove( FT_LruList  list,
-                     FT_LruNode  node )
-  {
-    FT_LruNode  *pnode;
-
-
-    if ( !list || !node )
-      return;
-
-    pnode = &list->nodes;
-    for (;;)
-    {
-      if ( *pnode == node )
-      {
-        FT_Memory         memory = list->memory;
-        FT_LruList_Class  clazz  = list->clazz;
-
-
-        *pnode     = node->next;
-        node->next = NULL;
-
-        if ( clazz->node_done )
-          clazz->node_done( node, list->data );
-
-        FT_FREE( node );
-        list->num_nodes--;
-        break;
-      }
-
-      pnode = &(*pnode)->next;
-    }
-  }
-
-
-  FT_EXPORT_DEF( void )
-  FT_LruList_Remove_Selection( FT_LruList             list,
-                               FT_LruNode_SelectFunc  select_func,
-                               FT_Pointer             select_data )
-  {
-    FT_LruNode       *pnode, node;
-    FT_LruList_Class  clazz;
-    FT_Memory         memory;
-
-
-    if ( !list || !select_func )
-      return;
-
-    memory = list->memory;
-    clazz  = list->clazz;
-    pnode  = &list->nodes;
-
-    for (;;)
-    {
-      node = *pnode;
-      if ( node == NULL )
-        break;
-
-      if ( select_func( node, select_data, list->data ) )
-      {
-        *pnode     = node->next;
-        node->next = NULL;
-
-        if ( clazz->node_done )
-          clazz->node_done( node, list );
-
-        FT_FREE( node );
-        list->num_nodes--;
-      }
-      else
-        pnode = &(*pnode)->next;
-    }
-  }
-
-
-/* END */

reactos/lib/freetype/src/cff
cfftypes.h 1.2 -> 1.3
diff -N cfftypes.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cfftypes.h	10 May 2004 17:48:32 -0000	1.3
@@ -0,0 +1,255 @@
+/***************************************************************************/
+/*                                                                         */
+/*  cfftypes.h                                                             */
+/*                                                                         */
+/*    Basic OpenType/CFF type definitions and interface (specification     */
+/*    only).                                                               */
+/*                                                                         */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __CFFTYPES_H__
+#define __CFFTYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    CFF_IndexRec                                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    A structure used to model a CFF Index table.                       */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    stream      :: The source input stream.                            */
+  /*                                                                       */
+  /*    count       :: The number of elements in the index.                */
+  /*                                                                       */
+  /*    off_size    :: The size in bytes of object offsets in index.       */
+  /*                                                                       */
+  /*    data_offset :: The position of first data byte in the index's      */
+  /*                   bytes.                                              */
+  /*                                                                       */
+  /*    offsets     :: A table of element offsets in the index.            */
+  /*                                                                       */
+  /*    bytes       :: If the index is loaded in memory, its bytes.        */
+  /*                                                                       */
+  typedef struct  CFF_IndexRec_
+  {
+    FT_Stream  stream;
+    FT_UInt    count;
+    FT_Byte    off_size;
+    FT_ULong   data_offset;
+
+    FT_ULong*  offsets;
+    FT_Byte*   bytes;
+
+  } CFF_IndexRec, *CFF_Index;
+
+
+  typedef struct  CFF_EncodingRec_
+  {
+    FT_UInt     format;
+    FT_ULong    offset;
+
+    FT_UInt     count;
+    FT_UShort   sids [256];  /* avoid dynamic allocations */
+    FT_UShort   codes[256];
+
+  } CFF_EncodingRec, *CFF_Encoding;
+
+
+  typedef struct  CFF_CharsetRec_
+  {
+
+    FT_UInt     format;
+    FT_ULong    offset;
+
+    FT_UShort*  sids;
+    FT_UShort*  cids;       /* the inverse mapping of `sids'; only needed */
+                            /* for CID-keyed fonts                        */
+  } CFF_CharsetRec, *CFF_Charset;
+
+
+  typedef struct  CFF_FontRecDictRec_
+  {
+    FT_UInt    version;
+    FT_UInt    notice;
+    FT_UInt    copyright;
+    FT_UInt    full_name;
+    FT_UInt    family_name;
+    FT_UInt    weight;
+    FT_Bool    is_fixed_pitch;
+    FT_Fixed   italic_angle;
+    FT_Fixed   underline_position;
+    FT_Fixed   underline_thickness;
+    FT_Int     paint_type;
+    FT_Int     charstring_type;
+    FT_Matrix  font_matrix;
+    FT_UShort  units_per_em;
+    FT_Vector  font_offset;
+    FT_ULong   unique_id;
+    FT_BBox    font_bbox;
+    FT_Pos     stroke_width;
+    FT_ULong   charset_offset;
+    FT_ULong   encoding_offset;
+    FT_ULong   charstrings_offset;
+    FT_ULong   private_offset;
+    FT_ULong   private_size;
+    FT_Long    synthetic_base;
+    FT_UInt    embedded_postscript;
+
+    /* these should only be used for the top-level font dictionary */
+    FT_UInt    cid_registry;
+    FT_UInt    cid_ordering;
+    FT_ULong   cid_supplement;
+
+    FT_Long    cid_font_version;
+    FT_Long    cid_font_revision;
+    FT_Long    cid_font_type;
+    FT_ULong   cid_count;
+    FT_ULong   cid_uid_base;
+    FT_ULong   cid_fd_array_offset;
+    FT_ULong   cid_fd_select_offset;
+    FT_UInt    cid_font_name;
+
+  } CFF_FontRecDictRec, *CFF_FontRecDict;
+
+
+  typedef struct  CFF_PrivateRec_
+  {
+    FT_Byte   num_blue_values;
+    FT_Byte   num_other_blues;
+    FT_Byte   num_family_blues;
+    FT_Byte   num_family_other_blues;
+
+    FT_Pos    blue_values[14];
+    FT_Pos    other_blues[10];
+    FT_Pos    family_blues[14];
+    FT_Pos    family_other_blues[10];
+
+    FT_Fixed  blue_scale;
+    FT_Pos    blue_shift;
+    FT_Pos    blue_fuzz;
+    FT_Pos    standard_width;
+    FT_Pos    standard_height;
+
+    FT_Byte   num_snap_widths;
+    FT_Byte   num_snap_heights;
+    FT_Pos    snap_widths[13];
+    FT_Pos    snap_heights[13];
+    FT_Bool   force_bold;
+    FT_Fixed  force_bold_threshold;
+    FT_Int    lenIV;
+    FT_Int    language_group;
+    FT_Fixed  expansion_factor;
+    FT_Long   initial_random_seed;
+    FT_ULong  local_subrs_offset;
+    FT_Pos    default_width;
+    FT_Pos    nominal_width;
+
+  } CFF_PrivateRec, *CFF_Private;
+
+
+  typedef struct  CFF_FDSelectRec_
+  {
+    FT_Byte   format;
+    FT_UInt   range_count;
+
+    /* that's the table, taken from the file `as is' */
+    FT_Byte*  data;
+    FT_UInt   data_size;
+
+    /* small cache for format 3 only */
+    FT_UInt   cache_first;
+    FT_UInt   cache_count;
+    FT_Byte   cache_fd;
+
+  } CFF_FDSelectRec, *CFF_FDSelect;
+
+
+  /* A SubFont packs a font dict and a private dict together.  They are */
+  /* needed to support CID-keyed CFF fonts.                             */
+  typedef struct  CFF_SubFontRec_
+  {
+    CFF_FontRecDictRec  font_dict;
+    CFF_PrivateRec      private_dict;
+
+    CFF_IndexRec        local_subrs_index;
+    FT_UInt             num_local_subrs;
+    FT_Byte**           local_subrs;
+
+  } CFF_SubFontRec, *CFF_SubFont;
+
+
+  /* maximum number of sub-fonts in a CID-keyed file */
+#define CFF_MAX_CID_FONTS  32
+
+
+  typedef struct  CFF_FontRec_
+  {
+    FT_Stream        stream;
+    FT_Memory        memory;
+    FT_UInt          num_faces;
+    FT_UInt          num_glyphs;
+
+    FT_Byte          version_major;
+    FT_Byte          version_minor;
+    FT_Byte          header_size;
+    FT_Byte          absolute_offsize;
+
+
+    CFF_IndexRec     name_index;
+    CFF_IndexRec     top_dict_index;
+    CFF_IndexRec     string_index;
+    CFF_IndexRec     global_subrs_index;
+
+    CFF_EncodingRec  encoding;
+    CFF_CharsetRec   charset;
+
+    CFF_IndexRec     charstrings_index;
+    CFF_IndexRec     font_dict_index;
+    CFF_IndexRec     private_index;
+    CFF_IndexRec     local_subrs_index;
+
+    FT_String*       font_name;
+    FT_UInt          num_global_subrs;
+    FT_Byte**        global_subrs;
+
+    CFF_SubFontRec   top_font;
+    FT_UInt          num_subfonts;
+    CFF_SubFont      subfonts[CFF_MAX_CID_FONTS];
+
+    CFF_FDSelectRec  fd_select;
+
+    /* interface to PostScript hinter */
+    void*            pshinter;
+
+    /* interface to Postscript Names service */
+    void*            psnames;
+
+  } CFF_FontRec, *CFF_Font;
+
+
+FT_END_HEADER
+
+#endif /* __CFFTYPES_H__ */
+
+
+/* END */

reactos/lib/freetype/src/cff
Jamfile 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Jamfile	15 Feb 2004 21:45:33 -0000	1.3
+++ Jamfile	10 May 2004 17:48:32 -0000	1.4
@@ -1,4 +1,4 @@
-# FreeType 2 src/cff Jamfile (c) 2001 David Turner
+# FreeType 2 src/cff Jamfile (c) 2001, 2002 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) cff ;

reactos/lib/freetype/src/cff
cff.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cff.c	15 Feb 2004 21:45:33 -0000	1.3
+++ cff.c	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType OpenType driver component (body only).                      */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */

reactos/lib/freetype/src/cff
cffcmap.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cffcmap.c	15 Feb 2004 21:45:33 -0000	1.4
+++ cffcmap.c	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF character mapping table (cmap) support (body).                   */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,8 @@
 #include "cffcmap.h"
 #include "cffload.h"
 
+#include "cfferrs.h"
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -37,7 +39,7 @@
 
 
     cmap->gids  = encoding->codes;
-    
+
     return 0;
   }
 
@@ -58,7 +60,7 @@
 
     if ( char_code < 256 )
       result = cmap->gids[char_code];
-    
+
     return result;
   }
 
@@ -69,27 +71,27 @@
   {
     FT_UInt    result    = 0;
     FT_UInt32  char_code = *pchar_code;
-    
+
 
     *pchar_code = 0;
 
     if ( char_code < 255 )
     {
       FT_UInt  code = (FT_UInt)(char_code + 1);
-      
+
 
       for (;;)
       {
         if ( code >= 256 )
           break;
-          
+
         result = cmap->gids[code];
         if ( result != 0 )
         {
           *pchar_code = code;
           break;
         }
-          
+
         code++;
       }
     }
@@ -123,34 +125,34 @@
   {
     FT_UInt32  u1 = ((CFF_CMapUniPair)pair1)->unicode;
     FT_UInt32  u2 = ((CFF_CMapUniPair)pair2)->unicode;
-    
+
 
     if ( u1 < u2 )
       return -1;
-      
+
     if ( u1 > u2 )
       return +1;
-      
+
     return 0;
-  }                            
+  }
 
 
   FT_CALLBACK_DEF( FT_Error )
   cff_cmap_unicode_init( CFF_CMapUnicode  cmap )
   {
-    FT_Error         error;
-    FT_UInt          count;
-    TT_Face          face    = (TT_Face)FT_CMAP_FACE( cmap );
-    FT_Memory        memory  = FT_FACE_MEMORY( face );
-    CFF_Font         cff     = (CFF_Font)face->extra.data;
-    CFF_Charset      charset = &cff->charset;
-    PSNames_Service  psnames = (PSNames_Service)cff->psnames;
+    FT_Error            error;
+    FT_UInt             count;
+    TT_Face             face    = (TT_Face)FT_CMAP_FACE( cmap );
+    FT_Memory           memory  = FT_FACE_MEMORY( face );
+    CFF_Font            cff     = (CFF_Font)face->extra.data;
+    CFF_Charset         charset = &cff->charset;
+    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;
 
 
     cmap->num_pairs = 0;
     cmap->pairs     = NULL;
 
-    count = (FT_UInt)face->root.num_glyphs;
+    count = cff->num_glyphs;
 
     if ( !FT_NEW_ARRAY( cmap->pairs, count ) )
     {
@@ -167,7 +169,7 @@
 
 
         gname = cff_index_get_sid_string( &cff->string_index, sid, psnames );
-         
+
         /* build unsorted pair table by matching glyph names */
         if ( gname )
         {
@@ -179,7 +181,7 @@
             pair->gindex  = n;
             pair++;
           }
-          
+
           FT_FREE( gname );
         }
       }
@@ -198,7 +200,7 @@
         if ( new_count != count && new_count < count / 2 )
         {
           (void)FT_RENEW_ARRAY( cmap->pairs, count, new_count );
-          error = 0;
+          error = CFF_Err_Ok;
         }
 
         /* sort the pairs table to allow efficient binary searches */
@@ -221,7 +223,7 @@
     FT_Face    face   = FT_CMAP_FACE( cmap );
     FT_Memory  memory = FT_FACE_MEMORY( face );
 
- 
+
     FT_FREE( cmap->pairs );
     cmap->num_pairs = 0;
   }

reactos/lib/freetype/src/cff
cffdrivr.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cffdrivr.c	15 Feb 2004 21:45:33 -0000	1.4
+++ cffdrivr.c	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,14 +22,19 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_TRUETYPE_IDS_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_TT_CMAP_H
 
 #include "cffdrivr.h"
 #include "cffgload.h"
 #include "cffload.h"
+#include "cffcmap.h"
 
 #include "cfferrs.h"
 
+#include FT_SERVICE_XFREE86_NAME_H
+#include FT_SERVICE_GLYPH_DICT_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -196,7 +201,7 @@
     if ( size )
     {
       /* these two object must have the same parent */
-      if ( size->face != slot->root.face )
+      if ( size->root.face != slot->root.face )
         return CFF_Err_Invalid_Face_Handle;
     }
 
@@ -210,17 +215,10 @@
   }
 
 
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /****             C H A R A C T E R   M A P P I N G S                 ****/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
+ /*
+  *  GLYPH DICT SERVICE
+  *
+  */
 
   static FT_Error
   cff_get_glyph_name( CFF_Face    face,
@@ -228,21 +226,19 @@
                       FT_Pointer  buffer,
                       FT_UInt     buffer_max )
   {
-    CFF_Font         font   = (CFF_Font)face->extra.data;
-    FT_Memory        memory = FT_FACE_MEMORY( face );
-    FT_String*       gname;
-    FT_UShort        sid;
-    PSNames_Service  psnames;
-    FT_Error         error;
-
+    CFF_Font            font   = (CFF_Font)face->extra.data;
+    FT_Memory           memory = FT_FACE_MEMORY( face );
+    FT_String*          gname;
+    FT_UShort           sid;
+    FT_Service_PsCMaps  psnames;
+    FT_Error            error;
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
 
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
     if ( !psnames )
     {
       FT_ERROR(( "cff_get_glyph_name:" ));
-      FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
+      FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" ));
       FT_ERROR(( "                   " ));
       FT_ERROR(( " without the `PSNames' module\n" ));
       error = CFF_Err_Unknown_File_Format;
@@ -275,42 +271,26 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    cff_get_name_index                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Uses the psnames module and the CFF font's charset to to return a  */
-  /*    a given glyph name's glyph index.                                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face       :: A handle to the source face object.                  */
-  /*                                                                       */
-  /*    glyph_name :: The glyph name.                                      */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index.  0 means `undefined character code'.                  */
-  /*                                                                       */
   static FT_UInt
   cff_get_name_index( CFF_Face    face,
                       FT_String*  glyph_name )
   {
-    CFF_Font         cff;
-    CFF_Charset      charset;
-    PSNames_Service  psnames;
-    FT_Memory        memory = FT_FACE_MEMORY( face );
-    FT_String*       name;
-    FT_UShort        sid;
-    FT_UInt          i;
-    FT_Int           result;
+    CFF_Font            cff;
+    CFF_Charset         charset;
+    FT_Service_PsCMaps  psnames;
+    FT_Memory           memory = FT_FACE_MEMORY( face );
+    FT_String*          name;
+    FT_UShort           sid;
+    FT_UInt             i;
+    FT_Int              result;
 
 
     cff     = (CFF_FontRec *)face->extra.data;
     charset = &cff->charset;
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
+    if ( !psnames )
+      return 0;
 
     for ( i = 0; i < cff->num_glyphs; i++ )
     {
@@ -334,6 +314,77 @@
   }
 
 
+  static const FT_Service_GlyphDictRec  cff_service_glyph_dict =
+  {
+    (FT_GlyphDict_GetNameFunc)  cff_get_glyph_name,
+    (FT_GlyphDict_NameIndexFunc)cff_get_name_index,
+  };
+
+
+ /*
+  *  POSTSCRIPT INFO SERVICE
+  *
+  */
+
+  static FT_Int
+  cff_ps_has_glyph_names( FT_Face  face )
+  {
+    return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
+  }
+
+
+  static const FT_Service_PsInfoRec  cff_service_ps_info =
+  {
+    (PS_GetFontInfoFunc)  NULL,         /* unsupported with CFF fonts */
+    (PS_HasGlyphNamesFunc)cff_ps_has_glyph_names
+  };
+
+
+  /*
+   * TT CMAP INFO
+   *
+   * If the charmap is a synthetic Unicode encoding cmap or 
+   * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO 
+   * service defined in SFNT module.
+   *
+   * Otherwise call the service function in the sfnt module.
+   *
+   */
+  static FT_Error
+  cff_get_cmap_info( FT_CharMap    charmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_CMap   cmap  = FT_CMAP( charmap );
+    FT_Error  error = CFF_Err_Ok;
+
+
+    cmap_info->language = 0;
+
+    if ( cmap->clazz != &cff_cmap_encoding_class_rec && 
+         cmap->clazz != &cff_cmap_unicode_class_rec  )
+    {
+      FT_Face             face    = FT_CMAP_FACE( cmap );
+      FT_Library          library = FT_FACE_LIBRARY( face );
+      FT_Module           sfnt    = FT_Get_Module( library, "sfnt" );
+      FT_Service_TTCMaps  service =
+        (FT_Service_TTCMaps)ft_module_get_service( sfnt,
+                                                   FT_SERVICE_ID_TT_CMAP );
+
+
+      if ( service && service->get_cmap_info )
+        error = service->get_cmap_info( charmap, cmap_info );
+    }
+
+    return error;
+  }
+
+
+  static const FT_Service_TTCMapsRec  cff_service_get_cmap_info =
+  {
+    (TT_CMap_Info_GetFunc)cff_get_cmap_info
+  };
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
@@ -346,24 +397,31 @@
   /*************************************************************************/
   /*************************************************************************/
 
+  static const FT_ServiceDescRec  cff_services[] =
+  {
+    { FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_CFF },
+    { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info },
+#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
+    { FT_SERVICE_ID_GLYPH_DICT,      &cff_service_glyph_dict },
+#endif
+    { FT_SERVICE_ID_TT_CMAP,         &cff_service_get_cmap_info },
+    { NULL, NULL }
+  };
+
+
   static FT_Module_Interface
   cff_get_interface( CFF_Driver   driver,
                      const char*  module_interface )
   {
-    FT_Module  sfnt;
-
+    FT_Module            sfnt;
+    FT_Module_Interface  result;
 
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
-
-    if ( ft_strcmp( (const char*)module_interface, "glyph_name" ) == 0 )
-      return (FT_Module_Interface)cff_get_glyph_name;
 
-    if ( ft_strcmp( (const char*)module_interface, "name_index" ) == 0 )
-      return (FT_Module_Interface)cff_get_name_index;
-
-#endif
+    result = ft_service_list_lookup( cff_services, module_interface );
+    if ( result != NULL )
+      return  result;
 
-    /* we simply pass our request to the `sfnt' module */
+    /* we pass our request to the `sfnt' module */
     sfnt = FT_Get_Module( driver->root.root.library, "sfnt" );
 
     return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
@@ -395,7 +453,7 @@
 
     /* now the specific driver fields */
     sizeof( TT_FaceRec ),
-    sizeof( FT_SizeRec ),
+    sizeof( CFF_SizeRec ),
     sizeof( CFF_GlyphSlotRec ),
 
     (FT_Face_InitFunc)       cff_face_init,

reactos/lib/freetype/src/cff
cffgload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- cffgload.c	15 Feb 2004 21:45:33 -0000	1.5
+++ cffgload.c	10 May 2004 17:48:32 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -251,15 +251,15 @@
 
       if ( hinting && size )
       {
-        builder->hints_globals = size->internal;
+        builder->hints_globals = size->root.internal;
         builder->hints_funcs   = glyph->root.internal->glyph_hints;
       }
     }
 
     if ( size )
     {
-      builder->scale_x = size->metrics.x_scale;
-      builder->scale_y = size->metrics.y_scale;
+      builder->scale_x = size->root.metrics.x_scale;
+      builder->scale_y = size->root.metrics.y_scale;
     }
 
     builder->pos_x = 0;
@@ -366,7 +366,7 @@
     decoder->num_globals  = cff->num_global_subrs;
     decoder->globals      = cff->global_subrs;
     decoder->globals_bias = cff_compute_bias( decoder->num_globals );
-    
+
     decoder->hint_mode    = hint_mode;
   }
 
@@ -398,7 +398,7 @@
   }
 
 
-  /* check that there is enough room for `count' more points */
+  /* check that there is enough space for `count' more points */
   static FT_Error
   check_points( CFF_Builder*  builder,
                 FT_Int        count )
@@ -451,7 +451,7 @@
   }
 
 
-  /* check room for a new contour, then add it */
+  /* check space for a new contour, then add it */
   static FT_Error
   cff_builder_add_contour( CFF_Builder*  builder )
   {
@@ -485,7 +485,7 @@
                            FT_Pos        x,
                            FT_Pos        y )
   {
-    FT_Error  error = 0;
+    FT_Error  error = CFF_Err_Ok;
 
 
     /* test whether we are building a new contour */
@@ -545,6 +545,10 @@
     FT_UShort  glyph_sid;
 
 
+    /* CID-keyed fonts don't have glyph names */
+    if ( !cff->charset.sids )
+      return -1;
+
     /* check range of standard char code */
     if ( charcode < 0 || charcode > 255 )
       return -1;
@@ -640,13 +644,13 @@
                      FT_Int        bchar,
                      FT_Int        achar )
   {
-    FT_Error     error;
-    FT_Int       bchar_index, achar_index, n_base_points;
-    FT_Outline*  base = decoder->builder.base;
-    TT_Face      face = decoder->builder.face;
-    FT_Vector    left_bearing, advance;
-    FT_Byte*     charstring;
-    FT_ULong     charstring_len;
+    FT_Error      error;
+    CFF_Builder*  builder = &decoder->builder;
+    FT_Int        bchar_index, achar_index;
+    TT_Face       face = decoder->builder.face;
+    FT_Vector     left_bearing, advance;
+    FT_Byte*      charstring;
+    FT_ULong      charstring_len;
 
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -676,9 +680,9 @@
 
     /* If we are trying to load a composite glyph, do not load the */
     /* accent character and return the array of subglyphs.         */
-    if ( decoder->builder.no_recurse )
+    if ( builder->no_recurse )
     {
-      FT_GlyphSlot    glyph  = (FT_GlyphSlot)decoder->builder.glyph;
+      FT_GlyphSlot    glyph  = (FT_GlyphSlot)builder->glyph;
       FT_GlyphLoader  loader = glyph->internal->loader;
       FT_SubGlyph     subg;
 
@@ -701,8 +705,8 @@
       /* subglyph 1 = accent character */
       subg->index = achar_index;
       subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
-      subg->arg1  = (FT_Int)adx;
-      subg->arg2  = (FT_Int)ady;
+      subg->arg1  = (FT_Int)( adx >> 16 );
+      subg->arg2  = (FT_Int)( ady >> 16 );
 
       /* set up remaining glyph fields */
       glyph->num_subglyphs = 2;
@@ -712,6 +716,8 @@
       loader->current.num_subglyphs = 2;
     }
 
+    FT_GlyphLoader_Prepare( builder->loader );
+
     /* First load `bchar' in builder */
     error = cff_get_glyph_data( face, bchar_index,
                                 &charstring, &charstring_len );
@@ -726,16 +732,17 @@
       cff_free_glyph_data( face, &charstring, charstring_len );
     }
 
-    n_base_points = base->n_points;
-
     /* Save the left bearing and width of the base character */
     /* as they will be erased by the next load.              */
 
-    left_bearing = decoder->builder.left_bearing;
-    advance      = decoder->builder.advance;
+    left_bearing = builder->left_bearing;
+    advance      = builder->advance;
 
-    decoder->builder.left_bearing.x = 0;
-    decoder->builder.left_bearing.y = 0;
+    builder->left_bearing.x = 0;
+    builder->left_bearing.y = 0;
+
+    builder->pos_x = adx;
+    builder->pos_y = ady;
 
     /* Now load `achar' on top of the base outline. */
     error = cff_get_glyph_data( face, achar_index,
@@ -753,20 +760,11 @@
 
     /* Restore the left side bearing and advance width */
     /* of the base character.                          */
-    decoder->builder.left_bearing = left_bearing;
-    decoder->builder.advance      = advance;
-
-    /* Finally, move the accent. */
-    if ( decoder->builder.load_points )
-    {
-      FT_Outline  dummy;
-
+    builder->left_bearing = left_bearing;
+    builder->advance      = advance;
 
-      dummy.n_points = (short)( base->n_points - n_base_points );
-      dummy.points   = base->points   + n_base_points;
-
-      FT_Outline_Translate( &dummy, adx, ady );
-    }
+    builder->pos_x = 0;
+    builder->pos_y = 0;
 
   Exit:
     return error;
@@ -903,7 +901,7 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
         if ( !( val & 0xFFFFL ) )
-          FT_TRACE4(( " %d", (FT_Int32)( val >> 16 ) ));
+          FT_TRACE4(( " %ld", (FT_Int32)( val >> 16 ) ));
         else
           FT_TRACE4(( " %.2f", val / 65536.0 ));
 #endif
@@ -1110,7 +1108,7 @@
             /* `glyph_width' to `nominal_width' plus number on the stack   */
             /* -- for either case.                                         */
 
-            FT_Int set_width_ok;
+            FT_Int  set_width_ok;
 
 
             switch ( op )
@@ -1125,6 +1123,8 @@
             case cff_op_hstemhm:
             case cff_op_vstemhm:
             case cff_op_rmoveto:
+            case cff_op_hintmask:
+            case cff_op_cntrmask:
               set_width_ok = num_args & 1;
               break;
 
@@ -1223,7 +1223,7 @@
             for ( maskbyte = 0;
                   maskbyte < (FT_UInt)(( decoder->num_hints + 7 ) >> 3);
                   maskbyte++, ip++ )
-              FT_TRACE4(( "%02X", *ip ));
+              FT_TRACE4(( "0x%02X", *ip ));
           }
 #else
           ip += ( decoder->num_hints + 7 ) >> 3;
@@ -1649,11 +1649,11 @@
 
         case cff_op_flex1:
           {
-            FT_Pos  start_x, start_y; /* record start x, y values for alter */
-                                      /* use                                */
-            FT_Int  dx = 0, dy = 0;   /* used in horizontal/vertical        */
-                                      /* algorithm below                    */
-            FT_Int  horizontal, count;
+            FT_Pos    start_x, start_y; /* record start x, y values for */
+                                        /* alter use                                */
+            FT_Fixed  dx = 0, dy = 0;   /* used in horizontal/vertical  */
+                                        /* algorithm below              */
+            FT_Int    horizontal, count;
 
 
             FT_TRACE4(( " flex1" ));
@@ -1675,8 +1675,8 @@
             /* grab up to the last argument */
             for ( count = 5; count > 0; count-- )
             {
-              dx += (FT_Int)args[0];
-              dy += (FT_Int)args[1];
+              dx += args[0];
+              dy += args[1];
               args += 2;
             }
 
@@ -1732,7 +1732,7 @@
               x += args[0];
               y += args[1];
               cff_builder_add_point( builder, x, y,
-                                     (FT_Bool)( count == 3 || count == 0 ) );
+                                     (FT_Bool)( count == 4 || count == 1 ) );
               args += 2;
             }
 
@@ -1746,35 +1746,43 @@
           /* We are going to emulate the seac operator. */
           if ( num_args == 4 )
           {
+            /* Save glyph width so that the subglyphs don't overwrite it. */
+            FT_Pos  glyph_width = decoder->glyph_width;
+
+
             error = cff_operator_seac( decoder,
-                                       args[0] >> 16,
-                                       args[1] >> 16,
+                                       args[0],
+                                       args[1],
                                        (FT_Int)( args[2] >> 16 ),
                                        (FT_Int)( args[3] >> 16 ) );
             args += 4;
+
+            decoder->glyph_width = glyph_width;
           }
+          else
+          {
+            if ( !error )
+              error = CFF_Err_Ok;
 
-          if ( !error )
-            error = CFF_Err_Ok;
+            cff_builder_close_contour( builder );
 
-          cff_builder_close_contour( builder );
+            /* close hints recording session */
+            if ( hinter )
+            {
+              if (hinter->close( hinter->hints, builder->current->n_points ) )
+                goto Syntax_Error;
 
-          /* close hints recording session */
-          if ( hinter )
-          {
-            if (hinter->close( hinter->hints, builder->current->n_points ) )
-              goto Syntax_Error;
+              /* apply hints to the loaded glyph outline now */
+              hinter->apply( hinter->hints,
+                             builder->current,
+                             (PSH_Globals)builder->hints_globals,
+                             decoder->hint_mode );
+            }
 
-            /* apply hints to the loaded glyph outline now */
-            hinter->apply( hinter->hints,
-                           builder->current,
-                           (PSH_Globals)builder->hints_globals,
-                           decoder->hint_mode );
+            /* add current outline to the glyph slot */
+            FT_GlyphLoader_Add( builder->loader );
           }
 
-          /* add current outline to the glyph slot */
-          FT_GlyphLoader_Add( builder->loader );
-
           /* return now! */
           FT_TRACE4(( "\n\n" ));
           return error;
@@ -2211,7 +2219,7 @@
   cff_compute_max_advance( TT_Face  face,
                            FT_Int*  max_advance )
   {
-    FT_Error     error = 0;
+    FT_Error     error = CFF_Err_Ok;
     CFF_Decoder  decoder;
     FT_Int       glyph_index;
     CFF_Font     cff = (CFF_Font)face->other;
@@ -2247,7 +2255,7 @@
       }
 
       /* ignore the error if one has occurred -- skip to next glyph */
-      error = 0;
+      error = CFF_Err_Ok;
     }
 
     *max_advance = decoder.builder.advance.x;
@@ -2281,14 +2289,14 @@
                  FT_Int         glyph_index,
                  FT_Int32       load_flags )
   {
-    FT_Error     error;
-    CFF_Decoder  decoder;
-    TT_Face      face = (TT_Face)glyph->root.face;
-    FT_Bool      hinting;
-    CFF_Font     cff = (CFF_Font)face->extra.data;
+    FT_Error      error;
+    CFF_Decoder   decoder;
+    TT_Face       face     = (TT_Face)glyph->root.face;
+    FT_Bool       hinting;
+    CFF_Font      cff      = (CFF_Font)face->extra.data;
 
-    FT_Matrix    font_matrix;
-    FT_Vector    font_offset;
+    FT_Matrix     font_matrix;
+    FT_Vector     font_offset;
 
 
     if ( load_flags & FT_LOAD_NO_RECURSE )
@@ -2298,10 +2306,77 @@
     glyph->y_scale = 0x10000L;
     if ( size )
     {
-      glyph->x_scale = size->metrics.x_scale;
-      glyph->y_scale = size->metrics.y_scale;
+      glyph->x_scale = size->root.metrics.x_scale;
+      glyph->y_scale = size->root.metrics.y_scale;
+    }
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+    /* try to load embedded bitmap if any              */
+    /*                                                 */
+    /* XXX: The convention should be emphasized in     */
+    /*      the documents because it can be confusing. */
+    if ( size )
+    {
+      CFF_Face      cff_face = (CFF_Face)size->root.face;
+      SFNT_Service  sfnt     = (SFNT_Service)cff_face->sfnt;
+      FT_Stream     stream   = cff_face->root.stream;
+
+
+      if ( size->strike_index != 0xFFFFU           &&
+           sfnt->load_sbits                        &&
+           ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
+      {
+        TT_SBit_MetricsRec  metrics;
+
+
+        error = sfnt->load_sbit_image( face,
+                                       (FT_ULong)size->strike_index,
+                                       (FT_UInt)glyph_index,
+                                       (FT_Int)load_flags,
+                                       stream,
+                                       &glyph->root.bitmap,
+                                       &metrics );
+
+        if ( !error )
+        {
+          glyph->root.outline.n_points   = 0;
+          glyph->root.outline.n_contours = 0;
+
+          glyph->root.metrics.width  = (FT_Pos)metrics.width  << 6;
+          glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
+
+          glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
+          glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
+          glyph->root.metrics.horiAdvance  = (FT_Pos)metrics.horiAdvance  << 6;
+
+          glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
+          glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
+          glyph->root.metrics.vertAdvance  = (FT_Pos)metrics.vertAdvance  << 6;
+
+          glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
+
+          if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
+          {
+            glyph->root.bitmap_left = metrics.vertBearingX;
+            glyph->root.bitmap_top  = metrics.vertBearingY;
+          }
+          else
+          {
+            glyph->root.bitmap_left = metrics.horiBearingX;
+            glyph->root.bitmap_top  = metrics.horiBearingY;
+          }
+          return error;
+        }
+      }
     }
 
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+    /* return immediately if we only want the embedded bitmaps */
+    if ( load_flags & FT_LOAD_SBITS_ONLY )
+      return CFF_Err_Invalid_Argument;
+
     glyph->root.outline.n_points   = 0;
     glyph->root.outline.n_contours = 0;
 
@@ -2315,8 +2390,15 @@
       FT_ULong  charstring_len;
 
 
+      /* in a CID-keyed font, consider `glyph_index' as a CID and map */
+      /* it immediately to the real glyph_index -- if it isn't a      */
+      /* subsetted font, glyph_indices and CIDs are identical, though */
+      if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
+           cff->charset.cids )
+        glyph_index = cff->charset.cids[glyph_index];
+
       cff_decoder_init( &decoder, face, size, glyph, hinting,
-                        FT_LOAD_TARGET_MODE(load_flags) );
+                        FT_LOAD_TARGET_MODE( load_flags ) );
 
       decoder.builder.no_recurse =
         (FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
@@ -2362,7 +2444,7 @@
       cff_builder_done( &decoder.builder );
     }
 
- #ifdef FT_CONFIG_OPTION_INCREMENTAL
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
     if ( !error                                                              &&
@@ -2429,7 +2511,7 @@
         glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
 
         glyph->root.outline.flags = 0;
-        if ( size && size->metrics.y_ppem < 24 )
+        if ( size && size->root.metrics.y_ppem < 24 )
           glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
         glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
@@ -2479,11 +2561,11 @@
 
           if ( hinting )
           {
-            metrics->horiAdvance  = ( metrics->horiAdvance + 32 ) & -64;
-            metrics->vertAdvance  = ( metrics->vertAdvance + 32 ) & -64;
+            metrics->horiAdvance  = FT_PIX_ROUND( metrics->horiAdvance );
+            metrics->vertAdvance  = FT_PIX_ROUND( metrics->vertAdvance );
 
-            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;
-            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;
+            metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
+            metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
           }
         }
 

reactos/lib/freetype/src/cff
cffload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- cffload.c	15 Feb 2004 21:45:33 -0000	1.5
+++ cffload.c	10 May 2004 17:48:32 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType and CFF data/program tables loader (body).                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,7 +20,7 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_TRUETYPE_TAGS_H
 
 #include "cffload.h"
@@ -1172,12 +1172,12 @@
   }
 
 
- /* allocate a table containing pointers to an index's elements */
+  /* allocate a table containing pointers to an index's elements */
   static FT_Error
   cff_index_get_pointers( CFF_Index   idx,
                           FT_Byte***  table )
   {
-    FT_Error   error  = 0;
+    FT_Error   error  = CFF_Err_Ok;
     FT_Memory  memory = idx->stream->memory;
     FT_ULong   n, offset, old_offset;
     FT_Byte**  t;
@@ -1211,7 +1211,7 @@
                             FT_Byte**  pbytes,
                             FT_ULong*  pbyte_len )
   {
-    FT_Error  error = 0;
+    FT_Error  error = CFF_Err_Ok;
 
 
     if ( idx && idx->count > element )
@@ -1312,18 +1312,26 @@
 
 
   FT_LOCAL_DEF( FT_String* )
-  cff_index_get_sid_string( CFF_Index        idx,
-                            FT_UInt          sid,
-                            PSNames_Service  psnames_service )
-  {
+  cff_index_get_sid_string( CFF_Index           idx,
+                            FT_UInt             sid,
+                            FT_Service_PsCMaps  psnames )
+  {
+    /* value 0xFFFFU indicates a missing dictionary entry */
+    if ( sid == 0xFFFFU )
+      return 0;
+
     /* if it is not a standard string, return it */
     if ( sid > 390 )
       return cff_index_get_name( idx, sid - 391 );
 
+    /* CID-keyed CFF fonts don't have glyph names */
+    if ( !psnames )
+      return 0;
+
     /* that's a standard string, fetch a copy from the PSName module */
     {
       FT_String*   name       = 0;
-      const char*  adobe_name = psnames_service->adobe_std_strings( sid );
+      const char*  adobe_name = psnames->adobe_std_strings( sid );
       FT_UInt      len;
 
 
@@ -1493,6 +1501,7 @@
 
 
     FT_FREE( charset->sids );
+    FT_FREE( charset->cids );
     charset->format = 0;
     charset->offset = 0;
   }
@@ -1503,10 +1512,11 @@
                     FT_UInt      num_glyphs,
                     FT_Stream    stream,
                     FT_ULong     base_offset,
-                    FT_ULong     offset )
+                    FT_ULong     offset,
+                    FT_Bool      invert )
   {
     FT_Memory  memory = stream->memory;
-    FT_Error   error  = 0;
+    FT_Error   error  = CFF_Err_Ok;
     FT_UShort  glyph_sid;
 
 
@@ -1603,8 +1613,8 @@
       case 0:
         if ( num_glyphs > 229 )
         {
-          FT_ERROR(("cff_charset_load: implicit charset larger than\n"
-                    "predefined charset (Adobe ISO-Latin)!\n" ));
+          FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
+                     "predefined charset (Adobe ISO-Latin)!\n" ));
           error = CFF_Err_Invalid_File_Format;
           goto Exit;
         }
@@ -1614,8 +1624,7 @@
           goto Exit;
 
         /* Copy the predefined charset into the allocated memory. */
-        FT_MEM_COPY( charset->sids, cff_isoadobe_charset,
-                     num_glyphs * sizeof ( FT_UShort ) );
+        FT_ARRAY_COPY( charset->sids, cff_isoadobe_charset, num_glyphs );
 
         break;
 
@@ -1633,8 +1642,7 @@
           goto Exit;
 
         /* Copy the predefined charset into the allocated memory.     */
-        FT_MEM_COPY( charset->sids, cff_expert_charset,
-                     num_glyphs * sizeof ( FT_UShort ) );
+        FT_ARRAY_COPY( charset->sids, cff_expert_charset, num_glyphs );
 
         break;
 
@@ -1652,8 +1660,7 @@
           goto Exit;
 
         /* Copy the predefined charset into the allocated memory.     */
-        FT_MEM_COPY( charset->sids, cff_expertsubset_charset,
-                     num_glyphs * sizeof ( FT_UShort ) );
+        FT_ARRAY_COPY( charset->sids, cff_expertsubset_charset, num_glyphs );
 
         break;
 
@@ -1663,17 +1670,36 @@
       }
     }
 
-  Exit:
+    /* we have to invert the `sids' array for subsetted CID-keyed fonts */
+    if ( invert )
+    {
+      FT_UInt    i;
+      FT_UShort  max_cid = 0;
 
+
+      for ( i = 0; i < num_glyphs; i++ )
+        if ( charset->sids[i] > max_cid )
+          max_cid = charset->sids[i];
+      max_cid++;
+
+      if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
+        goto Exit;
+      FT_MEM_ZERO( charset->cids, sizeof ( FT_UShort ) * max_cid );
+
+      for ( i = 0; i < num_glyphs; i++ )
+        charset->cids[charset->sids[i]] = i;
+    }
+
+  Exit:
     /* Clean up if there was an error. */
     if ( error )
-      if ( charset->sids )
-      {
-        FT_FREE( charset->sids );
-        charset->format = 0;
-        charset->offset = 0;
-        charset->sids   = 0;
-      }
+    {
+      FT_FREE( charset->sids );
+      FT_FREE( charset->cids );
+      charset->format = 0;
+      charset->offset = 0;
+      charset->sids   = 0;
+    }
 
     return error;
   }
@@ -1696,7 +1722,7 @@
                      FT_ULong      base_offset,
                      FT_ULong      offset )
   {
-    FT_Error   error = 0;
+    FT_Error   error = CFF_Err_Ok;
     FT_UInt    count;
     FT_UInt    j;
     FT_UShort  glyph_sid;
@@ -1880,15 +1906,12 @@
       {
       case 0:
         /* First, copy the code to SID mapping. */
-        FT_MEM_COPY( encoding->sids, cff_standard_encoding,
-                     256 * sizeof ( FT_UShort ) );
-
+        FT_ARRAY_COPY( encoding->sids, cff_standard_encoding, 256 );
         goto Populate;
 
       case 1:
         /* First, copy the code to SID mapping. */
-        FT_MEM_COPY( encoding->sids, cff_expert_encoding,
-                     256 * sizeof ( FT_UShort ) );
+        FT_ARRAY_COPY( encoding->sids, cff_expert_encoding, 256 );
 
       Populate:
         /* Construct code to GID mapping from code to SID mapping */
@@ -1949,7 +1972,7 @@
   {
     FT_Error         error;
     CFF_ParserRec    parser;
-    FT_Byte*         dict;
+    FT_Byte*         dict = NULL;
     FT_ULong         dict_len;
     CFF_FontRecDict  top  = &font->font_dict;
     CFF_Private      priv = &font->private_dict;
@@ -1967,6 +1990,20 @@
     top->font_matrix.yy      = 0x10000L;
     top->cid_count           = 8720;
 
+    /* we use the implementation specific SID value 0xFFFF to indicate */
+    /* missing entries                                                 */
+    top->version             = 0xFFFFU;
+    top->notice              = 0xFFFFU;
+    top->copyright           = 0xFFFFU;
+    top->full_name           = 0xFFFFU;
+    top->family_name         = 0xFFFFU;
+    top->weight              = 0xFFFFU;
+    top->embedded_postscript = 0xFFFFU;
+
+    top->cid_registry        = 0xFFFFU;
+    top->cid_ordering        = 0xFFFFU;
+    top->cid_font_name       = 0xFFFFU;
+
     error = cff_index_access_element( idx, font_index, &dict, &dict_len ) ||
             cff_parser_run( &parser, dict, dict + dict_len );
 
@@ -1976,7 +2013,7 @@
       goto Exit;
 
     /* if it is a CID font, we stop there */
-    if ( top->cid_registry )
+    if ( top->cid_registry != 0xFFFFU )
       goto Exit;
 
     /* parse the private dictionary, if any */
@@ -2117,8 +2154,15 @@
     if ( error )
       goto Exit;
 
+    if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )
+      goto Exit;
+
+    error = cff_new_index( &font->charstrings_index, stream, 0 );
+    if ( error )
+      goto Exit;
+
     /* now, check for a CID font */
-    if ( dict->cid_registry )
+    if ( dict->cid_registry != 0xFFFFU )
     {
       CFF_IndexRec  fd_index;
       CFF_SubFont   sub;
@@ -2161,7 +2205,7 @@
 
       /* now load the FD Select array */
       error = CFF_Load_FD_Select( &font->fd_select,
-                                  (FT_UInt)dict->cid_count,
+                                  font->charstrings_index.count,
                                   stream,
                                   base_offset + dict->cid_fd_select_offset );
 
@@ -2182,13 +2226,6 @@
       goto Exit;
     }
 
-    if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )
-      goto Exit;
-
-    error = cff_new_index( &font->charstrings_index, stream, 0 );
-    if ( error )
-      goto Exit;
-
     /* explicit the global subrs */
     font->num_global_subrs = font->global_subrs_index.count;
     font->num_glyphs       = font->charstrings_index.count;
@@ -2199,25 +2236,38 @@
     if ( error )
       goto Exit;
 
-    /* read the Charset and Encoding tables when available */
+    /* read the Charset and Encoding tables if available */
     if ( font->num_glyphs > 0 )
     {
+      FT_Bool  invert;
+
+
+      invert = dict->cid_registry != 0xFFFFU &&
+               font->charstrings_index.count != dict->cid_count;
       error = cff_charset_load( &font->charset, font->num_glyphs, stream,
-                                base_offset, dict->charset_offset );
+                                base_offset, dict->charset_offset, invert );
       if ( error )
         goto Exit;
 
-      error = cff_encoding_load( &font->encoding,
-                                 &font->charset,
-                                 font->num_glyphs,
-                                 stream,
-                                 base_offset,
-                                 dict->encoding_offset );
-      if ( error )
-        goto Exit;
+      /* CID-keyed CFFs don't have an encoding */
+      if ( dict->cid_registry == 0xFFFFU )
+      {
+        error = cff_encoding_load( &font->encoding,
+                                   &font->charset,
+                                   font->num_glyphs,
+                                   stream,
+                                   base_offset,
+                                   dict->encoding_offset );
+        if ( error )
+          goto Exit;
+      }
+      else
+        /* CID-keyed fonts only need CIDs */
+        FT_FREE( font->charset.sids );
     }
 
-    /* get the font name */
+    /* get the font name (/CIDFontName for CID-keyed fonts, */
+    /* /FontName otherwise)                                 */
     font->font_name = cff_index_get_name( &font->name_index, face_index );
 
   Exit:

reactos/lib/freetype/src/cff
cffload.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cffload.h	15 Feb 2004 21:45:33 -0000	1.3
+++ cffload.h	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType & CFF data/program tables loader (specification).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,8 +21,8 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include "cfftypes.h"
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
 FT_BEGIN_HEADER
@@ -36,9 +36,9 @@
                       FT_UInt    element );
 
   FT_LOCAL( FT_String* )
-  cff_index_get_sid_string( CFF_Index        idx,
-                            FT_UInt          sid,
-                            PSNames_Service  psnames_interface );
+  cff_index_get_sid_string( CFF_Index          idx,
+                            FT_UInt            sid,
+                            FT_Service_PsCMaps psnames );
 
 
   FT_LOCAL( FT_Error )
@@ -62,7 +62,7 @@
 
 
   FT_LOCAL( FT_Byte )
-  cff_fd_select_get( CFF_FDSelect  select,
+  cff_fd_select_get( CFF_FDSelect  fdselect,
                      FT_UInt       glyph_index );
 
 

reactos/lib/freetype/src/cff
cffobjs.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cffobjs.c	15 Feb 2004 21:45:33 -0000	1.4
+++ cffobjs.c	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType objects manager (body).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -24,7 +24,7 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 #include "cffobjs.h"
 #include "cffload.h"
@@ -52,16 +52,81 @@
   /*************************************************************************/
 
 
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+  static FT_Error
+  sbit_size_reset( CFF_Size  size )
+  {
+    CFF_Face          face;
+    FT_Error          error = CFF_Err_Ok;
+
+    FT_ULong          strike_index;
+    FT_Size_Metrics*  metrics;
+    FT_Size_Metrics*  sbit_metrics;
+    SFNT_Service      sfnt;
+
+
+    metrics = &size->root.metrics;
+
+    face = (CFF_Face)size->root.face;
+    sfnt = (SFNT_Service)face->sfnt;
+
+    sbit_metrics = &size->strike_metrics;
+
+    error = sfnt->set_sbit_strike( face,
+                                   metrics->x_ppem, metrics->y_ppem,
+                                   &strike_index );
+
+    if ( !error )
+    {
+      TT_SBit_Strike  strike = face->sbit_strikes + strike_index;
+
+
+      sbit_metrics->x_ppem = metrics->x_ppem;
+      sbit_metrics->y_ppem = metrics->y_ppem;
+
+      sbit_metrics->ascender  = strike->hori.ascender << 6;
+      sbit_metrics->descender = strike->hori.descender << 6;
+
+      /* XXX: Is this correct? */
+      sbit_metrics->height = sbit_metrics->ascender -
+                             sbit_metrics->descender;
+
+      /* XXX: Is this correct? */
+      sbit_metrics->max_advance = ( strike->hori.min_origin_SB  +
+                                    strike->hori.max_width      +
+                                    strike->hori.min_advance_SB ) << 6;
+
+      size->strike_index = (FT_UInt)strike_index;
+    }
+    else
+    {
+      size->strike_index = 0xFFFFU;
+
+      sbit_metrics->x_ppem      = 0;
+      sbit_metrics->y_ppem      = 0;
+      sbit_metrics->ascender    = 0;
+      sbit_metrics->descender   = 0;
+      sbit_metrics->height      = 0;
+      sbit_metrics->max_advance = 0;
+    }
+
+    return error;
+  }
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
+
   static PSH_Globals_Funcs
   cff_size_get_globals_funcs( CFF_Size  size )
   {
-    CFF_Face          face     = (CFF_Face)size->face;
+    CFF_Face          face     = (CFF_Face)size->root.face;
     CFF_Font          font     = (CFF_FontRec *)face->extra.data;
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
     FT_Module         module;
 
 
-    module = FT_Get_Module( size->face->driver->root.library,
+    module = FT_Get_Module( size->root.face->driver->root.library,
                             "pshinter" );
     return ( module && pshinter && pshinter->get_globals_funcs )
            ? pshinter->get_globals_funcs( module )
@@ -72,16 +137,16 @@
   FT_LOCAL_DEF( void )
   cff_size_done( CFF_Size  size )
   {
-    if ( size->internal )
+    if ( size->root.internal )
     {
       PSH_Globals_Funcs  funcs;
 
 
       funcs = cff_size_get_globals_funcs( size );
       if ( funcs )
-        funcs->destroy( (PSH_Globals)size->internal );
+        funcs->destroy( (PSH_Globals)size->root.internal );
 
-      size->internal = 0;
+      size->root.internal = 0;
     }
   }
 
@@ -89,14 +154,14 @@
   FT_LOCAL_DEF( FT_Error )
   cff_size_init( CFF_Size  size )
   {
-    FT_Error           error = 0;
+    FT_Error           error = CFF_Err_Ok;
     PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );
 
 
     if ( funcs )
     {
       PSH_Globals    globals;
-      CFF_Face       face    = (CFF_Face)size->face;
+      CFF_Face       face    = (CFF_Face)size->root.face;
       CFF_Font       font    = (CFF_FontRec *)face->extra.data;
       CFF_SubFont    subfont = &font->top_font;
 
@@ -150,9 +215,9 @@
         priv.lenIV          = cpriv->lenIV;
       }
 
-      error = funcs->create( size->face->memory, &priv, &globals );
+      error = funcs->create( size->root.face->memory, &priv, &globals );
       if ( !error )
-        size->internal = (FT_Size_Internal)(void*)globals;
+        size->root.internal = (FT_Size_Internal)(void*)globals;
     }
 
     return error;
@@ -163,15 +228,32 @@
   cff_size_reset( CFF_Size  size )
   {
     PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );
-    FT_Error           error = 0;
+    FT_Error           error = CFF_Err_Ok;
+    FT_Face            face  = size->root.face;
 
 
     if ( funcs )
-      error = funcs->set_scale( (PSH_Globals)size->internal,
-                                 size->metrics.x_scale,
-                                 size->metrics.y_scale,
+      error = funcs->set_scale( (PSH_Globals)size->root.internal,
+                                 size->root.metrics.x_scale,
+                                 size->root.metrics.y_scale,
                                  0, 0 );
-    return error;
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+    if ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
+    {
+      error = sbit_size_reset( size );
+
+      if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
+        size->root.metrics = size->strike_metrics;
+    }
+
+#endif
+
+    if ( face->face_flags & FT_FACE_FLAG_SCALABLE )
+      return CFF_Err_Ok;
+    else
+      return error;
   }
 
 
@@ -244,8 +326,6 @@
   }
 
 
-
-
   FT_LOCAL_DEF( FT_Error )
   cff_face_init( FT_Stream      stream,
                  CFF_Face       face,
@@ -253,30 +333,37 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error          error;
-    SFNT_Service      sfnt;
-    PSNames_Service   psnames;
-    PSHinter_Service  pshinter;
-    FT_Bool           pure_cff    = 1;
-    FT_Bool           sfnt_format = 0;
+    FT_Error            error;
+    SFNT_Service        sfnt;
+    FT_Service_PsCMaps  psnames;
+    PSHinter_Service    pshinter;
+    FT_Bool             pure_cff    = 1;
+    FT_Bool             sfnt_format = 0;
 
+#if 0
+    FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt,     SFNT );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames,  POSTSCRIPT_NAMES );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER );
 
+    if ( !sfnt )
+      goto Bad_Format;
+#else
     sfnt = (SFNT_Service)FT_Get_Module_Interface(
              face->root.driver->root.library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
 
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
                  face->root.driver->root.library, "pshinter" );
+#endif
 
     /* create input stream from resource */
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
-    /* check that we have a valid OpenType file */
+    /* check whether we have a valid OpenType file */
     error = sfnt->init_face( stream, face, face_index, num_params, params );
     if ( !error )
     {
@@ -293,7 +380,7 @@
       sfnt_format = 1;
 
       /* now, the font can be either an OpenType/CFF font, or an SVG CEF */
-      /* font; in the later case it doesn't have a `head' table          */
+      /* font; in the latter case it doesn't have a `head' table         */
       error = face->goto_table( face, TTAG_head, stream, 0 );
       if ( !error )
       {
@@ -307,7 +394,7 @@
       }
       else
       {
-        /* load the `cmap' table by hand */
+        /* load the `cmap' table explicitly */
         error = sfnt->load_charmaps( face, stream );
         if ( error )
           goto Exit;
@@ -317,7 +404,7 @@
         /* FreeType 2                                                */
       }
 
-      /* now, load the CFF part of the file */
+      /* now load the CFF part of the file */
       error = face->goto_table( face, TTAG_CFF, stream, 0 );
       if ( error )
         goto Exit;
@@ -332,10 +419,11 @@
 
     /* now load and parse the CFF table in the file */
     {
-      CFF_Font   cff;
-      FT_Memory  memory = face->root.memory;
-      FT_Face    root;
-      FT_Int32   flags;
+      CFF_Font         cff;
+      CFF_FontRecDict  dict;
+      FT_Memory        memory = face->root.memory;
+      FT_Face          root;
+      FT_Int32         flags;
 
 
       if ( FT_NEW( cff ) )
@@ -347,7 +435,7 @@
         goto Exit;
 
       cff->pshinter = pshinter;
-      cff->psnames  = psnames;
+      cff->psnames  = (void*)psnames;
 
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts. */
@@ -355,26 +443,29 @@
       root             = &face->root;
       root->num_glyphs = cff->num_glyphs;
 
-      if ( pure_cff )
+      dict = &cff->top_font.font_dict;
+
+      /* we need the `PSNames' module for CFF and CEF formats */
+      /* which aren't CID-keyed                               */
+      if ( dict->cid_registry == 0xFFFFU && !psnames )
       {
-        CFF_FontRecDict  dict = &cff->top_font.font_dict;
+        FT_ERROR(( "cff_face_init:" ));
+        FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
+        FT_ERROR(( "              " ));
+        FT_ERROR(( " without the `PSNames' module\n" ));
+        goto Bad_Format;
+      }
 
+      if ( pure_cff )
+      {
+        char*  style_name = NULL;
 
-        /* we need the `PSNames' module for pure-CFF and CEF formats */
-        if ( !psnames )
-        {
-          FT_ERROR(( "cff_face_init:" ));
-          FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
-          FT_ERROR(( "              " ));
-          FT_ERROR(( " without the `PSNames' module\n" ));
-          goto Bad_Format;
-        }
 
         /* Set up num_faces. */
         root->num_faces = cff->num_faces;
 
         /* compute number of glyphs */
-        if ( dict->cid_registry )
+        if ( dict->cid_registry != 0xFFFFU )
           root->num_glyphs = dict->cid_count;
         else
           root->num_glyphs = cff->charstrings_index.count;
@@ -385,7 +476,6 @@
         root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
         root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
-
         root->ascender  = (FT_Short)( root->bbox.yMax );
         root->descender = (FT_Short)( root->bbox.yMin );
         root->height    = (FT_Short)(
@@ -396,17 +486,87 @@
         else
           root->units_per_EM = 1000;
 
-        root->underline_position  = dict->underline_position >> 16;
-        root->underline_thickness = dict->underline_thickness >> 16;
+        root->underline_position  =
+          (FT_Short)( dict->underline_position >> 16 );
+        root->underline_thickness =
+          (FT_Short)( dict->underline_thickness >> 16 );
 
         /* retrieve font family & style name */
-        root->family_name  = cff_index_get_name( &cff->name_index, face_index );
-        if ( dict->cid_registry )
-          root->style_name = cff_strcpy( memory, "Regular" );  /* XXXX */
+        root->family_name = cff_index_get_name( &cff->name_index,
+                                                face_index );
+
+        if ( root->family_name )
+        {
+          char*  full   = cff_index_get_sid_string( &cff->string_index,
+                                                    dict->full_name,
+                                                    psnames );
+          char*  fullp  = full;
+          char*  family = root->family_name;
+
+         /* we're going to try to extract the style name from the
+          * full name. We need to ignore spaces and dashes during
+          * the search.
+          */
+          if ( full )
+          {
+            while ( *fullp )
+            {
+             /* skip common characters at the start of both strings
+              */
+              if ( *fullp == *family )
+              {
+                family++;
+                fullp++;
+                continue;
+              }
+
+             /* ignore spaces or dashes in full name during comparison
+              */
+              if ( *fullp == ' ' || *fullp == '-' )
+              {
+                fullp++;
+                continue;
+              }
+             /* ignore spaces and dashes in family name during comparison
+              */
+              if ( *family == ' ' || *family == '-' )
+              {
+                family++;
+                continue;
+              }
+
+              if ( !*family && *fullp )
+              {
+               /* the full name begins with the same characters than the
+                * family name, with spaces and dashes removed. In this
+                * case, the remaining string in "fullp" will be used
+                * as the style name
+                */
+                style_name = cff_strcpy( memory, fullp );
+              }
+              break;
+            }
+            FT_FREE( full );
+          }
+        }
+        else
+        {
+          char  *cid_font_name =
+                   cff_index_get_sid_string( &cff->string_index,
+                                             dict->cid_font_name,
+                                             psnames );
+
+
+          /* do we have a `/FontName' for a CID-keyed font? */
+          if ( cid_font_name )
+            root->family_name = cid_font_name;
+        }
+
+        if ( style_name )
+          root->style_name = style_name;
         else
-          root->style_name = cff_index_get_sid_string( &cff->string_index,
-                                                       dict->weight,
-                                                       psnames );
+          /* assume "Regular" style if we don't know better */
+          root->style_name = cff_strcpy( memory, (char *)"Regular" );
 
         /*******************************************************************/
         /*                                                                 */
@@ -429,10 +589,6 @@
           flags |= FT_FACE_FLAG_KERNING;
 #endif
 
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
-        flags |= FT_FACE_FLAG_GLYPH_NAMES;
-#endif
-
         root->face_flags = flags;
 
         /*******************************************************************/
@@ -444,13 +600,29 @@
         if ( dict->italic_angle )
           flags |= FT_STYLE_FLAG_ITALIC;
 
-        /* XXX: may not be correct */
-        if ( cff->top_font.private_dict.force_bold )
-          flags |= FT_STYLE_FLAG_BOLD;
+        {
+          char  *weight = cff_index_get_sid_string( &cff->string_index,
+                                                    dict->weight,
+                                                    psnames );
+
+
+          if ( weight )
+            if ( !ft_strcmp( weight, "Bold"  ) ||
+                 !ft_strcmp( weight, "Black" ) )
+              flags |= FT_STYLE_FLAG_BOLD;
+          FT_FREE( weight );
+        }
 
         root->style_flags = flags;
       }
 
+#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
+      /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
+      /* has unset this flag because of the 3.0 `post' table           */
+      if ( dict->cid_registry == 0xFFFFU )
+        root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
+#endif
+
       /*******************************************************************/
       /*                                                                 */
       /* Compute char maps.                                              */
@@ -479,7 +651,12 @@
             goto Skip_Unicode; /* Standard Unicode (deprecated) */
         }
 
-        /* we didn't find a Unicode charmap, synthetize one */
+        /* since CID-keyed fonts don't contain glyph names, we can't */
+        /* construct a cmap                                          */
+        if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU )
+          goto Exit;
+
+        /* we didn't find a Unicode charmap -- synthetize one */
         cmaprec.face        = root;
         cmaprec.platform_id = 3;
         cmaprec.encoding_id = 1;

reactos/lib/freetype/src/cff
cffobjs.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cffobjs.h	15 Feb 2004 21:45:33 -0000	1.3
+++ cffobjs.h	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType objects manager (specification).                            */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,9 +22,9 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CFF_TYPES_H
+#include "cfftypes.h"
 #include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
 FT_BEGIN_HEADER
@@ -51,7 +51,18 @@
   /* <Description>                                                         */
   /*    A handle to an OpenType size object.                               */
   /*                                                                       */
-  typedef FT_Size  CFF_Size;
+  typedef struct  CFF_SizeRec_
+  {
+    FT_SizeRec       root;
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+    FT_UInt          strike_index;    /* 0xFFFF to indicate invalid */
+    FT_Size_Metrics  strike_metrics;  /* current strike's metrics   */
+
+#endif
+
+  } CFF_SizeRec, *CFF_Size;
 
 
   /*************************************************************************/
@@ -89,15 +100,6 @@
   } CFF_Transform;
 
 
-  /* this is only used in the case of a pure CFF font with no charmap */
-  typedef struct  CFF_CharMapRec_
-  {
-    TT_CharMapRec  root;
-    PS_Unicodes    unicodes;
-
-  } CFF_CharMapRec, *CFF_CharMap;
-
-
   /***********************************************************************/
   /*                                                                     */
   /* TrueType driver class.                                              */

reactos/lib/freetype/src/cff
cffparse.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- cffparse.c	21 Jan 2004 19:23:46 -0000	1.2
+++ cffparse.c	10 May 2004 17:48:32 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF token stream parser (body)                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -334,7 +334,7 @@
       offset->x  = cff_parse_fixed_thousand( data++ );
       offset->y  = cff_parse_fixed_thousand( data   );
 
-      temp = ABS( matrix->yy );
+      temp = FT_ABS( matrix->yy );
 
       *upm = (FT_UShort)FT_DivFix( 0x10000L, FT_DivFix( temp, 1000 ) );
 

reactos/lib/freetype/src/cff
cffparse.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cffparse.h	15 Feb 2004 21:45:33 -0000	1.3
+++ cffparse.h	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF token stream parser (specification)                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,7 +21,7 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
+#include "cfftypes.h"
 #include FT_INTERNAL_OBJECTS_H
 
 

reactos/lib/freetype/src/cff
cfftoken.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cfftoken.h	15 Feb 2004 21:45:33 -0000	1.4
+++ cfftoken.h	10 May 2004 17:48:32 -0000	1.5
@@ -43,10 +43,10 @@
   CFF_FIELD_NUM     ( 17,    charstrings_offset )
   CFF_FIELD_CALLBACK( 18,    private_dict )
   CFF_FIELD_NUM     ( 0x114, synthetic_base )
-  CFF_FIELD_STRING  ( 0x115, postscript )
-  CFF_FIELD_STRING  ( 0x116, base_font_name )
+  CFF_FIELD_STRING  ( 0x115, embedded_postscript )
 
 #if 0
+  CFF_FIELD_STRING  ( 0x116, base_font_name )
   CFF_FIELD_DELTA   ( 0x117, base_font_blend, 16 )
   CFF_FIELD_CALLBACK( 0x118, multiple_master )
   CFF_FIELD_CALLBACK( 0x119, blend_axit_types )

reactos/lib/freetype/src/cff
rules.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- rules.mk	15 Feb 2004 21:45:33 -0000	1.4
+++ rules.mk	10 May 2004 17:48:32 -0000	1.5
@@ -34,6 +34,7 @@
 #
 CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
              $(CFF_DIR)/cfftoken.h  \
+             $(CFF_DIR)/cfftypes.h  \
              $(CFF_DIR)/cfferrs.h
 
 

reactos/lib/freetype/src/cid
cidgload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- cidgload.c	15 Feb 2004 21:45:33 -0000	1.5
+++ cidgload.c	10 May 2004 17:48:32 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 Glyph Loader (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -44,7 +44,7 @@
     CID_FaceInfo   cid  = &face->cid;
     FT_Byte*       p;
     FT_UInt        fd_select;
-    FT_Stream      stream = face->root.stream;
+    FT_Stream      stream = face->cid_stream;
     FT_Error       error  = 0;
     FT_Byte*       charstring = 0;
     FT_Memory      memory = face->root.memory;
@@ -306,7 +306,7 @@
                                              0, /* glyph names -- XXX */
                                              0, /* blend == 0 */
                                              hinting,
-                                             FT_LOAD_TARGET_MODE(load_flags),
+                                             FT_LOAD_TARGET_MODE( load_flags ),
                                              cid_load_glyph );
 
       /* set up the decoder */
@@ -412,11 +412,11 @@
 
           if ( hinting )
           {
-            metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64;
-            metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64;
+            metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
+            metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
 
-            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;
-            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;
+            metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
+            metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
           }
         }
 
@@ -426,10 +426,10 @@
         /* grid fit the bounding box if necessary */
         if ( hinting )
         {
-          cbox.xMin &= -64;
-          cbox.yMin &= -64;
-          cbox.xMax  = ( cbox.xMax + 63 ) & -64;
-          cbox.yMax  = ( cbox.yMax + 63 ) & -64;
+          cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+          cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+          cbox.xMax = FT_PIX_CEIL( cbox.xMax );
+          cbox.yMax = FT_PIX_CEIL( cbox.yMax );
         }
 
         metrics->width  = cbox.xMax - cbox.xMin;

reactos/lib/freetype/src/cid
cidload.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cidload.c	15 Feb 2004 21:45:33 -0000	1.4
+++ cidload.c	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 font loader (body).                                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -39,7 +39,7 @@
 
   /* read a single offset */
   FT_LOCAL_DEF( FT_Long )
-  cid_get_offset( FT_Byte**  start,
+  cid_get_offset( FT_Byte*  *start,
                   FT_Byte    offsize )
   {
     FT_Long   result;
@@ -162,11 +162,11 @@
 
       (void)cid_parser_to_fixed_array( parser, 6, temp, 3 );
 
-      temp_scale = ABS( temp[3] );
+      temp_scale = FT_ABS( temp[3] );
 
-      /* Set Units per EM based on FontMatrix values.  We set the value to */
+      /* Set units per EM based on FontMatrix values.  We set the value to */
       /* `1000/temp_scale', because temp_scale was already multiplied by   */
-      /* 1000 (in t1_tofixed(), from psobjs.c).                            */
+      /* 1000 (in `t1_tofixed', from psobjs.c).                            */
       root->units_per_EM = (FT_UShort)( FT_DivFix( 0x10000L,
                                         FT_DivFix( temp_scale, 1000 ) ) );
 
@@ -191,7 +191,7 @@
       offset->y  = temp[5] >> 16;
     }
 
-    return CID_Err_Ok;       /* this is a callback function; */
+    return CID_Err_Ok;      /* this is a callback function; */
                             /* we must return an error code */
   }
 
@@ -258,42 +258,61 @@
 
     parser->root.cursor = base;
     parser->root.limit  = base + size;
-    parser->root.error  = 0;
+    parser->root.error  = CID_Err_Ok;
 
     {
       FT_Byte*  cur   = base;
       FT_Byte*  limit = cur + size;
 
 
-      for ( ;cur < limit; cur++ )
+      for (;;)
       {
+        FT_Byte*  newlimit;
+
+
+        parser->root.cursor = cur;
+        cid_parser_skip_spaces( parser );
+
+        if ( parser->root.cursor >= limit )
+          newlimit = limit - 1 - 17;
+        else
+          newlimit = parser->root.cursor - 17;
+
         /* look for `%ADOBeginFontDict' */
-        if ( *cur == '%' && cur + 20 < limit &&
-             ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
+        for ( ; cur < newlimit; cur++ )
         {
-          cur += 17;
-
-          /* if /FDArray was found, then cid->num_dicts is > 0, and */
-          /* we can start increasing parser->num_dict               */
-          if ( face->cid.num_dicts > 0 )
-            parser->num_dict++;
+          if ( *cur == '%'                                            &&
+               ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
+          {
+            /* if /FDArray was found, then cid->num_dicts is > 0, and */
+            /* we can start increasing parser->num_dict               */
+            if ( face->cid.num_dicts > 0 )
+              parser->num_dict++;
+          }
         }
+
+        cur = parser->root.cursor;
+        /* no error can occur in cid_parser_skip_spaces */
+        if ( cur >= limit )
+          break;
+
+        cid_parser_skip_PS_token( parser );
+        if ( parser->root.cursor >= limit || parser->root.error )
+          break;
+
         /* look for immediates */
-        else if ( *cur == '/' && cur + 2 < limit )
+        if ( *cur == '/' && cur + 2 < limit )
         {
-          FT_Int  len;
+          FT_PtrDist  len;
 
 
           cur++;
+          len = parser->root.cursor - cur;
 
-          parser->root.cursor = cur;
-          cid_parser_skip_alpha( parser );
-
-          len = (FT_Int)( parser->root.cursor - cur );
           if ( len > 0 && len < 22 )
           {
             /* now compare the immediate name to the keyword table */
-            T1_Field  keyword = (T1_Field) cid_field_records;
+            T1_Field  keyword = (T1_Field)cid_field_records;
 
 
             for (;;)
@@ -305,10 +324,10 @@
               if ( !name )
                 break;
 
-              if ( cur[0] == name[0]                          &&
-                   len == (FT_Int)ft_strlen( (const char*)name ) )
+              if ( cur[0] == name[0]                     &&
+                   len == ft_strlen( (const char*)name ) )
               {
-                FT_Int  n;
+                FT_PtrDist  n;
 
 
                 for ( n = 1; n < len; n++ )
@@ -318,14 +337,11 @@
                 if ( n >= len )
                 {
                   /* we found it - run the parsing callback */
-                  cid_parser_skip_spaces( parser );
                   parser->root.error = cid_load_keyword( face,
                                                          loader,
                                                          keyword );
                   if ( parser->root.error )
                     return parser->root.error;
-
-                  cur = parser->root.cursor;
                   break;
                 }
               }
@@ -333,6 +349,8 @@
             }
           }
         }
+
+        cur = parser->root.cursor;
       }
     }
     return parser->root.error;
@@ -345,7 +363,7 @@
   {
     CID_FaceInfo   cid    = &face->cid;
     FT_Memory      memory = face->root.memory;
-    FT_Stream      stream = face->root.stream;
+    FT_Stream      stream = face->cid_stream;
     FT_Error       error;
     FT_Int         n;
     CID_Subrs      subr;
@@ -370,7 +388,7 @@
       /* reallocate offsets array if needed */
       if ( num_subrs + 1 > max_offsets )
       {
-        FT_UInt  new_max = ( num_subrs + 1 + 3 ) & -4;
+        FT_UInt  new_max = FT_PAD_CEIL( num_subrs + 1, 4 );
 
 
         if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
@@ -381,7 +399,7 @@
 
       /* read the subrmap's offsets */
       if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
-           FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes )   )
+           FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes )      )
         goto Fail;
 
       p = (FT_Byte*)stream->cursor;
@@ -469,11 +487,111 @@
   }
 
 
+  static FT_Error
+  cid_hex_to_binary( FT_Byte*  data,
+                     FT_Long   data_len,
+                     FT_ULong  offset,
+                     CID_Face  face )
+  {
+    FT_Stream  stream = face->root.stream;
+    FT_Error   error;
+
+    FT_Byte    buffer[256];
+    FT_Byte   *p, *plimit;
+    FT_Byte   *d, *dlimit;
+    FT_Byte    val;
+
+    FT_Bool    upper_nibble, done;
+
+
+    if ( FT_STREAM_SEEK( offset ) )
+      goto Exit;
+
+    d      = data;
+    dlimit = d + data_len;
+    p      = buffer;
+    plimit = p;
+
+    upper_nibble = 1;
+    done         = 0;
+
+    while ( d < dlimit )
+    {
+      if ( p >= plimit )
+      {
+        FT_ULong  oldpos = FT_STREAM_POS();
+        FT_ULong  size   = stream->size - oldpos;
+
+
+        if ( size == 0 )
+        {
+          error = CID_Err_Syntax_Error;
+          goto Exit;
+        }
+
+        if ( FT_STREAM_READ( buffer, 256 > size ? size : 256 ) )
+          goto Exit;
+        p      = buffer;
+        plimit = p + FT_STREAM_POS() - oldpos;
+      }
+
+      if ( ft_isdigit( *p ) )
+        val = *p - '0';
+      else if ( *p >= 'a' && *p <= 'f' )
+        val = *p - 'a';
+      else if ( *p >= 'A' && *p <= 'F' )
+        val = *p - 'A' + 10;
+      else if ( *p == ' '  ||
+                *p == '\t' ||
+                *p == '\r' ||
+                *p == '\n' ||
+                *p == '\f' ||
+                *p == '\0' )
+      {
+        p++;
+        continue;
+      }
+      else if ( *p == '>' )
+      {
+        val  = 0;
+        done = 1;
+      }
+      else
+      {
+        error = CID_Err_Syntax_Error;
+        goto Exit;
+      }
+
+      if ( upper_nibble )
+        *d = val << 4;
+      else
+      {
+        *d += val;
+        d++;
+      }
+
+      upper_nibble = 1 - upper_nibble;
+
+      if ( done )
+        break;
+
+      p++;
+    }
+
+    error = CID_Err_Ok;
+
+  Exit:
+    return error;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
-  cid_face_open( CID_Face  face )
+  cid_face_open( CID_Face  face,
+                 FT_Int    face_index )
   {
     CID_Loader   loader;
     CID_Parser*  parser;
+    FT_Memory    memory = face->root.memory;
     FT_Error     error;
 
 
@@ -491,7 +609,30 @@
     if ( error )
       goto Exit;
 
-    face->cid.data_offset = loader.parser.data_offset;
+    if ( face_index < 0 )
+      goto Exit;
+
+    if ( FT_NEW( face->cid_stream ) )
+      goto Exit;
+
+    if ( parser->binary_length )
+    {
+      /* we must convert the data section from hexadecimal to binary */
+      if ( FT_ALLOC( face->binary_data, parser->binary_length )         ||
+           cid_hex_to_binary( face->binary_data, parser->binary_length,
+                              parser->data_offset, face )               )
+        goto Exit;
+
+      FT_Stream_OpenMemory( face->cid_stream,
+                            face->binary_data, parser->binary_length );
+      face->cid.data_offset = 0;
+    }
+    else
+    {
+      *face->cid_stream     = *face->root.stream;
+      face->cid.data_offset = loader.parser.data_offset;
+    }
+
     error = cid_read_subrs( face );
 
   Exit:

reactos/lib/freetype/src/cid
cidload.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cidload.h	15 Feb 2004 21:45:33 -0000	1.4
+++ cidload.h	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 font loader (specification).                         */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -41,7 +41,8 @@
                   FT_Byte    offsize );
 
   FT_LOCAL( FT_Error )
-  cid_face_open( CID_Face  face );
+  cid_face_open( CID_Face  face,
+                 FT_Int    face_index );
 
 
 FT_END_HEADER

reactos/lib/freetype/src/cid
cidobjs.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cidobjs.c	15 Feb 2004 21:45:34 -0000	1.4
+++ cidobjs.c	10 May 2004 17:48:32 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID objects manager (body).                                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -23,7 +23,7 @@
 #include "cidgload.h"
 #include "cidload.h"
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
@@ -199,12 +199,12 @@
       if ( face->subrs )
       {
         FT_Int  n;
-        
+
 
         for ( n = 0; n < cid->num_dicts; n++ )
         {
           CID_Subrs  subr = face->subrs + n;
-          
+
 
           if ( subr->code )
           {
@@ -234,6 +234,9 @@
 
       face->root.family_name = 0;
       face->root.style_name  = 0;
+
+      FT_FREE( face->binary_data );
+      FT_FREE( face->cid_stream );
     }
   }
 
@@ -268,27 +271,19 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error          error;
-    PSNames_Service   psnames;
-    PSAux_Service     psaux;
-    PSHinter_Service  pshinter;
+    FT_Error            error;
+    FT_Service_PsCMaps  psnames;
+    PSAux_Service       psaux;
+    PSHinter_Service    pshinter;
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
-    FT_UNUSED( face_index );
     FT_UNUSED( stream );
 
 
     face->root.num_faces = 1;
 
-    psnames = (PSNames_Service)face->psnames;
-    if ( !psnames )
-    {
-      psnames = (PSNames_Service)FT_Get_Module_Interface(
-                  FT_FACE_LIBRARY( face ), "psnames" );
-
-      face->psnames = psnames;
-    }
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
 
     psaux = (PSAux_Service)face->psaux;
     if ( !psaux )
@@ -312,7 +307,7 @@
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
-    error = cid_face_open( face );
+    error = cid_face_open( face, face_index );
     if ( error )
       goto Exit;
 
@@ -423,8 +418,8 @@
       root->height    = (FT_Short)(
         ( ( root->ascender - root->descender ) * 12 ) / 10 );
 
-      root->underline_position  = info->underline_position >> 16;
-      root->underline_thickness = info->underline_thickness >> 16;
+      root->underline_position  = (FT_Short)info->underline_position;
+      root->underline_thickness = (FT_Short)info->underline_thickness;
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;

reactos/lib/freetype/src/cid
cidparse.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cidparse.c	15 Feb 2004 21:45:34 -0000	1.3
+++ cidparse.c	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 parser (body).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,6 +58,8 @@
     FT_ULong  base_offset, offset, ps_len;
     FT_Byte   buffer[256 + 10];
     FT_Int    buff_len;
+    FT_Byte   *cur, *limit;
+    FT_Byte   *arg1, *arg2;
 
 
     FT_MEM_ZERO( parser, sizeof ( *parser ) );
@@ -67,7 +69,7 @@
 
     base_offset = FT_STREAM_POS();
 
-    /* first of all, check the font format in the  header */
+    /* first of all, check the font format in the header */
     if ( FT_FRAME_ENTER( 31 ) )
       goto Exit;
 
@@ -82,15 +84,17 @@
     if ( error )
       goto Exit;
 
-    /* now, read the rest of the file, until we find a `StartData' */
+  Again:
+    /* now, read the rest of the file until we find a `StartData' */
     buff_len = 256;
     for (;;)
     {
-      FT_Byte   *p, *limit = buffer + 256;
+      FT_Byte*  p;
       FT_ULong  top_position;
 
 
       /* fill input buffer */
+      limit     = buffer + 256;
       buff_len -= 256;
       if ( buff_len > 0 )
         FT_MEM_MOVE( buffer, limit, buff_len );
@@ -101,7 +105,7 @@
         goto Exit;
 
       top_position = FT_STREAM_POS() - buff_len;
-      buff_len = 256 + 10;
+      buff_len     = 256 + 10;
 
       /* look for `StartData' */
       for ( p = buffer; p < limit; p++ )
@@ -116,12 +120,12 @@
     }
 
   Found:
-    /* we have found the start of the binary data.  We will now        */
-    /* rewind and extract the frame of corresponding to the Postscript */
-    /* section                                                         */
+    /* we have found the start of the binary data.  We will now     */
+    /* rewind and extract the frame corresponding to the PostScript */
+    /* section                                                      */
 
     ps_len = offset - base_offset;
-    if ( FT_STREAM_SEEK( base_offset )                    ||
+    if ( FT_STREAM_SEEK( base_offset )                  ||
          FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
       goto Exit;
 
@@ -132,6 +136,45 @@
     parser->root.limit     = parser->root.cursor + ps_len;
     parser->num_dict       = -1;
 
+    /* Finally, we check whether `StartData' was real -- it could be  */
+    /* in a comment or string.  We also get its arguments to find out */
+    /* whether the data is represented in binary or hex format.       */
+
+    arg1 = parser->root.cursor;
+    cid_parser_skip_PS_token( parser );
+    cid_parser_skip_spaces  ( parser );
+    arg2 = parser->root.cursor;
+    cid_parser_skip_PS_token( parser );
+    cid_parser_skip_spaces  ( parser );
+
+    limit = parser->root.limit;
+    cur   = parser->root.cursor;
+
+    while ( cur < limit )
+    {
+      if ( *cur == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
+      {
+        if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
+          parser->binary_length = ft_atol( (const char *)arg2 );
+
+        limit = parser->root.limit;
+        cur   = parser->root.cursor;
+        goto Exit;
+      }
+
+      cid_parser_skip_PS_token( parser );
+      cid_parser_skip_spaces  ( parser );
+      arg1 = arg2;
+      arg2 = cur;
+      cur  = parser->root.cursor;
+    }
+
+    /* we haven't found the correct `StartData'; go back and continue */
+    /* searching                                                      */
+    FT_FRAME_RELEASE( parser->postscript );
+    if ( !FT_STREAM_SEEK( offset ) )
+      goto Again;
+
   Exit:
     return error;
   }

reactos/lib/freetype/src/cid
cidparse.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- cidparse.h	15 Feb 2004 21:45:34 -0000	1.3
+++ cidparse.h	10 May 2004 17:48:32 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 parser (specification).                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -50,6 +50,9 @@
   /*    data_offset    :: The start position of the binary data (i.e., the */
   /*                      end of the data to be parsed.                    */
   /*                                                                       */
+  /*    binary_length  :: The length of the data after the `StartData'     */
+  /*                      command if the data format is hexadecimal.       */
+  /*                                                                       */
   /*    cid            :: A structure which holds the information about    */
   /*                      the current font.                                */
   /*                                                                       */
@@ -65,6 +68,8 @@
 
     FT_ULong      data_offset;
 
+    FT_Long       binary_length;
+
     CID_FaceInfo  cid;
     FT_Int        num_dict;
 
@@ -87,8 +92,10 @@
   /*                                                                       */
   /*************************************************************************/
 
-#define cid_parser_skip_spaces( p )  (p)->root.funcs.skip_spaces( &(p)->root )
-#define cid_parser_skip_alpha( p )   (p)->root.funcs.skip_alpha ( &(p)->root )
+#define cid_parser_skip_spaces( p ) \
+          (p)->root.funcs.skip_spaces( &(p)->root )
+#define cid_parser_skip_PS_token( p ) \
+          (p)->root.funcs.skip_PS_token( &(p)->root )
 
 #define cid_parser_to_int( p )        (p)->root.funcs.to_int( &(p)->root )
 #define cid_parser_to_fixed( p, t )   (p)->root.funcs.to_fixed( &(p)->root, t )

reactos/lib/freetype/src/cid
cidriver.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- cidriver.c	15 Feb 2004 21:45:34 -0000	1.4
+++ cidriver.c	10 May 2004 17:48:32 -0000	1.5
@@ -21,10 +21,12 @@
 #include "cidgload.h"
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #include "ciderrs.h"
 
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_XFREE86_NAME_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -36,6 +38,11 @@
 #define FT_COMPONENT  trace_ciddriver
 
 
+ /*
+  *  POSTSCRIPT NAME SERVICE
+  *
+  */
+
   static const char*
   cid_get_postscript_name( CID_Face  face )
   {
@@ -49,6 +56,47 @@
   }
 
 
+  static const FT_Service_PsFontNameRec  cid_service_ps_name =
+  {
+    (FT_PsName_GetFunc) cid_get_postscript_name
+  };
+
+
+ /*
+  *  POSTSCRIPT INFO SERVICE
+  *
+  */
+
+  static FT_Error
+  cid_ps_get_font_info( FT_Face          face,
+                        PS_FontInfoRec*  afont_info )
+  {
+    *afont_info = ((CID_Face)face)->cid.font_info;
+    return 0;
+  }
+
+
+  static const FT_Service_PsInfoRec  cid_service_ps_info =
+  {
+    (PS_GetFontInfoFunc)  cid_ps_get_font_info,
+    (PS_HasGlyphNamesFunc)NULL          /* unsupported with CID fonts */
+  };
+
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  cid_services[] =
+  {
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
+    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_CID },
+    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &cid_service_ps_info },
+    { NULL, NULL }
+  };
+
+
   static FT_Module_Interface
   cid_get_interface( FT_Driver         driver,
                      const FT_String*  cid_interface )
@@ -56,10 +104,7 @@
     FT_UNUSED( driver );
     FT_UNUSED( cid_interface );
 
-    if ( ft_strcmp( (const char*)cid_interface, "postscript_name" ) == 0 )
-      return (FT_Module_Interface)cid_get_postscript_name;
-
-    return 0;
+    return ft_service_list_lookup( cid_services, cid_interface );
   }
 
 

reactos/lib/freetype/src/gzip
adler32.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- adler32.c	15 Feb 2004 21:45:34 -0000	1.5
+++ adler32.c	10 May 2004 17:48:32 -0000	1.6
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: adler32.c,v 1.5 2004/02/15 21:45:34 gvg Exp $ */
+/* @(#) $Id: adler32.c,v 1.6 2004/05/10 17:48:32 gvg Exp $ */
 
 #include "zlib.h"
 

reactos/lib/freetype/src/gzip
ftgzip.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ftgzip.c	21 Jan 2004 19:23:46 -0000	1.3
+++ ftgzip.c	10 May 2004 17:48:32 -0000	1.4
@@ -4,11 +4,11 @@
 /*                                                                         */
 /*    FreeType support for .gz compressed files.                           */
 /*                                                                         */
-/*  this optional component relies on zlib. It should mainly be used to    */
+/*  This optional component relies on zlib.  It should mainly be used to   */
 /*  parse compressed PCF fonts, as found with many X11 server              */
 /*  distributions.                                                         */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2004 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -144,7 +144,7 @@
 /***************************************************************************/
 /***************************************************************************/
 
-#define  FT_GZIP_BUFFER_SIZE          4096
+#define FT_GZIP_BUFFER_SIZE  4096
 
   typedef struct  FT_GZipFileRec_
   {
@@ -154,7 +154,7 @@
     z_stream   zstream;        /* zlib input stream           */
 
     FT_ULong   start;          /* starting position, after .gz header */
-    FT_Byte    input[FT_GZIP_BUFFER_SIZE];  /* input read buffer */
+    FT_Byte    input[FT_GZIP_BUFFER_SIZE];   /* input read buffer  */
 
     FT_Byte    buffer[FT_GZIP_BUFFER_SIZE];  /* output buffer      */
     FT_ULong   pos;                          /* position in output */
@@ -173,7 +173,7 @@
 #define FT_GZIP_RESERVED     0xE0 /* bits 5..7: reserved */
 
 
-  /* check and skip .gz header - we don't support "transparent" compression */
+  /* check and skip .gz header - we don't support `transparent' compression */
   static FT_Error
   ft_gzip_check_header( FT_Stream  stream )
   {
@@ -254,7 +254,7 @@
                      FT_Stream    source )
   {
     z_stream*  zstream = &zip->zstream;
-    FT_Error   error   = 0;
+    FT_Error   error   = Gzip_Err_Ok;
 
 
     zip->stream = stream;
@@ -276,9 +276,9 @@
       zip->start = FT_STREAM_POS();
     }
 
-    /* initialize zlib - there is no zlib header in the compressed stream */
-    zstream->zalloc = (alloc_func) ft_gzip_alloc;
-    zstream->zfree  = (free_func)  ft_gzip_free;
+    /* initialize zlib -- there is no zlib header in the compressed stream */
+    zstream->zalloc = (alloc_func)ft_gzip_alloc;
+    zstream->zfree  = (free_func) ft_gzip_free;
     zstream->opaque = stream->memory;
 
     zstream->avail_in = 0;
@@ -286,10 +286,7 @@
 
     if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
          zstream->next_in == NULL                     )
-    {
       error = Gzip_Err_Invalid_File_Format;
-      goto Exit;
-    }
 
   Exit:
     return error;
@@ -301,6 +298,7 @@
   {
     z_stream*  zstream = &zip->zstream;
 
+
     inflateEnd( zstream );
 
     /* clear the rest */
@@ -341,7 +339,8 @@
       zip->cursor = zip->limit;
       zip->pos    = 0;
     }
-    return  error;
+
+    return error;
   }
 
 
@@ -376,7 +375,7 @@
     zstream->next_in  = zip->input;
     zstream->avail_in = size;
 
-    return 0;
+    return Gzip_Err_Ok;
   }
 
 
@@ -418,6 +417,7 @@
         break;
       }
     }
+
     return error;
   }
 
@@ -427,8 +427,8 @@
   ft_gzip_file_skip_output( FT_GZipFile  zip,
                             FT_ULong     count )
   {
-    FT_Error   error   = 0;
-    FT_ULong   delta;
+    FT_Error  error = Gzip_Err_Ok;
+    FT_ULong  delta;
 
 
     for (;;)

reactos/lib/freetype/src/gzip
infblock.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- infblock.c	15 Feb 2004 21:45:34 -0000	1.4
+++ infblock.c	10 May 2004 17:48:32 -0000	1.5
@@ -156,7 +156,8 @@
             uInt bl, bd;
             inflate_huft *tl, *td;
 
-            inflate_trees_fixed(&bl, &bd, &tl, &td, z);
+            inflate_trees_fixed(&bl, &bd, (const inflate_huft**)&tl,
+                                          (const inflate_huft**)&td, z);
             s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
             if (s->sub.decode.codes == Z_NULL)
             {

reactos/lib/freetype/src/gzip
inffixed.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- inffixed.h	15 Feb 2004 21:45:34 -0000	1.3
+++ inffixed.h	10 May 2004 17:48:32 -0000	1.4
@@ -7,9 +7,9 @@
    subject to change. Applications should only use zlib.h.
  */
 
-local uInt fixed_bl = 9;
-local uInt fixed_bd = 5;
-local inflate_huft fixed_tl[] = {
+local const uInt fixed_bl = 9;
+local const uInt fixed_bd = 5;
+local const inflate_huft fixed_tl[] = {
     {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
     {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
     {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
@@ -139,7 +139,7 @@
     {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
     {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
   };
-local inflate_huft fixed_td[] = {
+local const inflate_huft fixed_td[] = {
     {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
     {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
     {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},

reactos/lib/freetype/src/gzip
inftrees.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- inftrees.c	15 Feb 2004 21:45:34 -0000	1.5
+++ inftrees.c	10 May 2004 17:48:32 -0000	1.6
@@ -401,11 +401,11 @@
 
 
 local int inflate_trees_fixed( /* bl, bd, tl, td, z) */
-uIntf *bl,               /* literal desired/actual bit depth */
-uIntf *bd,               /* distance desired/actual bit depth */
-inflate_huft * FAR *tl,  /* literal/length tree result */
-inflate_huft * FAR *td,  /* distance tree result */
-z_streamp z              /* for memory allocation */
+uIntf *bl,                      /* literal desired/actual bit depth */
+uIntf *bd,                      /* distance desired/actual bit depth */
+const inflate_huft * FAR *tl,   /* literal/length tree result */
+const inflate_huft * FAR *td,   /* distance tree result */
+z_streamp z                     /* for memory allocation */
 )
 {
 #ifdef BUILDFIXED

reactos/lib/freetype/src/gzip
inftrees.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- inftrees.h	15 Feb 2004 21:45:34 -0000	1.3
+++ inftrees.h	10 May 2004 17:48:32 -0000	1.4
@@ -56,8 +56,8 @@
 local  int inflate_trees_fixed OF((
     uIntf *,                    /* literal desired/actual bit depth */
     uIntf *,                    /* distance desired/actual bit depth */
-    inflate_huft * FAR *,       /* literal/length tree result */
-    inflate_huft * FAR *,       /* distance tree result */
+    const inflate_huft * FAR *, /* literal/length tree result */
+    const inflate_huft * FAR *, /* distance tree result */
     z_streamp));                /* for memory allocation */
 
 #endif /* _INFTREES_H */

reactos/lib/freetype/src/gzip
infutil.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- infutil.c	15 Feb 2004 21:45:34 -0000	1.4
+++ infutil.c	10 May 2004 17:48:32 -0000	1.5
@@ -11,7 +11,7 @@
 
 
 /* And'ing with mask[n] masks the lower n bits */
-local uInt inflate_mask[17] = {
+local const uInt inflate_mask[17] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff

reactos/lib/freetype/src/gzip
zconf.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- zconf.h	15 Feb 2004 21:45:34 -0000	1.5
+++ zconf.h	10 May 2004 17:48:32 -0000	1.6
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zconf.h,v 1.5 2004/02/15 21:45:34 gvg Exp $ */
+/* @(#) $Id: zconf.h,v 1.6 2004/05/10 17:48:32 gvg Exp $ */
 
 #ifndef _ZCONF_H
 #define _ZCONF_H

reactos/lib/freetype/src/gzip
zutil.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- zutil.c	15 Feb 2004 21:45:34 -0000	1.5
+++ zutil.c	10 May 2004 17:48:32 -0000	1.6
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zutil.c,v 1.5 2004/02/15 21:45:34 gvg Exp $ */
+/* @(#) $Id: zutil.c,v 1.6 2004/05/10 17:48:32 gvg Exp $ */
 
 #include "zutil.h"
 

reactos/lib/freetype/src/gzip
zutil.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- zutil.h	15 Feb 2004 21:45:34 -0000	1.5
+++ zutil.h	10 May 2004 17:48:32 -0000	1.6
@@ -8,7 +8,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* @(#) $Id: zutil.h,v 1.5 2004/02/15 21:45:34 gvg Exp $ */
+/* @(#) $Id: zutil.h,v 1.6 2004/05/10 17:48:32 gvg Exp $ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H

reactos/lib/freetype/src/lzw
Jamfile added at 1.1
diff -N Jamfile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Jamfile	10 May 2004 17:48:33 -0000	1.1
@@ -0,0 +1,9 @@
+# FreeType 2 src/lzw Jamfile (C) 2004 David Turner
+#
+
+SubDir  FT2_TOP $(FT2_SRC_DIR) lzw ;
+
+Library  $(FT2_LIB) : ftlzw.c ;
+
+# end of src/lzw Jamfile
+

reactos/lib/freetype/src/lzw
ftlzw.c added at 1.1
diff -N ftlzw.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ftlzw.c	10 May 2004 17:48:33 -0000	1.1
@@ -0,0 +1,463 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftlzw.c                                                                */
+/*                                                                         */
+/*    FreeType support for .Z compressed files.                            */
+/*                                                                         */
+/*  This optional component relies on NetBSD's zopen().  It should mainly  */
+/*  be used to parse compressed PCF fonts, as found with many X11 server   */
+/*  distributions.                                                         */
+/*                                                                         */
+/*  Copyright 2004 by                                                      */
+/*  Albert Chin-A-Young.                                                   */
+/*                                                                         */
+/*  Based on code in src/gzip/ftgzip.c, Copyright 2004 by                  */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+#include <ft2build.h>
+#include FT_INTERNAL_MEMORY_H
+#include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_DEBUG_H
+#include <string.h>
+#include <stdio.h>
+
+
+#include FT_MODULE_ERRORS_H
+
+#undef __FTERRORS_H__
+
+#define FT_ERR_PREFIX  LZW_Err_
+#define FT_ERR_BASE    FT_Mod_Err_LZW
+
+#include FT_ERRORS_H
+
+
+#ifdef FT_CONFIG_OPTION_USE_LZW
+
+#include "zopen.h"
+
+
+/***************************************************************************/
+/***************************************************************************/
+/*****                                                                 *****/
+/*****                  M E M O R Y   M A N A G E M E N T              *****/
+/*****                                                                 *****/
+/***************************************************************************/
+/***************************************************************************/
+
+/***************************************************************************/
+/***************************************************************************/
+/*****                                                                 *****/
+/*****                   F I L E   D E S C R I P T O R                 *****/
+/*****                                                                 *****/
+/***************************************************************************/
+/***************************************************************************/
+
+#define  FT_LZW_BUFFER_SIZE  4096
+
+  typedef struct FT_LZWFileRec_
+  {
+    FT_Stream   source;         /* parent/source stream        */
+    FT_Stream   stream;         /* embedding stream            */
+    FT_Memory   memory;         /* memory allocator            */
+    s_zstate_t  zstream;        /* lzw input stream            */
+
+    FT_ULong    start;          /* starting position, after .Z header */
+    FT_Byte     input[FT_LZW_BUFFER_SIZE];  /* input buffer */
+
+    FT_Byte     buffer[FT_LZW_BUFFER_SIZE]; /* output buffer */
+    FT_ULong    pos;            /* position in output          */
+    FT_Byte*    cursor;
+    FT_Byte*    limit;
+
+  } FT_LZWFileRec, *FT_LZWFile;
+
+
+  /* check and skip .Z header */
+  static FT_Error
+  ft_lzw_check_header( FT_Stream  stream )
+  {
+    FT_Error  error;
+    FT_Byte   head[2];
+
+
+    if ( FT_STREAM_SEEK( 0 )       ||
+         FT_STREAM_READ( head, 2 ) )
+      goto Exit;
+
+    /* head[0] && head[1] are the magic numbers     */
+    if ( head[0] != 0x1f ||
+         head[1] != 0x9d )
+      error = LZW_Err_Invalid_File_Format;
+
+  Exit:
+    return error;
+  }
+
+
+  static FT_Error
+  ft_lzw_file_init( FT_LZWFile  zip,
+                    FT_Stream   stream,
+                    FT_Stream   source )
+  {
+    s_zstate_t*  zstream = &zip->zstream;
+    FT_Error     error   = LZW_Err_Ok;
+
+
+    zip->stream = stream;
+    zip->source = source;
+    zip->memory = stream->memory;
+
+    zip->limit  = zip->buffer + FT_LZW_BUFFER_SIZE;
+    zip->cursor = zip->limit;
+    zip->pos    = 0;
+
+    /* check and skip .Z header */
+    {
+      stream = source;
+
+      error = ft_lzw_check_header( source );
+      if ( error )
+        goto Exit;
+
+      zip->start = FT_STREAM_POS();
+    }
+
+    /* initialize internal lzw variable */
+    zinit( zstream );
+
+    zstream->avail_in    = 0;
+    zstream->next_in     = zip->buffer;
+    zstream->zs_in_count = source->size - 2;
+
+    if ( zstream->next_in == NULL )
+      error = LZW_Err_Invalid_File_Format;
+
+  Exit:
+    return error;
+  }
+
+
+  static void
+  ft_lzw_file_done( FT_LZWFile  zip )
+  {
+    s_zstate_t*  zstream = &zip->zstream;
+
+
+    /* clear the rest */
+    zstream->next_in   = NULL;
+    zstream->next_out  = NULL;
+    zstream->avail_in  = 0;
+    zstream->avail_out = 0;
+    zstream->total_in  = 0;
+    zstream->total_out = 0;
+
+    zip->memory = NULL;
+    zip->source = NULL;
+    zip->stream = NULL;
+  }
+
+
+  static FT_Error
+  ft_lzw_file_reset( FT_LZWFile  zip )
+  {
+    FT_Stream  stream = zip->source;
+    FT_Error   error;
+
+
+    if ( !FT_STREAM_SEEK( zip->start ) )
+    {
+      s_zstate_t*  zstream = &zip->zstream;
+
+
+      zinit( zstream );
+
+      zstream->avail_in    = 0;
+      zstream->next_in     = zip->input;
+      zstream->total_in    = 0;
+      zstream->avail_out   = 0;
+      zstream->next_out    = zip->buffer;
+      zstream->total_out   = 0;
+      zstream->zs_in_count = zip->source->size - 2;
+
+      zip->limit  = zip->buffer + FT_LZW_BUFFER_SIZE;
+      zip->cursor = zip->limit;
+      zip->pos    = 0;
+    }
+
+    return error;
+  }
+
+
+  static FT_Error
+  ft_lzw_file_fill_input( FT_LZWFile  zip )
+  {
+    s_zstate_t*  zstream = &zip->zstream;
+    FT_Stream    stream  = zip->source;
+    FT_ULong     size;
+
+
+    if ( stream->read )
+    {
+      size = stream->read( stream, stream->pos, zip->input,
+                           FT_LZW_BUFFER_SIZE );
+      if ( size == 0 )
+        return LZW_Err_Invalid_Stream_Operation;
+    }
+    else
+    {
+      size = stream->size - stream->pos;
+      if ( size > FT_LZW_BUFFER_SIZE )
+        size = FT_LZW_BUFFER_SIZE;
+
+      if ( size == 0 )
+        return LZW_Err_Invalid_Stream_Operation;
+
+      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
+    }
+    stream->pos += size;
+
+    zstream->next_in  = zip->input;
+    zstream->avail_in = size;
+
+    return LZW_Err_Ok;
+  }
+
+
+
+  static FT_Error
+  ft_lzw_file_fill_output( FT_LZWFile  zip )
+  {
+    s_zstate_t*  zstream = &zip->zstream;
+    FT_Error     error   = 0;
+
+
+    zip->cursor        = zip->buffer;
+    zstream->next_out  = zip->cursor;
+    zstream->avail_out = FT_LZW_BUFFER_SIZE;
+
+    while ( zstream->avail_out > 0 )
+    {
+      int  num_read = 0;
+
+
+      if ( zstream->avail_in == 0 )
+      {
+        error = ft_lzw_file_fill_input( zip );
+        if ( error )
+          break;
+      }
+
+      num_read = zread( zstream );
+
+      if ( num_read == -1 && zstream->zs_in_count == 0 )
+      {
+        zip->limit = zstream->next_out;
+        if ( zip->limit == zip->cursor )
+          error = LZW_Err_Invalid_Stream_Operation;
+        break;
+      }
+      else if ( num_read == -1 )
+        break;
+      else
+        zstream->avail_out -= num_read;
+    }
+
+    return error;
+  }
+
+
+  /* fill output buffer; `count' must be <= FT_LZW_BUFFER_SIZE */
+  static FT_Error
+  ft_lzw_file_skip_output( FT_LZWFile  zip,
+                           FT_ULong    count )
+  {
+    FT_Error  error = LZW_Err_Ok;
+    FT_ULong  delta;
+
+
+    for (;;)
+    {
+      delta = (FT_ULong)( zip->limit - zip->cursor );
+      if ( delta >= count )
+        delta = count;
+
+      zip->cursor += delta;
+      zip->pos    += delta;
+
+      count -= delta;
+      if ( count == 0 )
+        break;
+
+      error = ft_lzw_file_fill_output( zip );
+      if ( error )
+        break;
+    }
+
+    return error;
+  }
+
+
+  static FT_ULong
+  ft_lzw_file_io( FT_LZWFile  zip,
+                  FT_ULong    pos,
+                  FT_Byte*    buffer,
+                  FT_ULong    count )
+  {
+    FT_ULong  result = 0;
+    FT_Error  error;
+
+
+    /* Teset inflate stream if we're seeking backwards.        */
+    /* Yes, that is not too efficient, but it saves memory :-) */
+    if ( pos < zip->pos )
+    {
+      error = ft_lzw_file_reset( zip );
+      if ( error )
+        goto Exit;
+    }
+
+    /* skip unwanted bytes */
+    if ( pos > zip->pos )
+    {
+      error = ft_lzw_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );
+      if ( error )
+        goto Exit;
+    }
+
+    if ( count == 0 )
+      goto Exit;
+
+    /* now read the data */
+    for (;;)
+    {
+      FT_ULong  delta;
+
+
+      delta = (FT_ULong)( zip->limit - zip->cursor );
+      if ( delta >= count )
+        delta = count;
+
+      FT_MEM_COPY( buffer, zip->cursor, delta );
+      buffer      += delta;
+      result      += delta;
+      zip->cursor += delta;
+      zip->pos    += delta;
+
+      count -= delta;
+      if ( count == 0 )
+        break;
+
+      error = ft_lzw_file_fill_output( zip );
+      if ( error )
+        break;
+    }
+
+  Exit:
+    return result;
+  }
+
+
+/***************************************************************************/
+/***************************************************************************/
+/*****                                                                 *****/
+/*****            L Z W   E M B E D D I N G   S T R E A M              *****/
+/*****                                                                 *****/
+/***************************************************************************/
+/***************************************************************************/
+
+  static void
+  ft_lzw_stream_close( FT_Stream  stream )
+  {
+    FT_LZWFile  zip    = (FT_LZWFile)stream->descriptor.pointer;
+    FT_Memory   memory = stream->memory;
+
+
+    if ( zip )
+    {
+      /* finalize lzw file descriptor */
+      ft_lzw_file_done( zip );
+
+      FT_FREE( zip );
+
+      stream->descriptor.pointer = NULL;
+    }
+  }
+
+
+  static FT_ULong
+  ft_lzw_stream_io( FT_Stream  stream,
+                    FT_ULong   pos,
+                    FT_Byte*   buffer,
+                    FT_ULong   count )
+  {
+    FT_LZWFile  zip = (FT_LZWFile)stream->descriptor.pointer;
+
+
+    return ft_lzw_file_io( zip, pos, buffer, count );
+  }
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Stream_OpenLZW( FT_Stream  stream,
+                     FT_Stream  source )
+  {
+    FT_Error    error;
+    FT_Memory   memory = source->memory;
+    FT_LZWFile  zip;
+
+
+    FT_ZERO( stream );
+    stream->memory = memory;
+
+    if ( !FT_NEW( zip ) )
+    {
+      error = ft_lzw_file_init( zip, stream, source );
+      if ( error )
+      {
+        FT_FREE( zip );
+        goto Exit;
+      }
+
+      stream->descriptor.pointer = zip;
+    }
+
+    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */
+    stream->pos   = 0;
+    stream->base  = 0;
+    stream->read  = ft_lzw_stream_io;
+    stream->close = ft_lzw_stream_close;
+
+  Exit:
+    return error;
+  }
+
+#include "zopen.c"
+
+
+#else  /* !FT_CONFIG_OPTION_USE_LZW */
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Stream_OpenLZW( FT_Stream  stream,
+                     FT_Stream  source )
+  {
+    FT_UNUSED( stream );
+    FT_UNUSED( source );
+
+    return LZW_Err_Unimplemented_Feature;
+  }
+
+
+#endif /* !FT_CONFIG_OPTION_USE_LZW */
+
+
+/* END */

reactos/lib/freetype/src/lzw
rules.mk added at 1.1
diff -N rules.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ rules.mk	10 May 2004 17:48:33 -0000	1.1
@@ -0,0 +1,70 @@
+#
+# FreeType 2 LZW support configuration rules
+#
+
+
+# Copyright 2004 by
+# Albert Chin-A-Young.
+#
+# Based on src/lzw/rules.mk, Copyright 2002 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+
+# LZW driver directory
+#
+LZW_DIR := $(SRC_DIR)/lzw
+
+
+# compilation flags for the driver
+#
+LZW_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(LZW_DIR))
+
+
+# LZW support sources (i.e., C files)
+#
+LZW_DRV_SRC := $(LZW_DIR)/ftlzw.c \
+               $(LZW_DIR)/zopen.c
+
+# LZW support headers
+#
+LZW_DRV_H := $(LZW_DIR)/zopen.h
+
+
+# LZW driver object(s)
+#
+#   LZW_DRV_OBJ_M is used during `multi' builds
+#   LZW_DRV_OBJ_S is used during `single' builds
+#
+LZW_DRV_OBJ_M := $(OBJ_DIR)/ftlzw.$O
+LZW_DRV_OBJ_S := $(OBJ_DIR)/ftlzw.$O
+
+# LZW support source file for single build
+#
+LZW_DRV_SRC_S := $(LZW_DIR)/ftlzw.c
+
+
+# LZW support - single object
+#
+$(LZW_DRV_OBJ_S): $(LZW_DRV_SRC_S) $(LZW_DRV_SRC) $(FREETYPE_H) $(LZW_DRV_H)
+	$(LZW_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(LZW_DRV_SRC_S))
+
+
+# LZW support - multiple objects
+#
+$(OBJ_DIR)/%.$O: $(LZW_DIR)/%.c $(FREETYPE_H) $(LZW_DRV_H)
+	$(LZW_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
+
+
+# update main driver object lists
+#
+DRV_OBJS_S += $(LZW_DRV_OBJ_S)
+DRV_OBJS_M += $(LZW_DRV_OBJ_M)
+
+
+# EOF

reactos/lib/freetype/src/lzw
zopen.c added at 1.1
diff -N zopen.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ zopen.c	10 May 2004 17:48:33 -0000	1.1
@@ -0,0 +1,396 @@
+/*	$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*-
+ *
+ * Copyright (c) 2004
+ *	Albert Chin-A-Young.
+ *
+ * Modified to work with FreeType's PCF driver.
+ *
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)zopen.c	8.1 (Berkeley) 6/27/93";
+#else
+static char rcsid[] = "$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $";
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+/*-
+ * fcompress.c - File compression ala IEEE Computer, June 1984.
+ *
+ * Compress authors:
+ *		Spencer W. Thomas	(decvax!utah-cs!thomas)
+ *		Jim McKie		(decvax!mcvax!jim)
+ *		Steve Davies		(decvax!vax135!petsd!peora!srd)
+ *		Ken Turkowski		(decvax!decwrl!turtlevax!ken)
+ *		James A. Woods		(decvax!ihnp4!ames!jaw)
+ *		Joe Orost		(decvax!vax135!petsd!joe)
+ *
+ * Cleaned up and converted to library returning I/O streams by
+ * Diomidis Spinellis <dds@doc.ic.ac.uk>.
+ */
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if 0
+static char_type magic_header[] =
+	{ 0x1f, 0x9d };		/* 1F 9D */
+#endif
+
+#define	BIT_MASK	0x1f		/* Defines for third byte of header. */
+#define	BLOCK_MASK	0x80
+
+/*
+ * Masks 0x40 and 0x20 are free.  I think 0x20 should mean that there is
+ * a fourth header byte (for expansion).
+ */
+#define	INIT_BITS 9			/* Initial number of bits/code. */
+
+#define	MAXCODE(n_bits)	((1 << (n_bits)) - 1)
+
+/* Definitions to retain old variable names */
+#define	fp		zs->zs_fp
+#define	state		zs->zs_state
+#define	n_bits		zs->zs_n_bits
+#define	maxbits		zs->zs_maxbits
+#define	maxcode		zs->zs_maxcode
+#define	maxmaxcode	zs->zs_maxmaxcode
+#define	htab		zs->zs_htab
+#define	codetab		zs->zs_codetab
+#define	hsize		zs->zs_hsize
+#define	free_ent	zs->zs_free_ent
+#define	block_compress	zs->zs_block_compress
+#define	clear_flg	zs->zs_clear_flg
+#define	offset		zs->zs_offset
+#define	in_count	zs->zs_in_count
+#define	buf_len		zs->zs_buf_len
+#define	buf		zs->zs_buf
+#define	stackp		zs->u.r.zs_stackp
+#define	finchar		zs->u.r.zs_finchar
+#define	code		zs->u.r.zs_code
+#define	oldcode		zs->u.r.zs_oldcode
+#define	incode		zs->u.r.zs_incode
+#define	roffset		zs->u.r.zs_roffset
+#define	size		zs->u.r.zs_size
+#define	gbuf		zs->u.r.zs_gbuf
+
+/*
+ * To save much memory, we overlay the table used by compress() with those
+ * used by decompress().  The tab_prefix table is the same size and type as
+ * the codetab.  The tab_suffix table needs 2**BITS characters.  We get this
+ * from the beginning of htab.  The output stack uses the rest of htab, and
+ * contains characters.  There is plenty of room for any possible stack
+ * (stack used to be 8000 characters).
+ */
+
+#define	htabof(i)	htab[i]
+#define	codetabof(i)	codetab[i]
+
+#define	tab_prefixof(i)	codetabof(i)
+#define	tab_suffixof(i)	((char_type *)(htab))[i]
+#define	de_stack	((char_type *)&tab_suffixof(1 << BITS))
+
+#define	CHECK_GAP 10000		/* Ratio check interval. */
+
+/*
+ * the next two codes should not be changed lightly, as they must not
+ * lie within the contiguous general code space.
+ */
+#define	FIRST	257		/* First free entry. */
+#define	CLEAR	256		/* Table clear output code. */
+
+/*-
+ * Algorithm from "A Technique for High Performance Data Compression",
+ * Terry A. Welch, IEEE Computer Vol 17, No 6 (June 1984), pp 8-19.
+ *
+ * Algorithm:
+ * 	Modified Lempel-Ziv method (LZW).  Basically finds common
+ * substrings and replaces them with a variable size code.  This is
+ * deterministic, and can be done on the fly.  Thus, the decompression
+ * procedure needs no input table, but tracks the way the table was built.
+ */
+
+#if 0
+static int
+zclose(s_zstate_t *zs)
+{
+	free(zs);
+	return (0);
+}
+#endif
+
+/*-
+ * Output the given code.
+ * Inputs:
+ * 	code:	A n_bits-bit integer.  If == -1, then EOF.  This assumes
+ *		that n_bits =< (long)wordsize - 1.
+ * Outputs:
+ * 	Outputs code to the file.
+ * Assumptions:
+ *	Chars are 8 bits long.
+ * Algorithm:
+ * 	Maintain a BITS character long buffer (so that 8 codes will
+ * fit in it exactly).  Use the VAX insv instruction to insert each
+ * code in turn.  When the buffer fills up empty it and start over.
+ */
+
+static const char_type rmask[9] =
+	{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
+
+/*
+ * Decompress read.  This routine adapts to the codes in the file building
+ * the "string" table on-the-fly; requiring no table to be stored in the
+ * compressed file.  The tables used herein are shared with those of the
+ * compress() routine.  See the definitions above.
+ */
+static int
+zread(s_zstate_t *zs)
+{
+	unsigned int count;
+
+	if (in_count == 0)
+		return -1;
+	if (zs->avail_out == 0)
+		return 0;
+
+	count = zs->avail_out;
+	switch (state) {
+	case S_START:
+		state = S_MIDDLE;
+		break;
+	case S_MIDDLE:
+		goto middle;
+	case S_EOF:
+		goto eof;
+	}
+
+	maxbits = *(zs->next_in);	/* Set -b from file. */
+	zs->avail_in--;
+	zs->next_in++;
+	zs->total_in++;
+	in_count--;
+	block_compress = maxbits & BLOCK_MASK;
+	maxbits &= BIT_MASK;
+	maxmaxcode = 1L << maxbits;
+	if (maxbits > BITS) {
+		return -1;
+	}
+	/* As above, initialize the first 256 entries in the table. */
+	maxcode = MAXCODE(n_bits = INIT_BITS);
+	for (code = 255; code >= 0; code--) {
+		tab_prefixof(code) = 0;
+		tab_suffixof(code) = (char_type) code;
+	}
+	free_ent = block_compress ? FIRST : 256;
+
+	finchar = oldcode = getcode(zs);
+	if (oldcode == -1)		/* EOF already? */
+		return 0;		/* Get out of here */
+
+	/* First code must be 8 bits = char. */
+	*(zs->next_out)++ = (unsigned char)finchar;
+	zs->total_out++;
+	count--;
+	stackp = de_stack;
+
+	while ((code = getcode(zs)) > -1) {
+		if ((code == CLEAR) && block_compress) {
+			for (code = 255; code >= 0; code--)
+				tab_prefixof(code) = 0;
+			clear_flg = 1;
+			free_ent = FIRST - 1;
+			if ((code = getcode(zs)) == -1)
+				/* O, untimely death! */
+				break;
+		}
+		incode = code;
+
+		/* Special case for KwKwK string. */
+		if (code >= free_ent) {
+			*stackp++ = finchar;
+			code = oldcode;
+		}
+
+		/* Generate output characters in reverse order. */
+		while (code >= 256) {
+			*stackp++ = tab_suffixof(code);
+			code = tab_prefixof(code);
+		}
+		*stackp++ = finchar = tab_suffixof(code);
+
+		/* And put them out in forward order.  */
+middle:
+		if (stackp == de_stack)
+			continue;
+
+		do {
+			if (count-- == 0) {
+				return zs->avail_out;
+			}
+			*(zs->next_out)++ = *--stackp;
+			zs->total_out++;
+		} while (stackp > de_stack);
+
+		/* Generate the new entry. */
+		if ((code = free_ent) < maxmaxcode) {
+			tab_prefixof(code) = (unsigned short) oldcode;
+			tab_suffixof(code) = finchar;
+			free_ent = code + 1;
+		}
+
+		/* Remember previous code. */
+		oldcode = incode;
+	}
+	/* state = S_EOF; */
+eof:	return (zs->avail_out - count);
+}
+
+/*-
+ * Read one code from the standard input.  If EOF, return -1.
+ * Inputs:
+ * 	stdin
+ * Outputs:
+ * 	code or -1 is returned.
+ */
+static code_int
+getcode(s_zstate_t *zs)
+{
+	code_int gcode;
+	int r_off, bits;
+	char_type *bp;
+
+	bp = gbuf;
+	if (clear_flg > 0 || roffset >= size || free_ent > maxcode) {
+		/*
+		 * If the next entry will be too big for the current gcode
+		 * size, then we must increase the size.  This implies reading
+		 * a new buffer full, too.
+		 */
+		if (free_ent > maxcode) {
+			n_bits++;
+			if (n_bits == maxbits)	/* Won't get any bigger now. */
+				maxcode = maxmaxcode;
+			else
+				maxcode = MAXCODE(n_bits);
+		}
+		if (clear_flg > 0) {
+			maxcode = MAXCODE(n_bits = INIT_BITS);
+			clear_flg = 0;
+		}
+		if ( zs->avail_in < (unsigned int)n_bits && in_count > (long)n_bits ) {
+			memcpy (buf, zs->next_in, zs->avail_in);
+			buf_len = zs->avail_in;
+			zs->avail_in = 0;
+			return -1;
+		}
+		if (buf_len) {
+			memcpy (gbuf, buf, buf_len);
+			memcpy (gbuf + buf_len, zs->next_in,
+				n_bits - buf_len);
+			zs->next_in += n_bits - buf_len;
+			zs->avail_in -= n_bits - buf_len;
+			buf_len = 0;
+			zs->total_in += n_bits;
+			size = n_bits;
+			in_count -= n_bits;
+		} else {
+			if (in_count > n_bits) {
+				memcpy (gbuf, zs->next_in, n_bits);
+				zs->next_in += n_bits;
+				zs->avail_in -= n_bits;
+				zs->total_in += n_bits;
+				size = n_bits;
+				in_count -= n_bits;
+			} else {
+				memcpy (gbuf, zs->next_in, in_count);
+				zs->next_in += in_count;
+				zs->avail_in -= in_count;
+				zs->total_in += in_count;
+				size = in_count;
+				in_count = 0;
+			}
+		}
+		roffset = 0;
+		/* Round size down to integral number of codes. */
+		size = (size << 3) - (n_bits - 1);
+	}
+	r_off = roffset;
+	bits = n_bits;
+
+	/* Get to the first byte. */
+	bp += (r_off >> 3);
+	r_off &= 7;
+
+	/* Get first part (low order bits). */
+	gcode = (*bp++ >> r_off);
+	bits -= (8 - r_off);
+	r_off = 8 - r_off;	/* Now, roffset into gcode word. */
+
+	/* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+	if (bits >= 8) {
+		gcode |= *bp++ << r_off;
+		r_off += 8;
+		bits -= 8;
+	}
+
+	/* High order bits. */
+	gcode |= (*bp & rmask[bits]) << r_off;
+	roffset += n_bits;
+
+	return (gcode);
+}
+
+static void
+zinit(s_zstate_t *zs)
+{
+	memset(zs, 0, sizeof (s_zstate_t));
+
+	maxbits = BITS;			/* User settable max # bits/code. */
+	maxmaxcode = 1 << maxbits;	/* Should NEVER generate this code. */
+	hsize = HSIZE;			/* For dynamic table sizing. */
+	free_ent = 0;			/* First unused entry. */
+	block_compress = BLOCK_MASK;
+	clear_flg = 0;
+	state = S_START;
+	roffset = 0;
+	size = 0;
+}

reactos/lib/freetype/src/lzw
zopen.h added at 1.1
diff -N zopen.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ zopen.h	10 May 2004 17:48:33 -0000	1.1
@@ -0,0 +1,114 @@
+/*	$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $	*/
+
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*-
+ *
+ * Copyright (c) 2004
+ *	Albert Chin-A-Young.
+ *
+ * Modified to work with FreeType's PCF driver.
+ *
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)zopen.c	8.1 (Berkeley) 6/27/93";
+#else
+static char rcsid[] = "$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $";
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+
+#define	BITS		16		/* Default bits. */
+#define	HSIZE		69001		/* 95% occupancy */
+
+/* A code_int must be able to hold 2**BITS values of type int, and also -1. */
+typedef long code_int;
+typedef long count_int;
+
+typedef unsigned char char_type;
+
+typedef enum {
+	S_START, S_MIDDLE, S_EOF
+} zs_enum;
+
+typedef struct {
+	unsigned char *next_in;
+	unsigned int avail_in;
+	unsigned long total_in;
+
+	unsigned char *next_out;
+	unsigned int avail_out;
+	unsigned long total_out;
+
+	zs_enum zs_state;		/* State of computation */
+	int zs_n_bits;			/* Number of bits/code. */
+	int zs_maxbits;			/* User settable max # bits/code. */
+	code_int zs_maxcode;		/* Maximum code, given n_bits. */
+	code_int zs_maxmaxcode;		/* Should NEVER generate this code. */
+	count_int zs_htab [HSIZE];
+	unsigned short zs_codetab [HSIZE];
+	code_int zs_hsize;		/* For dynamic table sizing. */
+	code_int zs_free_ent;		/* First unused entry. */
+	/*
+	 * Block compression parameters -- after all codes are used up,
+	 * and compression rate changes, start over.
+	 */
+	int zs_block_compress;
+	int zs_clear_flg;
+	int zs_offset;
+	long zs_in_count;		/* Remaining uncompressed bytes. */
+	char_type zs_buf_len;
+	char_type zs_buf[BITS];		/* Temporary buffer if we need
+					   to read more to accumulate
+					   n_bits. */
+	union {
+		struct {
+			char_type *zs_stackp;
+			int zs_finchar;
+			code_int zs_code, zs_oldcode, zs_incode;
+			int zs_roffset, zs_size;
+			char_type zs_gbuf[BITS];
+		} r;			/* Read parameters */
+	} u;
+} s_zstate_t;
+
+static code_int getcode(s_zstate_t *);
+#if 0
+static int      zclose(s_zstate_t *);
+#endif
+static void     zinit(s_zstate_t *);
+static int      zread(s_zstate_t *);

reactos/lib/freetype/src/pcf
pcfdrivr.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- pcfdrivr.c	15 Feb 2004 21:45:34 -0000	1.3
+++ pcfdrivr.c	10 May 2004 17:48:33 -0000	1.4
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf files
 
-    Copyright (C) 2000, 2001, 2002, 2003 by
+    Copyright (C) 2000, 2001, 2002, 2003, 2004 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,12 +31,12 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_GZIP_H
+#include FT_LZW_H
 #include FT_ERRORS_H
 #include FT_BDF_H
 
 #include "pcf.h"
 #include "pcfdrivr.h"
-#include "pcfutil.h"
 #include "pcfread.h"
 
 #include "pcferror.h"
@@ -44,6 +44,8 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pcfread
 
+#include FT_SERVICE_BDF_H
+#include FT_SERVICE_XFREE86_NAME_H
 
   typedef struct  PCF_CMapRec_
   {
@@ -212,7 +214,7 @@
 
     FT_TRACE4(( "PCF_Face_Done: done face\n" ));
 
-    /* close gzip stream if any */
+    /* close gzip/LZW stream if any */
     if ( face->root.stream == &face->gzip_stream )
     {
       FT_Stream_Close( &face->gzip_stream );
@@ -245,21 +247,44 @@
 
       /* this didn't work, try gzip support! */
       error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
-      if ( error2 == PCF_Err_Unimplemented_Feature )
+      if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature )
         goto Fail;
 
       error = error2;
       if ( error )
-        goto Fail;
+      {
+        FT_Error  error3;
 
-      face->gzip_source = stream;
-      face->root.stream = &face->gzip_stream;
 
-      stream = face->root.stream;
+        /* this didn't work, try LZW support! */
+        error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream );
+        if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature )
+          goto Fail;
 
-      error = pcf_load_font( stream, face );
-      if ( error )
-        goto Fail;
+        error = error3;
+        if ( error )
+          goto Fail;
+
+        face->gzip_source = stream;
+        face->root.stream = &face->gzip_stream;
+
+        stream = face->root.stream;
+
+        error = pcf_load_font( stream, face );
+        if ( error )
+          goto Fail;
+      }
+      else
+      {
+        face->gzip_source = stream;
+        face->root.stream = &face->gzip_stream;
+
+        stream = face->root.stream;
+
+        error = pcf_load_font( stream, face );
+        if ( error )
+          goto Fail;
+      }
     }
 
     /* set-up charmap */
@@ -334,9 +359,9 @@
 
 
     FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
-                                      face->root.available_sizes->height ));
+                                      face->root.available_sizes->y_ppem >> 6 ));
 
-    if ( size->metrics.y_ppem == face->root.available_sizes->height )
+    if ( size->metrics.y_ppem == face->root.available_sizes->y_ppem >> 6 )
     {
       size->metrics.ascender    = face->accel.fontAscent << 6;
       size->metrics.descender   = face->accel.fontDescent * (-64);
@@ -471,6 +496,12 @@
   }
 
 
+ /*
+  *
+  *  BDF SERVICE
+  *
+  */
+
   static FT_Error
   pcf_get_bdf_property( PCF_Face          face,
                         const char*       prop_name,
@@ -503,16 +534,46 @@
   }
 
 
+  static FT_Error
+  pcf_get_charset_id( PCF_Face      face,
+                      const char*  *acharset_encoding,
+                      const char*  *acharset_registry )
+  {
+    *acharset_encoding = face->charset_encoding;
+    *acharset_registry = face->charset_registry;
+
+    return 0;
+  }
+
+
+  static const FT_Service_BDFRec  pcf_service_bdf =
+  {
+    (FT_BDF_GetCharsetIdFunc)pcf_get_charset_id,
+    (FT_BDF_GetPropertyFunc) pcf_get_bdf_property
+  };
+
+
+ /*
+  *
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  pcf_services[] =
+  {
+    { FT_SERVICE_ID_BDF,       &pcf_service_bdf },
+    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF },
+    { NULL, NULL }
+  };
+
+
   static FT_Module_Interface
   pcf_driver_requester( FT_Module    module,
                         const char*  name )
   {
     FT_UNUSED( module );
 
-    if ( name && ft_strcmp( name, "get_bdf_property" ) == 0 )
-      return (FT_Module_Interface) pcf_get_bdf_property;
-
-    return NULL;
+    return ft_service_list_lookup( pcf_services, name );
   }
 
 

reactos/lib/freetype/src/pcf
pcfread.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- pcfread.c	15 Feb 2004 21:45:34 -0000	1.5
+++ pcfread.c	10 May 2004 17:48:33 -0000	1.6
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf fonts
 
-  Copyright 2000, 2001, 2002, 2003 by
+  Copyright 2000, 2001, 2002, 2003, 2004 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -49,7 +49,7 @@
 
 
 #if defined( FT_DEBUG_LEVEL_TRACE )
-  static const char*  tableNames[] =
+  static const char* const  tableNames[] =
   {
     "prop", "accl", "mtrcs", "bmps", "imtrcs",
     "enc", "swidth", "names", "accel"
@@ -862,6 +862,116 @@
   }
 
 
+  static FT_Error
+  pcf_interpret_style( PCF_Face  pcf )
+  {
+    FT_Error   error  = PCF_Err_Ok;
+    FT_Face    face   = FT_FACE( pcf );
+    FT_Memory  memory = face->memory;
+
+    PCF_Property  prop;
+
+    char  *istr = NULL, *bstr = NULL;
+    char  *sstr = NULL, *astr = NULL;
+
+    int  parts = 0, len = 0;
+
+
+    face->style_flags = 0;
+
+    prop = pcf_find_property( pcf, "SLANT" );
+    if ( prop && prop->isString                                       &&
+         ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ||
+           *(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )
+    {
+      face->style_flags |= FT_STYLE_FLAG_ITALIC;
+      istr = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' )
+               ? (char *)"Oblique"
+               : (char *)"Italic";
+      len += ft_strlen( istr );
+      parts++;
+    }
+
+    prop = pcf_find_property( pcf, "WEIGHT_NAME" );
+    if ( prop && prop->isString                                       &&
+         ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) )
+    {
+      face->style_flags |= FT_STYLE_FLAG_BOLD;
+      bstr = (char *)"Bold";
+      len += ft_strlen( bstr );
+      parts++;
+    }
+
+    prop = pcf_find_property( pcf, "SETWIDTH_NAME" );
+    if ( prop && prop->isString                                        &&
+         *(prop->value.atom)                                           &&
+         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
+    {
+      sstr = (char *)(prop->value.atom);
+      len += ft_strlen( sstr );
+      parts++;
+    }
+
+    prop = pcf_find_property( pcf, "ADD_STYLE_NAME" );
+    if ( prop && prop->isString                                        &&
+         *(prop->value.atom)                                           &&
+         !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
+    {
+      astr = (char *)(prop->value.atom);
+      len += ft_strlen( astr );
+      parts++;
+    }
+
+    if ( !parts || !len )
+      face->style_name = (char *)"Regular";
+    else
+    {
+      char          *style, *s;
+      unsigned int  i;
+
+
+      if ( FT_ALLOC( style, len + parts ) )
+        return error;
+
+      s = style;
+
+      if ( astr )
+      {
+        ft_strcpy( s, astr );
+        for ( i = 0; i < ft_strlen( astr ); i++, s++ )
+          if ( *s == ' ' )
+            *s = '-';                     /* replace spaces with dashes */
+        *(s++) = ' ';
+      }
+      if ( bstr )
+      {
+        ft_strcpy( s, bstr );
+        s += ft_strlen( bstr );
+        *(s++) = ' ';
+      }
+      if ( istr )
+      {
+        ft_strcpy( s, istr );
+        s += ft_strlen( istr );
+        *(s++) = ' ';
+      }
+      if ( sstr )
+      {
+        ft_strcpy( s, sstr );
+        for ( i = 0; i < ft_strlen( sstr ); i++, s++ )
+          if ( *s == ' ' )
+            *s = '-';                     /* replace spaces with dashes */
+        *(s++) = ' ';
+      }
+      *(--s) = '\0';        /* overwrite last ' ', terminate the string */
+
+      face->style_name = style;                     /* allocated string */
+    }
+
+    return error;
+  }
+
+
   FT_LOCAL_DEF( FT_Error )
   pcf_load_font( FT_Stream  stream,
                  PCF_Face   face )
@@ -930,49 +1040,21 @@
       if ( face->accel.constantWidth )
         root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
-      root->style_flags = 0;
-      prop = pcf_find_property( face, "SLANT" );
-      if ( prop != NULL )
-        if ( prop->isString )
-          if ( ( *(prop->value.atom) == 'O' ) ||
-               ( *(prop->value.atom) == 'o' ) ||
-               ( *(prop->value.atom) == 'I' ) ||
-               ( *(prop->value.atom) == 'i' ) )
-            root->style_flags |= FT_STYLE_FLAG_ITALIC;
-
-      prop = pcf_find_property( face, "WEIGHT_NAME" );
-      if ( prop != NULL )
-        if ( prop->isString )
-          if ( ( *(prop->value.atom) == 'B' ) ||
-               ( *(prop->value.atom) == 'b' ) )
-            root->style_flags |= FT_STYLE_FLAG_BOLD;
-
-      root->style_name = (char *)"Regular";
-
-      if ( root->style_flags & FT_STYLE_FLAG_BOLD ) {
-        if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-          root->style_name = (char *)"Bold Italic";
-        else
-          root->style_name = (char *)"Bold";
-      }
-      else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
-        root->style_name = (char *)"Italic";
+      if ( ( error = pcf_interpret_style( face ) ) != 0 )
+         goto Exit;
 
       prop = pcf_find_property( face, "FAMILY_NAME" );
-      if ( prop != NULL )
+      if ( prop && prop->isString )
       {
-        if ( prop->isString )
-        {
-          int  l = ft_strlen( prop->value.atom ) + 1;
+        int  l = ft_strlen( prop->value.atom ) + 1;
 
 
-          if ( FT_NEW_ARRAY( root->family_name, l ) )
-            goto Exit;
-          ft_strcpy( root->family_name, prop->value.atom );
-        }
+        if ( FT_NEW_ARRAY( root->family_name, l ) )
+          goto Exit;
+        ft_strcpy( root->family_name, prop->value.atom );
       }
       else
-        root->family_name = 0;
+        root->family_name = NULL;
 
       /* Note: We shift all glyph indices by +1 since we must
        * respect the convention that glyph 0 always corresponds
@@ -988,39 +1070,47 @@
 
       {
         FT_Bitmap_Size*  bsize = root->available_sizes;
+        FT_Short         resolution_x = 0, resolution_y = 0;
 
 
         FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
 
-        prop = pcf_find_property( face, "PIXEL_SIZE" );
-        if ( prop != NULL )
-          bsize->height = (FT_Short)prop->value.integer;
+        bsize->height = face->accel.fontAscent + face->accel.fontDescent;
 
         prop = pcf_find_property( face, "AVERAGE_WIDTH" );
-        if ( prop != NULL )
+        if ( prop )
           bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 );
+        else
+          bsize->width = bsize->height * 2/3;
 
         prop = pcf_find_property( face, "POINT_SIZE" );
-        if ( prop != NULL )
-          /* convert from 722,7 decipoints to 72 points per inch */
+        if ( prop )
+          /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
             (FT_Pos)( ( prop->value.integer * 64 * 7200 + 36135L ) / 72270L );
 
+        prop = pcf_find_property( face, "PIXEL_SIZE" );
+        if ( prop )
+          bsize->y_ppem = (FT_Short)prop->value.integer << 6;
+
         prop = pcf_find_property( face, "RESOLUTION_X" );
-        if ( prop != NULL )
-          bsize->x_ppem =
-            (FT_Pos)( ( prop->value.integer * bsize->size + 36 ) / 72 );
+        if ( prop )
+          resolution_x = (FT_Short)prop->value.integer;
 
         prop = pcf_find_property( face, "RESOLUTION_Y" );
-        if ( prop != NULL )
-          bsize->y_ppem =
-            (FT_Pos)( ( prop->value.integer * bsize->size + 36 ) / 72 );
-
-        if ( bsize->height == 0 )
-          bsize->height = (FT_Short)( ( bsize->y_ppem + 32 ) / 64 );
+        if ( prop )
+          resolution_y = (FT_Short)prop->value.integer;
 
-        if ( bsize->height == 0 )
-          bsize->height = 12;
+        if ( bsize->y_ppem == 0 )
+        {
+          bsize->y_ppem = bsize->size;
+          if ( resolution_y )
+            bsize->y_ppem = bsize->y_ppem * resolution_y / 72;
+        }
+        if ( resolution_x && resolution_y )
+          bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;
+        else
+          bsize->x_ppem = bsize->y_ppem;
       }
 
       /* set up charset */
@@ -1031,23 +1121,19 @@
         charset_registry = pcf_find_property( face, "CHARSET_REGISTRY" );
         charset_encoding = pcf_find_property( face, "CHARSET_ENCODING" );
 
-        if ( ( charset_registry != NULL ) &&
-             ( charset_encoding != NULL ) )
+        if ( charset_registry && charset_registry->isString &&
+             charset_encoding && charset_encoding->isString )
         {
-          if ( ( charset_registry->isString ) &&
-               ( charset_encoding->isString ) )
-          {
-            if ( FT_NEW_ARRAY( face->charset_encoding,
-                               ft_strlen( charset_encoding->value.atom ) + 1 ) )
-              goto Exit;
-
-            if ( FT_NEW_ARRAY( face->charset_registry,
-                               ft_strlen( charset_registry->value.atom ) + 1 ) )
-              goto Exit;
-
-            ft_strcpy( face->charset_registry, charset_registry->value.atom );
-            ft_strcpy( face->charset_encoding, charset_encoding->value.atom );
-          }
+          if ( FT_NEW_ARRAY( face->charset_encoding,
+                             ft_strlen( charset_encoding->value.atom ) + 1 ) )
+            goto Exit;
+
+          if ( FT_NEW_ARRAY( face->charset_registry,
+                             ft_strlen( charset_registry->value.atom ) + 1 ) )
+            goto Exit;
+
+          ft_strcpy( face->charset_registry, charset_registry->value.atom );
+          ft_strcpy( face->charset_encoding, charset_encoding->value.atom );
         }
       }
     }

reactos/lib/freetype/src/pcf
pcfutil.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- pcfutil.c	1 Apr 2003 08:38:20 -0000	1.1
+++ pcfutil.c	10 May 2004 17:48:33 -0000	1.2
@@ -25,6 +25,8 @@
  * Author:  Keith Packard, MIT X Consortium
  */
 
+/* Modified for use with FreeType */
+
 
 #include <ft2build.h>
 #include "pcfutil.h"
@@ -72,7 +74,7 @@
    *  Invert bit order within each BYTE of an array.
    */
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes )
   {
@@ -88,7 +90,7 @@
    *  Invert byte order within each 16-bits of an array.
    */
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes )
   {
@@ -107,7 +109,7 @@
    *  Invert byte order within each 32-bits of an array.
    */
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes )
   {
@@ -127,89 +129,4 @@
   }
 
 
-  /*
-   *  Repad a bitmap.
-   */
-
-  int
-  RepadBitmap( char*         pSrc,
-               char*         pDst,
-               unsigned int  srcPad,
-               unsigned int  dstPad,
-               int           width,
-               int           height )
-  {
-    int   srcWidthBytes, dstWidthBytes;
-    int   row, col;
-    char  *pTmpSrc, *pTmpDst;
-
-
-    switch ( srcPad )
-    {
-    case 1:
-      srcWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      srcWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      srcWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      srcWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    switch ( dstPad )
-    {
-    case 1:
-      dstWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      dstWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      dstWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      dstWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    width = srcWidthBytes;
-    if ( width > dstWidthBytes )
-      width = dstWidthBytes;
-
-    pTmpSrc= pSrc;
-    pTmpDst= pDst;
-
-    for ( row = 0; row < height; row++ )
-    {
-      for ( col = 0; col < width; col++ )
-        *pTmpDst++ = *pTmpSrc++;
-
-      while ( col < dstWidthBytes )
-      {
-        *pTmpDst++ = '\0';
-        col++;
-      }
-      pTmpSrc += srcWidthBytes - width;
-    }
-
-    return dstWidthBytes * height;
-  }
-
-
 /* END */

reactos/lib/freetype/src/pcf
pcfutil.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- pcfutil.h	1 Apr 2003 08:38:20 -0000	1.1
+++ pcfutil.h	10 May 2004 17:48:33 -0000	1.2
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf fonts
 
-  Copyright 2000-2001 by
+  Copyright 2000, 2001, 2004 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,25 +32,18 @@
 #include <ft2build.h>
 
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes);
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes);
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes);
 
-  int
-  RepadBitmap( char*           pSrc,
-               char*           pDst,
-               unsigned int    srcPad,
-               unsigned int    dstPad,
-               int             width,
-               int             height);
 
 #endif /* __PCFUTIL_H__ */
 

reactos/lib/freetype/src/pfr
pfrdrivr.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- pfrdrivr.c	15 Feb 2004 21:45:34 -0000	1.4
+++ pfrdrivr.c	10 May 2004 17:48:33 -0000	1.5
@@ -19,10 +19,13 @@
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_PFR_H
+#include FT_SERVICE_PFR_H
+#include FT_SERVICE_XFREE86_NAME_H
 #include "pfrdrivr.h"
 #include "pfrobjs.h"
 
+#include "pfrerror.h"
+
 
   static FT_Error
   pfr_get_kerning( PFR_Face    face,
@@ -51,23 +54,28 @@
   }
 
 
+ /*
+  *  PFR METRICS SERVICE
+  *
+  */
+
   static FT_Error
-  pfr_get_advance( PFR_Face   face,
-                   FT_UInt    gindex,
-                   FT_Pos    *aadvance )
+  pfr_get_advance( PFR_Face  face,
+                   FT_UInt   gindex,
+                   FT_Pos   *anadvance )
   {
     FT_Error  error = PFR_Err_Bad_Argument;
 
 
-    *aadvance = 0;
+    *anadvance = 0;
     if ( face )
     {
-      PFR_PhyFont  phys  = &face->phy_font;
+      PFR_PhyFont  phys = &face->phy_font;
 
 
       if ( gindex < phys->num_chars )
       {
-        *aadvance = phys->chars[ gindex ].advance;
+        *anadvance = phys->chars[gindex].advance;
         error = 0;
       }
     }
@@ -78,18 +86,18 @@
 
   static FT_Error
   pfr_get_metrics( PFR_Face   face,
-                   FT_UInt   *aoutline_resolution,
+                   FT_UInt   *anoutline_resolution,
                    FT_UInt   *ametrics_resolution,
                    FT_Fixed  *ametrics_x_scale,
                    FT_Fixed  *ametrics_y_scale )
   {
-    PFR_PhyFont  phys  = &face->phy_font;
+    PFR_PhyFont  phys = &face->phy_font;
     FT_Fixed     x_scale, y_scale;
     FT_Size      size = face->root.size;
 
 
-    if ( aoutline_resolution )
-      *aoutline_resolution = phys->outline_resolution;
+    if ( anoutline_resolution )
+      *anoutline_resolution = phys->outline_resolution;
 
     if ( ametrics_resolution )
       *ametrics_resolution = phys->metrics_resolution;
@@ -112,19 +120,42 @@
     if ( ametrics_y_scale )
       *ametrics_y_scale = y_scale;
 
-    return 0;
+    return PFR_Err_Ok;
   }
 
 
   FT_CALLBACK_TABLE_DEF
-  const FT_PFR_ServiceRec  pfr_service_rec =
+  const FT_Service_PfrMetricsRec  pfr_metrics_service_rec =
+  {
+    (FT_PFR_GetMetricsFunc)pfr_get_metrics,
+    (FT_PFR_GetKerningFunc)pfr_face_get_kerning,
+    (FT_PFR_GetAdvanceFunc)pfr_get_advance
+  };
+
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  pfr_services[] =
   {
-    (FT_PFR_GetMetricsFunc)  pfr_get_metrics,
-    (FT_PFR_GetKerningFunc)  pfr_get_kerning,
-    (FT_PFR_GetAdvanceFunc)  pfr_get_advance
+    { FT_SERVICE_ID_PFR_METRICS, &pfr_metrics_service_rec },
+    { FT_SERVICE_ID_XF86_NAME,   FT_XF86_FORMAT_PFR },
+    { NULL, NULL }
   };
 
 
+  static FT_Module_Interface
+  pfr_get_service( FT_Driver         driver,
+                   const FT_String*  service_id )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( pfr_services, service_id );
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const FT_Driver_ClassRec  pfr_driver_class =
   {
@@ -138,31 +169,31 @@
       0x10000L,
       0x20000L,
 
-      (FT_PFR_Service)  &pfr_service_rec,   /* format interface */
+      NULL,
 
       (FT_Module_Constructor)NULL,
       (FT_Module_Destructor) NULL,
-      (FT_Module_Requester)  NULL
+      (FT_Module_Requester)  pfr_get_service
     },
 
     sizeof( PFR_FaceRec ),
     sizeof( PFR_SizeRec ),
     sizeof( PFR_SlotRec ),
 
-    (FT_Face_InitFunc)        pfr_face_init,
-    (FT_Face_DoneFunc)        pfr_face_done,
-    (FT_Size_InitFunc)        NULL,
-    (FT_Size_DoneFunc)        NULL,
-    (FT_Slot_InitFunc)        pfr_slot_init,
-    (FT_Slot_DoneFunc)        pfr_slot_done,
-
-    (FT_Size_ResetPointsFunc) NULL,
-    (FT_Size_ResetPixelsFunc) NULL,
-    (FT_Slot_LoadFunc)        pfr_slot_load,
-
-    (FT_Face_GetKerningFunc)  pfr_get_kerning,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
+    (FT_Face_InitFunc)       pfr_face_init,
+    (FT_Face_DoneFunc)       pfr_face_done,
+    (FT_Size_InitFunc)       NULL,
+    (FT_Size_DoneFunc)       NULL,
+    (FT_Slot_InitFunc)       pfr_slot_init,
+    (FT_Slot_DoneFunc)       pfr_slot_done,
+
+    (FT_Size_ResetPointsFunc)NULL,
+    (FT_Size_ResetPixelsFunc)NULL,
+    (FT_Slot_LoadFunc)       pfr_slot_load,
+
+    (FT_Face_GetKerningFunc) pfr_get_kerning,
+    (FT_Face_AttachFunc)     0,
+    (FT_Face_GetAdvancesFunc)0
   };
 
 

reactos/lib/freetype/src/pfr
pfrgload.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- pfrgload.c	15 Feb 2004 21:45:34 -0000	1.3
+++ pfrgload.c	10 May 2004 17:48:33 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR glyph loader (body).                                    */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -198,7 +198,7 @@
     /* indicate that a new contour has started */
     glyph->path_begun = 1;
 
-    /* check that there is room for a new contour and a new point */
+    /* check that there is space for a new contour and a new point */
     error = FT_GlyphLoader_CheckPoints( loader, 1, 1 );
     if ( !error )
       /* add new start point */
@@ -276,7 +276,7 @@
     /* re-allocate array when necessary */
     if ( count > glyph->max_xy_control )
     {
-      FT_UInt  new_max = ( count + 7 ) & -8;
+      FT_UInt  new_max = FT_PAD_CEIL( count, 8 );
 
 
       if ( FT_RENEW_ARRAY( glyph->x_control,

reactos/lib/freetype/src/pfr
pfrload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- pfrload.c	15 Feb 2004 21:45:34 -0000	1.5
+++ pfrload.c	10 May 2004 17:48:33 -0000	1.6
@@ -365,7 +365,7 @@
     /* re-allocate when needed */
     if ( phy_font->num_strikes + count > phy_font->max_strikes )
     {
-      FT_UInt  new_max = ( phy_font->num_strikes + count + 3 ) & -4;
+      FT_UInt  new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 );
 
 
       if ( FT_RENEW_ARRAY( phy_font->strikes,
@@ -511,89 +511,6 @@
   }
 
 
-#if 0
-
-  /* load kerning pair data */
-  FT_CALLBACK_DEF( FT_Error )
-  pfr_extra_item_load_kerning_pairs( FT_Byte*     p,
-                                     FT_Byte*     limit,
-                                     PFR_PhyFont  phy_font )
-  {
-    FT_Int        count;
-    FT_UShort     base_adj;
-    FT_UInt       flags;
-    FT_UInt       num_pairs;
-    PFR_KernPair  pairs;
-    FT_Error      error  = 0;
-    FT_Memory     memory = phy_font->memory;
-
-
-    /* allocate a new kerning item */
-    /* XXX: there may be multiple extra items for kerning */
-    if ( phy_font->kern_pairs != NULL )
-      goto Exit;
-
-    FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()\n" ));
-
-    PFR_CHECK( 4 );
-
-    num_pairs = PFR_NEXT_BYTE( p );
-    base_adj  = PFR_NEXT_SHORT( p );
-    flags     = PFR_NEXT_BYTE( p );
-
-#ifndef PFR_CONFIG_NO_CHECKS
-    count = 3;
-
-    if ( flags & PFR_KERN_2BYTE_CHAR )
-      count += 2;
-
-    if ( flags & PFR_KERN_2BYTE_ADJ )
-      count += 1;
-
-    PFR_CHECK( num_pairs * count );
-#endif
-
-    if ( FT_NEW_ARRAY( pairs, num_pairs ) )
-      goto Exit;
-
-    phy_font->num_kern_pairs = num_pairs;
-    phy_font->kern_pairs     = pairs;
-
-    for (count = num_pairs ; count > 0; count--, pairs++ )
-    {
-      if ( flags & PFR_KERN_2BYTE_CHAR )
-      {
-        pairs->glyph1 = PFR_NEXT_USHORT( p );
-        pairs->glyph2 = PFR_NEXT_USHORT( p );
-      }
-      else
-      {
-        pairs->glyph1 = PFR_NEXT_BYTE( p );
-        pairs->glyph2 = PFR_NEXT_BYTE( p );
-      }
-
-      if ( flags & PFR_KERN_2BYTE_ADJ )
-        pairs->kerning.x = base_adj + PFR_NEXT_SHORT( p );
-      else
-        pairs->kerning.x = base_adj + PFR_NEXT_INT8( p );
-
-      pairs->kerning.y = 0;
-
-      FT_TRACE2(( "kerning %d <-> %d : %ld\n",
-                   pairs->glyph1, pairs->glyph2, pairs->kerning.x ));
-    }
-
-  Exit:
-    return error;
-
-  Too_Short:
-    error = PFR_Err_Invalid_Table;
-    FT_ERROR(( "pfr_extra_item_load_kerning_pairs: "
-               "invalid kerning pairs table\n" ));
-    goto Exit;
-  }
-
-#else /* 0 */
 
   /* load kerning pair data */
   FT_CALLBACK_DEF( FT_Error )
@@ -690,15 +607,154 @@
                "invalid kerning pairs table\n" ));
     goto Exit;
   }
-#endif /* 0 */
+
+
+ /*
+  *  The kerning data embedded in a PFR font are (charcode,charcode)
+  *  pairs; we need to translate them to (gindex,gindex) and sort
+  *  the resulting array.
+  */
+  static FT_UInt
+  pfr_get_gindex( PFR_Char  chars,
+                  FT_UInt   count,
+                  FT_UInt   charcode )
+  {
+    FT_UInt  min = 0;
+    FT_UInt  max = count;
+
+
+    while ( min < max )
+    {
+      FT_UInt   mid = ( min + max ) >> 1;
+      PFR_Char  c   = chars + mid;
+
+
+      if ( c->char_code == charcode )
+        return mid + 1;
+
+      if ( c->char_code < charcode )
+        min = mid + 1;
+      else
+        max = mid;
+    }
+    return 0;
+  }
+
+
+  FT_CALLBACK_DEF( int )
+  pfr_compare_kern_pairs( const void*  pair1,
+                          const void*  pair2 )
+  {
+    FT_UInt32  p1 = PFR_KERN_PAIR_INDEX( (PFR_KernPair)pair1 );
+    FT_UInt32  p2 = PFR_KERN_PAIR_INDEX( (PFR_KernPair)pair2 );
+
+
+    if ( p1 < p2 )
+      return -1;
+    if ( p1 > p2 )
+      return 1;
+    return 0;
+  }
+
+
+  static FT_Error
+  pfr_sort_kerning_pairs( FT_Stream    stream,
+                          PFR_PhyFont  phy_font )
+  {
+    FT_Error      error;
+    FT_Memory     memory = stream->memory;
+    PFR_KernPair  pairs;
+    PFR_KernItem  item;
+    PFR_Char      chars     = phy_font->chars;
+    FT_UInt       num_chars = phy_font->num_chars;
+    FT_UInt       count;
+
+
+   /* create kerning pairs array
+    */
+    if ( FT_NEW_ARRAY( phy_font->kern_pairs, phy_font->num_kern_pairs ) )
+      goto Exit;
+
+   /* load all kerning items into the array,
+    * converting character codes into glyph indices
+    */
+    pairs = phy_font->kern_pairs;
+    item  = phy_font->kern_items;
+    count = 0;
+
+    for ( ; item; item = item->next )
+    {
+      FT_UInt   limit = count + item->pair_count;
+      FT_Byte*  p;
+
+
+      if ( limit > phy_font->num_kern_pairs )
+      {
+        error = PFR_Err_Invalid_Table;
+        goto Exit;
+      }
+
+      if ( FT_STREAM_SEEK( item->offset )                       ||
+           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
+        goto Exit;
+
+      p = stream->cursor;
+
+      for ( ; count < limit; count++ )
+      {
+        PFR_KernPair  pair = pairs + count;
+        FT_UInt       char1, char2;
+        FT_Int        kerning;
+
+
+        if ( item->flags & PFR_KERN_2BYTE_CHAR )
+        {
+          char1 = FT_NEXT_USHORT( p );
+          char2 = FT_NEXT_USHORT( p );
+        }
+        else
+        {
+          char1 = FT_NEXT_BYTE( p );
+          char2 = FT_NEXT_BYTE( p );
+        }
+
+        if ( item->flags & PFR_KERN_2BYTE_ADJ )
+          kerning = item->base_adj + FT_NEXT_SHORT( p );
+        else
+          kerning = item->base_adj + FT_NEXT_CHAR( p );
+
+        pair->glyph1  = pfr_get_gindex( chars, num_chars, char1 );
+        pair->glyph2  = pfr_get_gindex( chars, num_chars, char2 );
+        pair->kerning = kerning;
+      }
+
+      FT_FRAME_EXIT();
+    }
+
+   /* sort the resulting array
+    */
+    ft_qsort( pairs, count,
+              sizeof ( PFR_KernPairRec ),
+              pfr_compare_kern_pairs );
+
+  Exit:
+    if ( error )
+    {
+     /* disable kerning data in case of error
+      */
+      phy_font->num_kern_pairs = 0;
+    }
+
+    return error;
+  }
 
 
   static const PFR_ExtraItemRec  pfr_phy_font_extra_items[] =
   {
-    { 1, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_bitmap_info },
-    { 2, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_font_id },
-    { 3, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_stem_snaps },
-    { 4, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_kerning_pairs },
+    { 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
+    { 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id },
+    { 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps },
+    { 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs },
     { 0, NULL }
   };
 
@@ -770,6 +826,7 @@
     FT_FREE( phy_font->blue_values );
     phy_font->num_blue_values = 0;
 
+    FT_FREE( phy_font->kern_pairs );
     {
       PFR_KernItem  item, next;
 
@@ -1008,6 +1065,9 @@
     phy_font->bct_offset = FT_STREAM_POS();
     phy_font->cursor     = NULL;
 
+    /* now sort kerning pairs */
+    error = pfr_sort_kerning_pairs( stream, phy_font );
+
   Exit:
     return error;
 

reactos/lib/freetype/src/pfr
pfrobjs.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- pfrobjs.c	15 Feb 2004 21:45:34 -0000	1.5
+++ pfrobjs.c	10 May 2004 17:48:33 -0000	1.6
@@ -419,8 +419,9 @@
   {
     FT_Error      error    = PFR_Err_Ok;
     PFR_PhyFont   phy_font = &face->phy_font;
-    PFR_KernItem  item     = phy_font->kern_items;
+    PFR_KernPair  pairs    = phy_font->kern_pairs;
     FT_UInt32     idx      = PFR_KERN_INDEX( glyph1, glyph2 );
+    FT_UInt       min, max;
 
     FT_UNUSED( error ); /* just needed as syntactical sugar */
 
@@ -428,68 +429,26 @@
     kerning->x = 0;
     kerning->y = 0;
 
-    /* find the kerning item containing our pair */
-    while ( item )
+    min = 0;
+    max = phy_font->num_kern_pairs;
+    
+    while ( min < max )
     {
-      if ( item->pair1 <= idx && idx <= item->pair2 )
-        goto Found_Item;
+      FT_UInt       mid  = ( min + max ) >> 1;
+      PFR_KernPair  pair = pairs + mid;
+      FT_UInt32     pidx = PFR_KERN_PAIR_INDEX( pair );
+      
 
-      item = item->next;
-    }
-
-    /* not found */
-    return;
-
-  Found_Item:
-    {
-      /* perform simply binary search within the item */
-      FT_UInt    min, mid, max;
-      FT_Stream  stream = face->root.stream;
-      FT_Byte*   p;
-
-
-      if ( FT_STREAM_SEEK( item->offset )                       ||
-           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
-        return;
-
-      min = 0;
-      max = item->pair_count;
-      while ( min < max )
+      if ( pidx == idx )
       {
-        FT_UInt  char1, char2, charcode;
-
-
-        mid = ( min + max ) >> 1;
-        p   = stream->cursor + mid*item->pair_size;
-
-        if ( item->flags & PFR_KERN_2BYTE_CHAR )
-        {
-          char1 = FT_NEXT_USHORT( p );
-          char2 = FT_NEXT_USHORT( p );
-        }
-        else
-        {
-          char1 = FT_NEXT_USHORT( p );
-          char2 = FT_NEXT_USHORT( p );
-        }
-        charcode = PFR_KERN_INDEX( char1, char2 );
-
-        if ( idx == charcode )
-        {
-          if ( item->flags & PFR_KERN_2BYTE_ADJ )
-            kerning->x = item->base_adj + FT_NEXT_SHORT( p );
-          else
-            kerning->x = item->base_adj + FT_NEXT_CHAR( p );
-
-          break;
-        }
-        if ( idx > charcode )
-          min = mid + 1;
-        else
-          max = mid;
+        kerning->x = pair->kerning;
+        break;
       }
-
-      FT_FRAME_EXIT();
+      
+      if ( pidx < idx )
+        min = mid + 1;
+      else
+        max = mid;
     }
   }
 

reactos/lib/freetype/src/pfr
pfrsbit.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- pfrsbit.c	15 Feb 2004 21:45:34 -0000	1.5
+++ pfrsbit.c	10 May 2004 17:48:33 -0000	1.6
@@ -635,7 +635,7 @@
         glyph->root.metrics.height       = (FT_Long)ysize << 6;
         glyph->root.metrics.horiBearingX = xpos << 6;
         glyph->root.metrics.horiBearingY = ypos << 6;
-        glyph->root.metrics.horiAdvance  = ( ( advance >> 2 ) + 32 ) & -64;
+        glyph->root.metrics.horiAdvance  = FT_PIX_ROUND( ( advance >> 2 ) );
         glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
         glyph->root.metrics.vertBearingY = 0;
         glyph->root.metrics.vertAdvance  = size->root.metrics.height;
@@ -651,11 +651,12 @@
           error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
           if ( !error )
           {
-            error = pfr_load_bitmap_bits( p,
-                                          stream->limit,
-                                          format,
-                                          face->header.color_flags & 2,
-                                          &glyph->root.bitmap );
+            error = pfr_load_bitmap_bits(
+                      p,
+                      stream->limit,
+                      format,
+                      FT_BOOL(face->header.color_flags & 2),
+                      &glyph->root.bitmap );
           }
         }
       }

reactos/lib/freetype/src/pfr
pfrtypes.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- pfrtypes.h	15 Feb 2004 21:45:34 -0000	1.5
+++ pfrtypes.h	10 May 2004 17:48:33 -0000	1.6
@@ -209,11 +209,14 @@
 #define PFR_KERN_INDEX( g1, g2 ) \
   ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
 
+#define PFR_KERN_PAIR_INDEX( pair )  \
+          PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 )
+
   typedef struct  PFR_KernPairRec_
   {
     FT_UInt    glyph1;
     FT_UInt    glyph2;
-    FT_Vector  kerning;
+    FT_Int     kerning;
 
   } PFR_KernPairRec, *PFR_KernPair;
 
@@ -230,7 +233,7 @@
     FT_BBox            bbox;
     FT_UInt            flags;
     FT_UInt            standard_advance;
-    
+
     FT_Int             ascent;   /* optional, bbox.yMax if not present */
     FT_Int             descent;  /* optional, bbox.yMin if not present */
     FT_Int             leading;  /* optional, 0 if not present         */
@@ -258,6 +261,7 @@
     FT_UInt            num_kern_pairs;
     PFR_KernItem       kern_items;
     PFR_KernItem*      kern_items_tail;
+    PFR_KernPair       kern_pairs;
 
     /* not part of the spec, but used during load */
     FT_UInt32          bct_offset;
@@ -281,8 +285,8 @@
 
   typedef enum PFR_KernFlags_
   {
-    PFR_KERN_2BYTE_ADJ   = 0x01,
-    PFR_KERN_2BYTE_CHAR  = 0x02
+    PFR_KERN_2BYTE_CHAR  = 0x01,
+    PFR_KERN_2BYTE_ADJ   = 0x02
 
   } PFR_KernFlags;
 

reactos/lib/freetype/src/psaux
psauxmod.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- psauxmod.c	15 Feb 2004 21:45:34 -0000	1.4
+++ psauxmod.c	10 May 2004 17:48:33 -0000	1.5
@@ -39,7 +39,7 @@
     ps_parser_init,
     ps_parser_done,
     ps_parser_skip_spaces,
-    ps_parser_skip_alpha,
+    ps_parser_skip_PS_token,
     ps_parser_to_int,
     ps_parser_to_fixed,
     ps_parser_to_bytes,

reactos/lib/freetype/src/psaux
psobjs.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- psobjs.c	15 Feb 2004 21:45:34 -0000	1.5
+++ psobjs.c	10 May 2004 17:48:33 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auxiliary functions for PostScript fonts (body).                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -142,7 +142,7 @@
   /*    table  :: The target table.                                        */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    idx  :: The index of the object in the table.                      */
+  /*    idx    :: The index of the object in the table.                    */
   /*                                                                       */
   /*    object :: The address of the object to copy in memory.             */
   /*                                                                       */
@@ -181,7 +181,7 @@
         /* increase size by 25% and round up to the nearest multiple
            of 1024 */
         new_size += ( new_size >> 2 ) + 1;
-        new_size  = ( new_size + 1023 ) & -1024;
+        new_size  = FT_PAD_CEIL( new_size, 1024 );
       }
 
       error = reallocate_t1_table( table, new_size );
@@ -267,31 +267,76 @@
   /*************************************************************************/
 
   /* In the PostScript Language Reference Manual (PLRM) the following */
-  /* characters are called `white-space characters'.                  */
+  /* characters are called `whitespace characters'.                   */
 #define IS_T1_WHITESPACE( c )  ( (c) == ' '  || (c) == '\t' )
 #define IS_T1_LINESPACE( c )   ( (c) == '\r' || (c) == '\n' || (c) == '\f' )
 #define IS_T1_NULLSPACE( c )   ( (c) == '\0' )
 
-  /* According to the PLRM all white-space characters are equivalent, */
-  /* except in comments and strings.                                  */
+  /* According to the PLRM all whitespace characters are equivalent, */
+  /* except in comments and strings.                                 */
 #define IS_T1_SPACE( c )  ( IS_T1_WHITESPACE( c ) || \
                             IS_T1_LINESPACE( c )  || \
                             IS_T1_NULLSPACE( c )  )
 
 
+  /* The following array is used by various functions to quickly convert */
+  /* digits (both decimal and non-decimal) into numbers.                 */
+
+#if 'A' == 65
+  /* ASCII */
+
+  static const char ft_char_table[128] =
+  {
+    /* 0x00 */
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
+    -1, 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, -1, -1, -1, -1, -1,
+    -1, 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, -1, -1, -1, -1, -1,
+  };
+
+  /* no character >= 0x80 can represent a valid number */
+#define OP  >=
+
+#endif /* 'A' == 65 */
+
+#if 'A' == 193
+  /* EBCDIC */
+
+  static const char ft_char_table[128] =
+  {
+    /* 0x80 */
+    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,
+    -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
+    -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,
+    -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
+    -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
+     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
+  }
+
+  /* no character < 0x80 can represent a valid number */
+#define OP  <
+
+#endif /* 'A' == 193 */
+
+
+  /* first character must be already part of the comment */
+
   static void
-  skip_spaces( FT_Byte**  acur,
-               FT_Byte*   limit )
+  skip_comment( FT_Byte*  *acur,
+                FT_Byte*   limit )
   {
-    FT_Byte* cur = *acur;
+    FT_Byte*  cur = *acur;
 
 
     while ( cur < limit )
     {
-      FT_Byte  c = *cur;
-
-
-      if ( !IS_T1_SPACE( c ) )
+      if ( IS_T1_LINESPACE( *cur ) )
         break;
       cur++;
     }
@@ -301,19 +346,54 @@
 
 
   static void
-  skip_alpha( FT_Byte**  acur,
-              FT_Byte*   limit )
+  skip_spaces( FT_Byte*  *acur,
+               FT_Byte*   limit )
   {
     FT_Byte*  cur = *acur;
 
 
     while ( cur < limit )
     {
-      FT_Byte  c = *cur;
+      if ( !IS_T1_SPACE( *cur ) )
+      {
+        if ( *cur == '%' )
+          /* According to the PLRM, a comment is equal to a space. */
+          skip_comment( &cur, limit );
+        else
+          break;
+      }
+      cur++;
+    }
 
+    *acur = cur;
+  }
 
-      if ( IS_T1_SPACE( c ) )
-        break;
+
+  /* first character must be `(' */
+
+  static void
+  skip_literal_string( FT_Byte*  *acur,
+                       FT_Byte*   limit )
+  {
+    FT_Byte*  cur   = *acur;
+    FT_Int    embed = 0;
+
+
+    while ( cur < limit )
+    {
+      if ( *cur == '\\' )
+        cur++;
+      else if ( *cur == '(' )
+        embed++;
+      else if ( *cur == ')' )
+      {
+        embed--;
+        if ( embed == 0 )
+        {
+          cur++;
+          break;
+        }
+      }
       cur++;
     }
 
@@ -321,20 +401,143 @@
   }
 
 
+  /* first character must be `<' */
+
+  static void
+  skip_string( PS_Parser  parser )
+  {
+    FT_Byte*  cur   = parser->cursor;
+    FT_Byte*  limit = parser->limit;
+
+
+    while ( ++cur < limit )
+    {
+      int  d;
+
+
+      /* All whitespace characters are ignored. */
+      skip_spaces( &cur, limit );
+      if ( cur >= limit )
+        break;
+
+      if ( *cur OP 0x80 )
+        break;
+
+      d = ft_char_table[*cur & 0x7F];
+      if ( d < 0 || d >= 16 )
+        break;
+    }
+
+    if ( cur < limit && *cur != '>' )
+      parser->error = PSaux_Err_Invalid_File_Format;
+    else
+      cur++;
+
+    parser->cursor = cur;
+  }
+
+
+  /***********************************************************************/
+  /*                                                                     */
+  /* All exported parsing routines handle leading whitespace and stop at */
+  /* the first character which isn't part of the just handled token.     */
+  /*                                                                     */
+  /***********************************************************************/
+
+
   FT_LOCAL_DEF( void )
-  ps_parser_skip_spaces( PS_Parser  parser )
+  ps_parser_skip_PS_token( PS_Parser  parser )
   {
-    skip_spaces( &parser->cursor, parser->limit );
+    /* Note: PostScript allows any non-delimiting, non-whitespace        */
+    /*       character in a name (PS Ref Manual, 3rd ed, p31).           */
+    /*       PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
+
+    FT_Byte*  cur   = parser->cursor;
+    FT_Byte*  limit = parser->limit;
+
+
+    skip_spaces( &cur, limit );             /* this also skips comments */
+    if ( cur >= limit )
+      goto Exit;
+
+    /* self-delimiting, single-character tokens */
+    if ( *cur == '[' || *cur == ']' ||
+         *cur == '{' || *cur == '}' )
+    {
+      cur++;
+      goto Exit;
+    }
+
+    if ( *cur == '(' )                              /* (...) */
+    {
+      skip_literal_string( &cur, limit );
+      goto Exit;
+    }
+
+    if ( *cur == '<' )                              /* <...> */
+    {
+      if ( cur + 1 < limit && *(cur + 1) == '<' )   /* << */
+      {
+        cur++;
+        cur++;
+        goto Exit;
+      }
+      parser->cursor = cur;
+      skip_string( parser );
+      return;
+    }
+
+    if ( *cur == '>' )
+    {
+      cur++;
+      if ( cur >= limit || *cur != '>' )             /* >> */
+      {
+        parser->error = PSaux_Err_Invalid_File_Format;
+        goto Exit;
+      }
+      cur++;
+      goto Exit;
+    }
+
+    if ( *cur == '/' )
+      cur++;
+
+    /* anything else */
+    while ( cur < limit )
+    {
+      if ( IS_T1_SPACE( *cur )        ||
+           *cur == '('                ||
+           *cur == '/'                ||
+           *cur == '%'                ||
+           *cur == '[' || *cur == ']' ||
+           *cur == '{' || *cur == '}' ||
+           *cur == '<' || *cur == '>' )
+        break;
+
+      if ( *cur == ')' )
+      {
+        parser->error = PSaux_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
+      cur++;
+    }
+
+  Exit:
+    parser->cursor = cur;
   }
 
 
   FT_LOCAL_DEF( void )
-  ps_parser_skip_alpha( PS_Parser  parser )
+  ps_parser_skip_spaces( PS_Parser  parser )
   {
-    skip_alpha( &parser->cursor, parser->limit );
+    skip_spaces( &parser->cursor, parser->limit );
   }
 
 
+  /* `token' here means either something between balanced delimiters */
+  /* or the next token; the delimiters are not removed.              */
+
   FT_LOCAL_DEF( void )
   ps_parser_to_token( PS_Parser  parser,
                       T1_Token   token )
@@ -349,72 +552,87 @@
     token->start = 0;
     token->limit = 0;
 
-    /* first of all, skip space */
+    /* first of all, skip leading whitespace */
     ps_parser_skip_spaces( parser );
 
     cur   = parser->cursor;
     limit = parser->limit;
 
-    if ( cur < limit )
+    if ( cur >= limit )
+      return;
+
+    switch ( *cur )
     {
-      switch ( *cur )
+      /************* check for literal string *****************/
+    case '(':
+      token->type  = T1_TOKEN_TYPE_STRING;
+      token->start = cur;
+      skip_literal_string( &cur, limit );
+      if ( cur < limit )
+        token->limit = cur;
+      break;
+
+      /************* check for programs/array *****************/
+    case '{':
+      token->type = T1_TOKEN_TYPE_ARRAY;
+      ender = '}';
+      goto Lookup_Ender;
+
+      /************* check for table/array ********************/
+    case '[':
+      token->type = T1_TOKEN_TYPE_ARRAY;
+      ender = ']';
+      /* fall through */
+
+    Lookup_Ender:
+      embed        = 1;
+      starter      = *cur;
+      token->start = cur++;
+
+      /* we need this to catch `[ ]' */
+      parser->cursor = cur;
+      ps_parser_skip_spaces( parser );
+      cur = parser->cursor;
+
+      while ( cur < limit && !parser->error )
       {
-        /************* check for strings ***********************/
-      case '(':
-        token->type = T1_TOKEN_TYPE_STRING;
-        ender = ')';
-        goto Lookup_Ender;
-
-        /************* check for programs/array ****************/
-      case '{':
-        token->type = T1_TOKEN_TYPE_ARRAY;
-        ender = '}';
-        goto Lookup_Ender;
-
-        /************* check for table/array ******************/
-      case '[':
-        token->type = T1_TOKEN_TYPE_ARRAY;
-        ender = ']';
-
-      Lookup_Ender:
-        embed   = 1;
-        starter = *cur++;
-        token->start = cur;
-        while ( cur < limit )
+        if ( *cur == starter )
+          embed++;
+        else if ( *cur == ender )
         {
-          if ( *cur == starter )
-            embed++;
-          else if ( *cur == ender )
+          embed--;
+          if ( embed <= 0 )
           {
-            embed--;
-            if ( embed <= 0 )
-            {
-              token->limit = cur++;
-              break;
-            }
+            token->limit = ++cur;
+            break;
           }
-          cur++;
         }
-        break;
-
-        /* **************** otherwise, it's any token **********/
-      default:
-        token->start = cur++;
-        token->type  = T1_TOKEN_TYPE_ANY;
-        while ( cur < limit && !IS_T1_SPACE( *cur ) )
-          cur++;
 
-        token->limit = cur;
+        parser->cursor = cur;
+        ps_parser_skip_PS_token( parser );
+        /* we need this to catch `[XXX ]' */
+        ps_parser_skip_spaces  ( parser );
+        cur = parser->cursor;
       }
+      break;
 
-      if ( !token->limit )
-      {
-        token->start = 0;
-        token->type  = T1_TOKEN_TYPE_NONE;
-      }
+      /* ************ otherwise, it is any token **************/
+    default:
+      token->start = cur;
+      token->type  = T1_TOKEN_TYPE_ANY;
+      ps_parser_skip_PS_token( parser );
+      cur = parser->cursor;
+      if ( !parser->error )
+        token->limit = cur;
+    }
 
-      parser->cursor = cur;
+    if ( !token->limit )
+    {
+      token->start = 0;
+      token->type  = T1_TOKEN_TYPE_NONE;
     }
+
+    parser->cursor = cur;
   }
 
 
@@ -429,7 +647,9 @@
 
     *pnum_tokens = -1;
 
+    /* this also handles leading whitespace */
     ps_parser_to_token( parser, &master );
+
     if ( master.type == T1_TOKEN_TYPE_ARRAY )
     {
       FT_Byte*  old_cursor = parser->cursor;
@@ -438,8 +658,9 @@
       T1_Token  limit      = cur + max_tokens;
 
 
-      parser->cursor = master.start;
-      parser->limit  = master.limit;
+      /* don't include outermost delimiters */
+      parser->cursor = master.start + 1;
+      parser->limit  = master.limit - 1;
 
       while ( parser->cursor < parser->limit )
       {
@@ -464,150 +685,163 @@
   }
 
 
+  /* first character must be already part of the number */
+
   static FT_Long
-  T1Radix( FT_Long    radixBase,
-           FT_Byte**  cur,
-           FT_Byte*   limit )
+  ps_radix( FT_Long    radixBase,
+            FT_Byte*  *acur,
+            FT_Byte*   limit )
   {
-    FT_Long  result = 0;
-    FT_Byte  radixEndChar0 =
-               (FT_Byte)( radixBase > 10 ? '9' + 1 : '0' + radixBase );
-    FT_Byte  radixEndChar1 =
-               (FT_Byte)( 'A' + radixBase - 10 );
-    FT_Byte  radixEndChar2 =
-               (FT_Byte)( 'a' + radixBase - 10 );
+    FT_Long   result = 0;
+    FT_Byte*  cur    = *acur;
 
 
-    while( *cur < limit )
+    if ( radixBase < 2 || radixBase > 36 )
+      return 0;
+
+    while ( cur < limit )
     {
-      if ( (*cur)[0] >= '0' && (*cur)[0] < radixEndChar0 )
-        result = result * radixBase + (*cur)[0] - '0';
+      int  d;
 
-      else if ( radixBase > 10 &&
-                (*cur)[0] >= 'A' && (*cur)[0] < radixEndChar1 )
-        result = result * radixBase + ( (*cur)[0] - 'A' + 10 );
 
-      else if ( radixBase > 10 &&
-                (*cur)[0] >= 'a' && (*cur)[0] < radixEndChar2 )
-        result = result * radixBase + ( (*cur)[0] - 'a' + 10 );
+      if ( *cur OP 0x80 )
+        break;
 
-      else
-        return result;
+      d = ft_char_table[*cur & 0x7F];
+      if ( d < 0 || d >= radixBase )
+        break;
 
-      (*cur)++;
+      result = result * radixBase + d;
+
+      cur++;
     }
 
+    *acur = cur;
+
     return result;
   }
 
 
+  /* first character must be already part of the number */
+
   static FT_Long
-  t1_toint( FT_Byte**  cursor,
+  ps_toint( FT_Byte*  *acur,
             FT_Byte*   limit )
   {
     FT_Long   result = 0;
-    FT_Byte*  cur    = *cursor;
-    FT_Byte   c      = '\0', d;
+    FT_Byte*  cur    = *acur;
+    FT_Byte   c;
 
 
-    for ( ; cur < limit; cur++ )
+    if ( cur >= limit )
+      goto Exit;
+
+    c = *cur;
+    if ( c == '-' )
+      cur++;
+
+    while ( cur < limit )
     {
-      c = *cur;
-      d = (FT_Byte)( c - '0' );
-      if ( d < 10 )
-        break;
+      int  d;
 
-      if ( c == '-' )
+
+      if ( *cur == '#' )
       {
         cur++;
+        result = ps_radix( result, &cur, limit );
         break;
       }
-    }
 
-    if ( cur < limit )
-    {
-      do
-      {
-        d = (FT_Byte)( cur[0] - '0' );
-        if ( d >= 10 )
-        {
-          if ( cur[0] == '#' )
-          {
-            cur++;
-            result = T1Radix( result, &cur, limit );
-          }
-          break;
-        }
+      if ( *cur OP 0x80 )
+        break;
 
-        result = result * 10 + d;
-        cur++;
+      d = ft_char_table[*cur & 0x7F];
+      if ( d < 0 || d >= 10 )
+        break;
+      result = result * 10 + d;
 
-      } while ( cur < limit );
+      cur++;
+    };
 
-      if ( c == '-' )
-        result = -result;
-    }
+    if ( c == '-' )
+      result = -result;
 
-    *cursor = cur;
+  Exit:
+    *acur = cur;
     return result;
   }
 
 
-  /* <...>: hexadecimal string */
+  /* first character must be `<' if `delimiters' is non-zero */
+
   static FT_Error
-  ps_tobytes( FT_Byte**  cursor,
+  ps_tobytes( FT_Byte*  *acur,
               FT_Byte*   limit,
-              FT_Int     max_bytes,
+              FT_Long    max_bytes,
               FT_Byte*   bytes,
-              FT_Int*    pnum_bytes )
+              FT_Long*   pnum_bytes,
+              FT_Bool    delimiters )
   {
     FT_Error  error = PSaux_Err_Ok;
 
-    FT_Byte*  cur = *cursor;
-    FT_Int    n   = 0;
-    FT_Byte   b;
+    FT_Byte*  cur = *acur;
+    FT_Long   n   = 0;
 
 
-    skip_spaces( &cur, limit );
+    if ( cur >= limit )
+      goto Exit;
 
-    if ( *cur != '<' )
+    if ( delimiters )
     {
-      error = PSaux_Err_Invalid_File_Format;
-      goto Exit;
+      if ( *cur != '<' )
+      {
+        error = PSaux_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
+      cur++;
     }
 
-    cur++;
+    max_bytes = max_bytes * 2;
 
-    for ( ; cur < limit; n++ )
+    for ( n = 0; cur < limit; n++, cur++ )
     {
-      FT_Byte*  cur2 = cur;
+      int  d;
 
 
-      if ( n + 1 > max_bytes * 2 )
+      if ( n >= max_bytes )
+        /* buffer is full */
         goto Exit;
 
-      /* All white-space charcters are ignored. */
+      /* All whitespace characters are ignored. */
       skip_spaces( &cur, limit );
+      if ( cur >= limit )
+        break;
 
-      b = T1Radix( 16, &cur, cur + 1 );
+      if ( *cur OP 0x80 )
+        break;
 
-      if ( cur == cur2 )
+      d = ft_char_table[*cur & 0x7F];
+      if ( d < 0 || d >= 16 )
         break;
 
       /* <f> == <f0> != <0f> */
-      bytes[n / 2] = ( n % 2 ) ? bytes[n / 2] + b
-                               : b * 16;
+      bytes[n / 2] = (FT_Byte)( ( n % 2 ) ? bytes[n / 2] + d
+                                          : d * 16 );
     }
 
-    skip_spaces( &cur, limit );
-
-    if ( *cur != '>' )
+    if ( delimiters )
     {
-      error = PSaux_Err_Invalid_File_Format;
-      goto Exit;
+      if ( cur < limit && *cur != '>' )
+      {
+        error = PSaux_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
+      cur++;
     }
 
-    *cursor = ++cur;
+    *acur = cur;
 
   Exit:
     *pnum_bytes = ( n + 1 ) / 2;
@@ -616,22 +850,23 @@
   }
 
 
+  /* first character must be already part of the number */
+
   static FT_Long
-  t1_tofixed( FT_Byte**  cursor,
+  ps_tofixed( FT_Byte*  *acur,
               FT_Byte*   limit,
               FT_Long    power_ten )
   {
-    FT_Byte*  cur  = *cursor;
+    FT_Byte*  cur  = *acur;
     FT_Long   num, divider, result;
     FT_Int    sign = 0;
-    FT_Byte   d;
 
 
     if ( cur >= limit )
       return 0;
 
     /* first of all, check the sign */
-    if ( *cur == '-' )
+    if ( *cur == '-' && cur + 1 < limit )
     {
       sign = 1;
       cur++;
@@ -639,7 +874,7 @@
 
     /* then, read the integer part, if any */
     if ( *cur != '.' )
-      result = t1_toint( &cur, limit ) << 16;
+      result = ps_toint( &cur, limit ) << 16;
     else
       result = 0;
 
@@ -656,8 +891,14 @@
 
       for (;;)
       {
-        d = (FT_Byte)( *cur - '0' );
-        if ( d >= 10 )
+        int  d;
+
+
+        if ( *cur OP 0x80 )
+          break;
+
+        d = ft_char_table[*cur & 0x7F];
+        if ( d < 0 || d >= 10 )
           break;
 
         if ( divider < 10000000L )
@@ -676,7 +917,7 @@
     if ( cur + 1 < limit && ( *cur == 'e' || *cur == 'E' ) )
     {
       cur++;
-      power_ten += t1_toint( &cur, limit );
+      power_ten += ps_toint( &cur, limit );
     }
 
   Exit:
@@ -701,18 +942,20 @@
     if ( sign )
       result = -result;
 
-    *cursor = cur;
+    *acur = cur;
     return result;
   }
 
 
+  /* first character must be a delimiter or a part of a number */
+
   static FT_Int
-  t1_tocoordarray( FT_Byte**  cursor,
+  ps_tocoordarray( FT_Byte*  *acur,
                    FT_Byte*   limit,
                    FT_Int     max_coords,
                    FT_Short*  coords )
   {
-    FT_Byte*  cur   = *cursor;
+    FT_Byte*  cur   = *acur;
     FT_Int    count = 0;
     FT_Byte   c, ender;
 
@@ -720,8 +963,8 @@
     if ( cur >= limit )
       goto Exit;
 
-    /* check for the beginning of an array; if not, only one number will */
-    /* be read                                                           */
+    /* check for the beginning of an array; otherwise, only one number */
+    /* will be read                                                    */
     c     = *cur;
     ender = 0;
 
@@ -735,24 +978,23 @@
       cur++;
 
     /* now, read the coordinates */
-    for ( ; cur < limit; )
+    while ( cur < limit )
     {
       /* skip whitespace in front of data */
-      for (;;)
-      {
-        c = *cur;
-        if ( c != ' ' && c != '\t' )
-          break;
+      skip_spaces( &cur, limit );
+      if ( cur >= limit )
+        goto Exit;
 
-        cur++;
-        if ( cur >= limit )
-          goto Exit;
-      }
+      if ( count >= max_coords )
+        break;
 
-      if ( count >= max_coords || c == ender )
+      if ( c == ender )
+      {
+        cur++;
         break;
+      }
 
-      coords[count] = (FT_Short)( t1_tofixed( &cur, limit, 0 ) >> 16 );
+      coords[count] = (FT_Short)( ps_tofixed( &cur, limit, 0 ) >> 16 );
       count++;
 
       if ( !ender )
@@ -760,27 +1002,30 @@
     }
 
   Exit:
-    *cursor = cur;
+    *acur = cur;
     return count;
   }
 
 
+  /* first character must be a delimiter or a part of a number */
+
   static FT_Int
-  t1_tofixedarray( FT_Byte**  cursor,
+  ps_tofixedarray( FT_Byte*  *acur,
                    FT_Byte*   limit,
                    FT_Int     max_values,
                    FT_Fixed*  values,
                    FT_Int     power_ten )
   {
-    FT_Byte*  cur   = *cursor;
+    FT_Byte*  cur   = *acur;
     FT_Int    count = 0;
     FT_Byte   c, ender;
 
 
-    if ( cur >= limit ) goto Exit;
+    if ( cur >= limit )
+      goto Exit;
 
-    /* check for the beginning of an array. If not, only one number will */
-    /* be read                                                           */
+    /* Check for the beginning of an array.  Otherwise, only one number */
+    /* will be read.                                                    */
     c     = *cur;
     ender = 0;
 
@@ -794,24 +1039,23 @@
       cur++;
 
     /* now, read the values */
-    for ( ; cur < limit; )
+    while ( cur < limit )
     {
       /* skip whitespace in front of data */
-      for (;;)
-      {
-        c = *cur;
-        if ( c != ' ' && c != '\t' )
-          break;
+      skip_spaces( &cur, limit );
+      if ( cur >= limit )
+        goto Exit;
 
-        cur++;
-        if ( cur >= limit )
-          goto Exit;
-      }
+      if ( count >= max_values )
+        break;
 
-      if ( count >= max_values || c == ender )
+      if ( c == ender )
+      {
+        cur++;
         break;
+      }
 
-      values[count] = t1_tofixed( &cur, limit, power_ten );
+      values[count] = ps_tofixed( &cur, limit, power_ten );
       count++;
 
       if ( !ender )
@@ -819,7 +1063,7 @@
     }
 
   Exit:
-    *cursor = cur;
+    *acur = cur;
     return count;
   }
 
@@ -827,7 +1071,7 @@
 #if 0
 
   static FT_String*
-  t1_tostring( FT_Byte**  cursor,
+  ps_tostring( FT_Byte**  cursor,
                FT_Byte*   limit,
                FT_Memory  memory )
   {
@@ -887,40 +1131,41 @@
 
 
   static int
-  t1_tobool( FT_Byte**  cursor,
+  ps_tobool( FT_Byte*  *acur,
              FT_Byte*   limit )
   {
-    FT_Byte*  cur    = *cursor;
+    FT_Byte*  cur    = *acur;
     FT_Bool   result = 0;
 
 
     /* return 1 if we find `true', 0 otherwise */
     if ( cur + 3 < limit &&
-         cur[0] == 't' &&
-         cur[1] == 'r' &&
-         cur[2] == 'u' &&
-         cur[3] == 'e' )
+         cur[0] == 't'   &&
+         cur[1] == 'r'   &&
+         cur[2] == 'u'   &&
+         cur[3] == 'e'   )
     {
       result = 1;
       cur   += 5;
     }
     else if ( cur + 4 < limit &&
-              cur[0] == 'f' &&
-              cur[1] == 'a' &&
-              cur[2] == 'l' &&
-              cur[3] == 's' &&
-              cur[4] == 'e' )
+              cur[0] == 'f'   &&
+              cur[1] == 'a'   &&
+              cur[2] == 'l'   &&
+              cur[3] == 's'   &&
+              cur[4] == 'e'   )
     {
       result = 0;
       cur   += 6;
     }
 
-    *cursor = cur;
+    *acur = cur;
     return result;
   }
[truncated at 1000 lines; 263 more skipped]

reactos/lib/freetype/src/psaux
psobjs.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- psobjs.h	15 Feb 2004 21:45:34 -0000	1.4
+++ psobjs.h	10 May 2004 17:48:33 -0000	1.5
@@ -78,7 +78,7 @@
   ps_parser_skip_spaces( PS_Parser  parser );
 
   FT_LOCAL( void )
-  ps_parser_skip_alpha( PS_Parser  parser );
+  ps_parser_skip_PS_token( PS_Parser  parser );
 
   FT_LOCAL( void )
   ps_parser_to_token( PS_Parser  parser,
@@ -108,6 +108,14 @@
   ps_parser_to_int( PS_Parser  parser );
 
 
+  FT_LOCAL( FT_Error )
+  ps_parser_to_bytes( PS_Parser  parser,
+                      FT_Byte*   bytes,
+                      FT_Long    max_bytes,
+                      FT_Long*   pnum_bytes,
+                      FT_Bool    delimiters );
+
+
   FT_LOCAL( FT_Fixed )
   ps_parser_to_fixed( PS_Parser  parser,
                       FT_Int     power_ten );

reactos/lib/freetype/src/psaux
t1cmap.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1cmap.c	15 Feb 2004 21:45:34 -0000	1.4
+++ t1cmap.c	10 May 2004 17:48:33 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 character map support (body).                                 */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,8 +35,8 @@
   t1_cmap_std_init( T1_CMapStd  cmap,
                     FT_Int      is_expert )
   {
-    T1_Face          face    = (T1_Face)FT_CMAP_FACE( cmap );
-    PSNames_Service  psnames = (PSNames_Service)face->psnames;
+    T1_Face             face    = (T1_Face)FT_CMAP_FACE( cmap );
+    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;
 
 
     cmap->num_glyphs    = face->type1.num_glyphs;
@@ -263,26 +263,26 @@
   {
     FT_UInt32  u1 = ((T1_CMapUniPair)pair1)->unicode;
     FT_UInt32  u2 = ((T1_CMapUniPair)pair2)->unicode;
-    
+
 
     if ( u1 < u2 )
       return -1;
-      
+
     if ( u1 > u2 )
       return +1;
-      
+
     return 0;
-  }                            
+  }
 
 
   FT_CALLBACK_DEF( FT_Error )
   t1_cmap_unicode_init( T1_CMapUnicode  cmap )
   {
-    FT_Error         error;
-    FT_UInt          count;
-    T1_Face          face    = (T1_Face)FT_CMAP_FACE( cmap );
-    FT_Memory        memory  = FT_FACE_MEMORY( face );
-    PSNames_Service  psnames = (PSNames_Service)face->psnames;
+    FT_Error            error;
+    FT_UInt             count;
+    T1_Face             face    = (T1_Face)FT_CMAP_FACE( cmap );
+    FT_Memory           memory  = FT_FACE_MEMORY( face );
+    FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)face->psnames;
 
 
     cmap->num_pairs = 0;
@@ -316,7 +316,7 @@
           }
         }
       }
-      
+
       new_count = (FT_UInt)( pair - cmap->pairs );
       if ( new_count == 0 )
       {

reactos/lib/freetype/src/psaux
t1cmap.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- t1cmap.h	15 Feb 2004 21:45:34 -0000	1.3
+++ t1cmap.h	10 May 2004 17:48:33 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 character map support (specification).                        */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,7 +22,6 @@
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 FT_BEGIN_HEADER
 
@@ -47,16 +46,16 @@
 
     FT_UInt                    num_glyphs;
     const char* const*         glyph_names;
-    
+
   } T1_CMapStdRec;
 
 
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_standard_class_rec;
-  
+
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_expert_class_rec;
-  
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -67,20 +66,20 @@
   /*************************************************************************/
 
   typedef struct T1_CMapCustomRec_*  T1_CMapCustom;
-  
+
   typedef struct  T1_CMapCustomRec_
   {
     FT_CMapRec  cmap;
     FT_UInt     first;
     FT_UInt     count;
     FT_UShort*  indices;
-  
+
   } T1_CMapCustomRec;
 
 
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_custom_class_rec;
-  
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -97,7 +96,7 @@
   {
     FT_UInt32  unicode;
     FT_UInt    gindex;
-  
+
   } T1_CMapUniPairRec, *T1_CMapUniPair;
 
 
@@ -115,7 +114,7 @@
 
  /* */
 
- 
+
 FT_END_HEADER
 
 #endif /* __T1CMAP_H__ */

reactos/lib/freetype/src/psaux
t1decode.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1decode.c	15 Feb 2004 21:45:34 -0000	1.4
+++ t1decode.c	10 May 2004 17:48:33 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript Type 1 decoding routines (body).                          */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -125,9 +125,9 @@
   t1_lookup_glyph_by_stdcharcode( T1_Decoder  decoder,
                                   FT_Int      charcode )
   {
-    FT_UInt           n;
-    const FT_String*  glyph_name;
-    PSNames_Service   psnames = decoder->psnames;
+    FT_UInt             n;
+    const FT_String*    glyph_name;
+    FT_Service_PsCMaps  psnames = decoder->psnames;
 
 
     /* check range of standard char code */
@@ -143,7 +143,7 @@
 
 
       if ( name && name[0] == glyph_name[0]  &&
-           ft_strcmp( name,glyph_name ) == 0 )
+           ft_strcmp( name, glyph_name ) == 0 )
         return n;
     }
 
@@ -262,10 +262,6 @@
     if ( error )
       goto Exit;
 
-#if 0
-    n_base_points = base->n_points;
-#endif
-
     /* save the left bearing and width of the base character */
     /* as they will be erased by the next load.              */
 
@@ -290,23 +286,8 @@
     decoder->builder.left_bearing = left_bearing;
     decoder->builder.advance      = advance;
 
-    /* XXX: old code doesn't work with PostScript hinter */
-#if 0
-    /* Finally, move the accent */
-    if ( decoder->builder.load_points )
-    {
-      FT_Outline  dummy;
-
-
-      dummy.n_points = (short)( base->n_points - n_base_points );
-      dummy.points   = base->points + n_base_points;
-
-      FT_Outline_Translate( &dummy, adx - asb, ady );
-    }
-#else
     decoder->builder.pos_x = 0;
     decoder->builder.pos_y = 0;
-#endif
 
   Exit:
     return error;
@@ -1129,11 +1110,10 @@
 
     /* retrieve PSNames interface from list of current modules */
     {
-      PSNames_Service  psnames = 0;
+      FT_Service_PsCMaps  psnames = 0;
 
 
-      psnames = (PSNames_Service)FT_Get_Module_Interface(
-                  FT_FACE_LIBRARY(face), "psnames" );
+      FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
       if ( !psnames )
       {
         FT_ERROR(( "t1_decoder_init: " ));

reactos/lib/freetype/src/psaux
t1decode.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- t1decode.h	15 Feb 2004 21:45:34 -0000	1.3
+++ t1decode.h	10 May 2004 17:48:33 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript Type 1 decoding routines (specification).                 */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,7 +22,6 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_TYPE1_TYPES_H
 
 

reactos/lib/freetype/src/pshinter
Jamfile 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- Jamfile	15 Feb 2004 21:45:34 -0000	1.4
+++ Jamfile	10 May 2004 17:48:33 -0000	1.5
@@ -1,4 +1,4 @@
-# FreeType 2 src/pshinter Jamfile (c) 2001 David Turner
+# FreeType 2 src/pshinter Jamfile (c) 2001, 2003 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) pshinter ;

reactos/lib/freetype/src/pshinter
pshalgo.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- pshalgo.c	15 Feb 2004 21:45:34 -0000	1.3
+++ pshalgo.c	10 May 2004 17:48:33 -0000	1.4
@@ -2,9 +2,9 @@
 /*                                                                         */
 /*  pshalgo.c                                                              */
 /*                                                                         */
-/*    PostScript hinting algorithm 3 (body).                               */
+/*    PostScript hinting algorithm (body).                                 */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
@@ -35,8 +35,11 @@
 #endif
 
 
-#define  COMPUTE_INFLEXS  /* compute inflection points to optimize "S" and others */
-#define  STRONGER         /* slightly increase the contrast of smooth hinting */
+#define  COMPUTE_INFLEXS  /* compute inflection points to optimize `S' */
+                          /* and similar glyphs                        */
+#define  STRONGER         /* slightly increase the contrast of smooth  */
+                          /* hinting                                   */
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -46,13 +49,13 @@
   /*************************************************************************/
   /*************************************************************************/
 
-  /* return true iff two stem hints overlap */
+  /* return true if two stem hints overlap */
   static FT_Int
   psh_hint_overlap( PSH_Hint  hint1,
                     PSH_Hint  hint2 )
   {
-    return ( hint1->org_pos + hint1->org_len >= hint2->org_pos &&
-             hint2->org_pos + hint2->org_len >= hint1->org_pos );
+    return hint1->org_pos + hint1->org_len >= hint2->org_pos &&
+           hint2->org_pos + hint2->org_len >= hint1->org_pos;
   }
 
 
@@ -89,7 +92,7 @@
   }
 
 
-  /* internal function used to record a new hint */
+  /* internal function to record a new hint */
   static void
   psh_hint_table_record( PSH_Hint_Table  table,
                          FT_UInt         idx )
@@ -109,8 +112,8 @@
 
     psh_hint_activate( hint );
 
-    /* now scan the current active hint set in order to determine */
-    /* if we are overlapping with another segment                 */
+    /* now scan the current active hint set to check */
+    /* whether `hint' overlaps with another hint     */
     {
       PSH_Hint*  sorted = table->sort_global;
       FT_UInt    count  = table->num_hints;
@@ -172,12 +175,14 @@
                        PS_Mask_Table   counter_masks,
                        FT_Memory       memory )
   {
-    FT_UInt   count = hints->num_hints;
+    FT_UInt   count;
     FT_Error  error;
 
     FT_UNUSED( counter_masks );
 
 
+    count = hints->num_hints;
+
     /* allocate our tables */
     if ( FT_NEW_ARRAY( table->sort,  2 * count     ) ||
          FT_NEW_ARRAY( table->hints,     count     ) ||
@@ -190,7 +195,7 @@
     table->num_zones   = 0;
     table->zone        = 0;
 
-    /* now, initialize the "hints" array */
+    /* initialize the `table->hints' array */
     {
       PSH_Hint  write = table->hints;
       PS_Hint   read  = hints->hints;
@@ -204,30 +209,31 @@
       }
     }
 
-    /* we now need to determine the initial "parent" stems; first  */
+    /* we now need to determine the initial `parent' stems; first  */
     /* activate the hints that are given by the initial hint masks */
     if ( hint_masks )
     {
-      FT_UInt  Count = hint_masks->num_masks;
-      PS_Mask  Mask  = hint_masks->masks;
+      PS_Mask  mask = hint_masks->masks;
 
 
+      count             = hint_masks->num_masks;
       table->hint_masks = hint_masks;
 
-      for ( ; Count > 0; Count--, Mask++ )
-        psh_hint_table_record_mask( table, Mask );
+      for ( ; count > 0; count--, mask++ )
+        psh_hint_table_record_mask( table, mask );
     }
 
-    /* now, do a linear parse in case some hints were left alone */
+    /* finally, do a linear parse in case some hints were left alone */
     if ( table->num_hints != table->max_hints )
     {
-      FT_UInt  Index, Count;
+      FT_UInt  idx;
 
 
       FT_ERROR(( "psh_hint_table_init: missing/incorrect hint masks!\n" ));
-      Count = table->max_hints;
-      for ( Index = 0; Index < Count; Index++ )
-        psh_hint_table_record( table, Index );
+
+      count = table->max_hints;
+      for ( idx = 0; idx < count; idx++ )
+        psh_hint_table_record( table, idx );
     }
 
   Exit:
@@ -375,11 +381,11 @@
           len += delta;
       }
       else
-        len = ( len + 32 ) & -64;
+        len = FT_PIX_ROUND( len );
     }
 
     if ( do_snapping )
-      len = ( len + 32 ) & -64;
+      len = FT_PIX_ROUND( len );
 
     return  len;
   }
@@ -417,11 +423,11 @@
   psh_hint_snap_stem_side_delta( FT_Fixed  pos,
                                  FT_Fixed  len )
   {
-    FT_Fixed  delta1 = ( ( pos + 32 ) & -64 ) - pos;
-    FT_Fixed  delta2 = ( ( pos + len + 32 ) & -64  ) - pos - len;
+    FT_Fixed  delta1 = FT_PIX_ROUND( pos ) - pos;
+    FT_Fixed  delta2 = FT_PIX_ROUND( pos + len ) - pos - len;
 
 
-    if ( ABS( delta1 ) <= ABS( delta2 ) )
+    if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) )
       return delta1;
     else
       return delta2;
@@ -511,6 +517,9 @@
             if ( !psh_hint_is_fitted( parent ) )
               psh_hint_align( parent, globals, dimension, glyph );
 
+            /* keep original relation between hints, this is, use the */
+            /* scaled distance between the centers of the hints to    */
+            /* compute the new position                               */
             par_org_center = parent->org_pos + ( parent->org_len >> 1 );
             par_cur_center = parent->cur_pos + ( parent->cur_len >> 1 );
             cur_org_center = hint->org_pos   + ( hint->org_len   >> 1 );
@@ -534,10 +543,10 @@
                * around the nearest pixel center
                */
 #if 1
-              pos = ( pos + ( len >> 1 ) ) & -64;
+              pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );
 #else
              /* this seems to be a bug! */
-              pos = ( pos + ( ( len >> 1 ) & -64 ) );
+              pos = pos + FT_PIX_FLOOR( len >> 1 );
 #endif
               len = 64;
             }
@@ -562,7 +571,7 @@
         if ( len < 64 )
           len = 64;
         else
-          len = ( len + 32 ) & -64;
+          len = FT_PIX_ROUND( len );
 
         switch ( align.align )
         {
@@ -583,9 +592,9 @@
           default:
             hint->cur_len = len;
             if ( len & 64 )
-              pos = ( ( pos + ( len >> 1 ) ) & -64 ) + 32;
+              pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ) + 32;
             else
-              pos = ( pos + ( len >> 1 ) + 32 ) & -64;
+              pos = FT_PIX_ROUND( pos + ( len >> 1 ) );
 
             hint->cur_pos = pos - ( len >> 1 );
             hint->cur_len = len;
@@ -739,13 +748,13 @@
 
             if ( ( len / 64 ) & 1 )
             {
-              delta_a = ( center & -64 ) + 32 - center;
-              delta_b = ( ( center + 32 ) & - 64 ) - center;
+              delta_a = FT_PIX_FLOOR( center ) + 32 - center;
+              delta_b = FT_PIX_ROUND( center ) - center;
             }
             else
             {
-              delta_a = ( ( center + 32 ) & - 64 ) - center;
-              delta_b = ( center & -64 ) + 32 - center;
+              delta_a = FT_PIX_ROUND( center ) - center;
+              delta_b = FT_PIX_FLOOR( center ) + 32 - center;
             }
 
             /* We choose between B) and C) above based on the amount
@@ -762,8 +771,7 @@
               FT_Fixed  side_delta = psh_hint_snap_stem_side_delta ( pos,
                                                                      len );
 
-
-              if ( ABS( side_delta ) < ABS( delta_b ) )
+              if ( FT_ABS( side_delta ) < FT_ABS( delta_b ) )
                 pos += side_delta;
               else
                 pos += delta_b;
@@ -1111,7 +1119,7 @@
     /* clear all fields */
     FT_MEM_ZERO( glyph, sizeof ( *glyph ) );
 
-    memory = globals->memory;
+    memory = glyph->memory = globals->memory;
 
     /* allocate and setup points + contours arrays */
     if ( FT_NEW_ARRAY( glyph->points,   outline->n_points   ) ||
@@ -1218,7 +1226,6 @@
       }
     }
 
-    glyph->memory  = memory;
     glyph->outline = outline;
     glyph->globals = globals;
 
@@ -1323,8 +1330,8 @@
       ;
     }
 
-    /* for each extrema, determine its direction along the */
-    /* orthogonal axis                                     */
+    /* for each extremum, determine its direction along the */
+    /* orthogonal axis                                      */
     for ( n = 0; n < glyph->num_points; n++ )
     {
       PSH_Point  point, before, after;
@@ -1370,9 +1377,6 @@
   }
 
 
-#define PSH_STRONG_THRESHOLD  30
-
-
   /* major_dir is the direction for points on the bottom/left of the stem; */
   /* Points on the top/right of the stem will have a direction of          */
   /* -major_dir.                                                           */
@@ -1380,6 +1384,7 @@
   static void
   psh_hint_table_find_strong_point( PSH_Hint_Table  table,
                                     PSH_Point       point,
+                                    FT_Int          threshold,
                                     FT_Int          major_dir )
   {
     PSH_Hint*  sort      = table->sort;
@@ -1409,7 +1414,7 @@
           flag = PSH_POINT_EDGE_MIN;
           d    = point->org_u - hint->org_pos;
 
-          if ( ABS( d ) < PSH_STRONG_THRESHOLD )
+          if ( FT_ABS( d ) < threshold )
           {
           Is_Strong:
             psh_point_set_strong( point );
@@ -1423,7 +1428,7 @@
           flag = PSH_POINT_EDGE_MAX;
           d    = point->org_u - hint->org_pos - hint->org_len;
 
-          if ( ABS( d ) < PSH_STRONG_THRESHOLD )
+          if ( FT_ABS( d ) < threshold )
             goto Is_Strong;
         }
       }
@@ -1459,7 +1464,7 @@
           flag = PSH_POINT_EDGE_MIN;
           d    = point->org_u - hint->org_pos;
 
-          if ( ABS( d ) < PSH_STRONG_THRESHOLD )
+          if ( FT_ABS( d ) < threshold )
           {
           Is_Strong2:
             point->flags2 |= flag;
@@ -1473,7 +1478,7 @@
           flag = PSH_POINT_EDGE_MAX;
           d    = point->org_u - hint->org_pos - hint->org_len;
 
-          if ( ABS( d ) < PSH_STRONG_THRESHOLD )
+          if ( FT_ABS( d ) < threshold )
             goto Is_Strong2;
         }
 
@@ -1489,74 +1494,165 @@
   }
 
 
+  /* the accepted shift for strong points in fractional pixels */
+#define PSH_STRONG_THRESHOLD  32
+
+  /* the maximum shift value in font units */
+#define PSH_STRONG_THRESHOLD_MAXIMUM  30
+
+
   /* find strong points in a glyph */
   static void
   psh_glyph_find_strong_points( PSH_Glyph  glyph,
                                 FT_Int     dimension )
   {
-    /* a point is strong if it is located on a stem                   */
-    /* edge and has an "in" or "out" tangent to the hint's direction  */
-    {
-      PSH_Hint_Table  table     = &glyph->hint_tables[dimension];
-      PS_Mask         mask      = table->hint_masks->masks;
-      FT_UInt         num_masks = table->hint_masks->num_masks;
-      FT_UInt         first     = 0;
-      FT_Int          major_dir = dimension == 0 ? PSH_DIR_VERTICAL
-                                                 : PSH_DIR_HORIZONTAL;
+    /* a point is `strong' if it is located on a stem edge and       */
+    /* has an `in' or `out' tangent parallel to the hint's direction */
 
+    PSH_Hint_Table  table     = &glyph->hint_tables[dimension];
+    PS_Mask         mask      = table->hint_masks->masks;
+    FT_UInt         num_masks = table->hint_masks->num_masks;
+    FT_UInt         first     = 0;
+    FT_Int          major_dir = dimension == 0 ? PSH_DIR_VERTICAL
+                                               : PSH_DIR_HORIZONTAL;
+    PSH_Dimension   dim       = &glyph->globals->dimension[dimension];
+    FT_Fixed        scale     = dim->scale_mult;
+    FT_Int          threshold;
 
-      /* process secondary hints to "selected" points */
-      if ( num_masks > 1 && glyph->num_points > 0 )
+
+    threshold = (FT_Int)FT_DivFix( PSH_STRONG_THRESHOLD, scale );
+    if ( threshold > PSH_STRONG_THRESHOLD_MAXIMUM )
+      threshold = PSH_STRONG_THRESHOLD_MAXIMUM;
+
+    /* process secondary hints to `selected' points */
+    if ( num_masks > 1 && glyph->num_points > 0 )
+    {
+      first = mask->end_point;
+      mask++;
+      for ( ; num_masks > 1; num_masks--, mask++ )
       {
-        first = mask->end_point;
-        mask++;
-        for ( ; num_masks > 1; num_masks--, mask++ )
-        {
-          FT_UInt  next;
-          FT_Int   count;
+        FT_UInt  next;
+        FT_Int   count;
 
 
-          next  = mask->end_point;
-          count = next - first;
-          if ( count > 0 )
-          {
-            PSH_Point  point = glyph->points + first;
+        next  = mask->end_point;
+        count = next - first;
+        if ( count > 0 )
+        {
+          PSH_Point  point = glyph->points + first;
 
 
-            psh_hint_table_activate_mask( table, mask );
+          psh_hint_table_activate_mask( table, mask );
 
-            for ( ; count > 0; count--, point++ )
-              psh_hint_table_find_strong_point( table, point, major_dir );
-          }
-          first = next;
+          for ( ; count > 0; count--, point++ )
+            psh_hint_table_find_strong_point( table, point,
+                                              threshold, major_dir );
         }
+        first = next;
       }
+    }
 
-      /* process primary hints for all points */
-      if ( num_masks == 1 )
+    /* process primary hints for all points */
+    if ( num_masks == 1 )
+    {
+      FT_UInt    count = glyph->num_points;
+      PSH_Point  point = glyph->points;
+
+
+      psh_hint_table_activate_mask( table, table->hint_masks->masks );
+      for ( ; count > 0; count--, point++ )
       {
-        FT_UInt    count = glyph->num_points;
-        PSH_Point  point = glyph->points;
+        if ( !psh_point_is_strong( point ) )
+          psh_hint_table_find_strong_point( table, point,
+                                            threshold, major_dir );
+      }
+    }
 
+    /* now, certain points may have been attached to a hint and */
+    /* not marked as strong; update their flags then            */
+    {
+      FT_UInt    count = glyph->num_points;
+      PSH_Point  point = glyph->points;
 
-        psh_hint_table_activate_mask( table, table->hint_masks->masks );
-        for ( ; count > 0; count--, point++ )
-        {
-          if ( !psh_point_is_strong( point ) )
-            psh_hint_table_find_strong_point( table, point, major_dir );
-        }
+
+      for ( ; count > 0; count--, point++ )
+        if ( point->hint && !psh_point_is_strong( point ) )
+          psh_point_set_strong( point );
+    }
+  }
+
+
+  /* find points in a glyph which are in a blue zone and have `in' or */
+  /* `out' tangents parallel to the horizontal axis                   */
+  static void
+  psh_glyph_find_blue_points( PSH_Blues  blues,
+                              PSH_Glyph  glyph )
+  {
+    PSH_Blue_Table  table;
+    PSH_Blue_Zone   zone;
+    FT_UInt         glyph_count = glyph->num_points;
+    FT_UInt         blue_count;
+    PSH_Point       point = glyph->points;
+
+
+    for ( ; glyph_count > 0; glyph_count--, point++ )
+    {
+      FT_Pos  y;
+
+
+      /* check tangents */
+      if ( !PSH_DIR_COMPARE( point->dir_in,  PSH_DIR_HORIZONTAL ) &&
+           !PSH_DIR_COMPARE( point->dir_out, PSH_DIR_HORIZONTAL ) )
+        continue;
+
+      /* skip strong points */
+      if ( psh_point_is_strong( point ) )
+        continue;
+
+      y = point->org_u;
+
+      /* look up top zones */
+      table      = &blues->normal_top;
+      blue_count = table->count;
+      zone       = table->zones;
+
+      for ( ; blue_count > 0; blue_count--, zone++ )
+      {
+        FT_Pos  delta = y - zone->org_bottom;
+
+
+        if ( delta < -blues->blue_fuzz )
+          break;
+
+        if ( y <= zone->org_top + blues->blue_fuzz )
+          if ( blues->no_overshoots || delta <= blues->blue_threshold )
+          {
+            point->cur_u = zone->cur_bottom;
+            psh_point_set_strong( point );
+            psh_point_set_fitted( point );
+          }
       }
 
-      /* now, certain points may have been attached to hint and */
-      /* not marked as strong; update their flags then          */
+      /* look up bottom zones */
+      table      = &blues->normal_bottom;
+      blue_count = table->count;
+      zone       = table->zones + blue_count - 1;
+
+      for ( ; blue_count > 0; blue_count--, zone-- )
       {
-        FT_UInt    count = glyph->num_points;
-        PSH_Point  point = glyph->points;
+        FT_Pos  delta = zone->org_top - y;
 
 
-        for ( ; count > 0; count--, point++ )
-          if ( point->hint && !psh_point_is_strong( point ) )
+        if ( delta < -blues->blue_fuzz )
+          break;
+
+        if ( y >= zone->org_bottom - blues->blue_fuzz )
+          if ( blues->no_overshoots || delta < blues->blue_threshold )
+          {
+            point->cur_u = zone->cur_top;
             psh_point_set_strong( point );
+            psh_point_set_fitted( point );
+          }
       }
     }
   }
@@ -1570,50 +1666,45 @@
     PSH_Dimension  dim   = &glyph->globals->dimension[dimension];
     FT_Fixed       scale = dim->scale_mult;
 
+    FT_UInt        count = glyph->num_points;
+    PSH_Point      point = glyph->points;
+
 
+    for ( ; count > 0; count--, point++ )
     {
-      FT_UInt    count = glyph->num_points;
-      PSH_Point  point = glyph->points;
+      PSH_Hint  hint = point->hint;
 
 
-      for ( ; count > 0; count--, point++ )
+      if ( hint )
       {
-        PSH_Hint  hint = point->hint;
+        FT_Pos  delta;
 
 
-        if ( hint )
-        {
-          FT_Pos  delta;
+        if ( psh_point_is_edge_min( point ) )
+          point->cur_u = hint->cur_pos;
 
+        else if ( psh_point_is_edge_max( point ) )
+          point->cur_u = hint->cur_pos + hint->cur_len;
 
-          if ( psh_point_is_edge_min( point ) )
-          {
-            point->cur_u = hint->cur_pos;
-          }
-          else if ( psh_point_is_edge_max( point ) )
-          {
-            point->cur_u = hint->cur_pos + hint->cur_len;
-          }
-          else
-          {
-            delta = point->org_u - hint->org_pos;
+        else
+        {
+          delta = point->org_u - hint->org_pos;
 
-            if ( delta <= 0 )
-              point->cur_u = hint->cur_pos + FT_MulFix( delta, scale );
+          if ( delta <= 0 )
+            point->cur_u = hint->cur_pos + FT_MulFix( delta, scale );
 
-            else if ( delta >= hint->org_len )
-              point->cur_u = hint->cur_pos + hint->cur_len +
-                               FT_MulFix( delta - hint->org_len, scale );
-
-            else if ( hint->org_len > 0 )
-              point->cur_u = hint->cur_pos +
-                               FT_MulDiv( delta, hint->cur_len,
-                                          hint->org_len );
-            else
-              point->cur_u = hint->cur_pos;
-          }
-          psh_point_set_fitted( point );
+          else if ( delta >= hint->org_len )
+            point->cur_u = hint->cur_pos + hint->cur_len +
+                             FT_MulFix( delta - hint->org_len, scale );
+
+          else if ( hint->org_len > 0 )
+            point->cur_u = hint->cur_pos +
+                             FT_MulDiv( delta, hint->cur_len,
+                                        hint->org_len );
+          else
+            point->cur_u = hint->cur_pos;
         }
+        psh_point_set_fitted( point );
       }
     }
   }
@@ -1625,109 +1716,107 @@
   {
 
 #if 1
+    /* first technique: a point is strong if it is a local extremum */
 
     PSH_Dimension  dim   = &glyph->globals->dimension[dimension];
     FT_Fixed       scale = dim->scale_mult;
 
+    FT_UInt        count = glyph->num_points;
+    PSH_Point      point = glyph->points;
 
-    /* first technique: a point is strong if it is a local extrema */
-    {
-      FT_UInt    count = glyph->num_points;
-      PSH_Point  point = glyph->points;
 
+    for ( ; count > 0; count--, point++ )
+    {
+      if ( psh_point_is_strong( point ) )
+        continue;
 
-      for ( ; count > 0; count--, point++ )
+      /* sometimes, some local extrema are smooth points */
+      if ( psh_point_is_smooth( point ) )
       {
-        if ( psh_point_is_strong( point ) )
+        if ( point->dir_in == PSH_DIR_NONE   ||
+             point->dir_in != point->dir_out )
           continue;
 
-        /* sometimes, some local extremas are smooth points */
-        if ( psh_point_is_smooth( point ) )
-        {
-          if ( point->dir_in == PSH_DIR_NONE   ||
-               point->dir_in != point->dir_out )
-            continue;
-
-          if ( !psh_point_is_extremum( point )   &&
-               !psh_point_is_inflex( point ) )
-            continue;
+        if ( !psh_point_is_extremum( point ) &&
+             !psh_point_is_inflex( point )   )
+          continue;
 
-          point->flags &= ~PSH_POINT_SMOOTH;
-        }
+        point->flags &= ~PSH_POINT_SMOOTH;
+      }
 
-        /* find best enclosing point coordinates */
-        {
-          PSH_Point  before = 0;
-          PSH_Point  after  = 0;
+      /* find best enclosing point coordinates */
+      {
+        PSH_Point  before = 0;
+        PSH_Point  after  = 0;
 
-          FT_Pos     diff_before = -32000;
-          FT_Pos     diff_after  =  32000;
-          FT_Pos     u = point->org_u;
+        FT_Pos     diff_before = -32000;
+        FT_Pos     diff_after  =  32000;
+        FT_Pos     u = point->org_u;
 
-          FT_Int     count2 = glyph->num_points;
-          PSH_Point  cur    = glyph->points;
+        FT_Int     count2 = glyph->num_points;
+        PSH_Point  cur    = glyph->points;
 
 
-          for ( ; count2 > 0; count2--, cur++ )
+        for ( ; count2 > 0; count2--, cur++ )
+        {
+          if ( psh_point_is_strong( cur ) )
           {
-            if ( psh_point_is_strong( cur ) )
-            {
-              FT_Pos  diff = cur->org_u - u;;
+            FT_Pos  diff = cur->org_u - u;
 
 
-              if ( diff <= 0 )
+            if ( diff <= 0 )
+            {
+              if ( diff > diff_before )
               {
-                if ( diff > diff_before )
-                {
-                  diff_before = diff;
-                  before      = cur;
-                }
+                diff_before = diff;
+                before      = cur;
               }
-              else if ( diff >= 0 )
+            }
+
+            else if ( diff >= 0 )
+            {
+              if ( diff < diff_after )
               {
-                if ( diff < diff_after )
-                {
-                  diff_after = diff;
-                  after      = cur;
-                }
+                diff_after = diff;
+                after      = cur;
               }
             }
           }
+        }
 
-          if ( !before )
-          {
-            if ( !after )
-              continue;
+        if ( !before )
+        {
+          if ( !after )
+            continue;
 
-            /* we are before the first strong point coordinate; */
-            /* simply translate the point                       */
-            point->cur_u = after->cur_u +
+          /* we are before the first strong point coordinate; */
+          /* simply translate the point                       */
+          point->cur_u = after->cur_u +
                            FT_MulFix( point->org_u - after->org_u, scale );
-          }
-          else if ( !after )
-          {
-            /* we are after the last strong point coordinate; */
-            /* simply translate the point                     */
-            point->cur_u = before->cur_u +
+        }
+        else if ( !after )
+        {
+          /* we are after the last strong point coordinate; */
+          /* simply translate the point                     */
+          point->cur_u = before->cur_u +
                            FT_MulFix( point->org_u - before->org_u, scale );
-          }
-          else
-          {
-            if ( diff_before == 0 )
-              point->cur_u = before->cur_u;
+        }
+        else
+        {
+          if ( diff_before == 0 )
+            point->cur_u = before->cur_u;
 
-            else if ( diff_after == 0 )
-              point->cur_u = after->cur_u;
+          else if ( diff_after == 0 )
+            point->cur_u = after->cur_u;
 
-            else
-              point->cur_u = before->cur_u +
+          else
+            point->cur_u = before->cur_u +
                              FT_MulDiv( u - before->org_u,
                                         after->cur_u - before->cur_u,
                                         after->org_u - before->org_u );
-          }
-
-          psh_point_set_fitted( point );
         }
+
+        psh_point_set_fitted( point );
       }
     }
 
@@ -1940,7 +2029,7 @@
 
 
       scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
-      fitted = ( scaled + 32 ) & -64;
+      fitted = FT_PIX_ROUND( scaled );
 
       if (scaled != fitted ) {
         y_scale = FT_MulDiv( y_scale, fitted, scaled );
@@ -1979,6 +2068,8 @@
 
       /* find strong points, align them, then interpolate others */
       psh_glyph_find_strong_points( glyph, dimension );
+      if ( dimension == 1 )
+        psh_glyph_find_blue_points( &globals->blues, glyph );
       psh_glyph_interpolate_strong_points( glyph, dimension );
       psh_glyph_interpolate_normal_points( glyph, dimension );
       psh_glyph_interpolate_other_points( glyph, dimension );

reactos/lib/freetype/src/pshinter
pshglob.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- pshglob.c	15 Feb 2004 21:45:34 -0000	1.4
+++ pshglob.c	10 May 2004 17:48:33 -0000	1.5
@@ -5,7 +5,7 @@
 /*    PostScript hinter global hinting management (body).                  */
 /*    Inspired by the new auto-hinter module.                              */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
@@ -52,7 +52,7 @@
     if ( count > 0 )
     {
       width->cur = FT_MulFix( width->org, scale );
-      width->fit = FT_RoundFix( width->cur );
+      width->fit = FT_PIX_ROUND( width->cur );
 
       width++;
       count--;
@@ -72,7 +72,7 @@
           w = stand->cur;
 
         width->cur = w;
-        width->fit = FT_RoundFix( w );
+        width->fit = FT_PIX_ROUND( w );
       }
     }
   }
@@ -377,7 +377,7 @@
     /* parameter to the raw bluescale value.  Here is why:    */
     /*                                                        */
     /*   We need to suppress overshoots for all pointsizes.   */
-    /*   At 300dpi that satisfy:                              */
+    /*   At 300dpi that satisfies:                            */
     /*                                                        */
     /*      pointsize < 240*bluescale + 0.49                  */
     /*                                                        */
@@ -396,7 +396,16 @@
     /*                                                        */
     /*      "scale < bluescale"                               */
     /*                                                        */
-    blues->no_overshoots = FT_BOOL( scale < blues->blue_scale );
+    /* Note that `blue_scale' is stored 1000 times its real   */
+    /* value, and that `scale' converts from font units to    */
+    /* fractional pixels.                                     */
+    /*                                                        */
+
+    /* 1000 / 64 = 125 / 8 */
+    if ( scale >= 0x20C49BAL )
+      blues->no_overshoots = FT_BOOL( scale < blues->blue_scale * 8 / 125 );
+    else
+      blues->no_overshoots = FT_BOOL( scale * 125 < blues->blue_scale * 8 );
 
     /*                                                        */
     /*  The blue threshold is the font units distance under   */
@@ -412,7 +421,7 @@
 
 
       while ( threshold > 0 && FT_MulFix( threshold, scale ) > 32 )
-        threshold --;
+        threshold--;
 
       blues->blue_threshold = threshold;
     }
@@ -448,7 +457,7 @@
         zone->cur_delta  = FT_MulFix( zone->org_delta,  scale );
 
         /* round scaled reference position */
-        zone->cur_ref = ( zone->cur_ref + 32 ) & -64;
+        zone->cur_ref = FT_PIX_ROUND( zone->cur_ref );
 
 #if 0
         if ( zone->cur_ref > zone->cur_top )
@@ -530,7 +539,7 @@
 
     no_shoots = blues->no_overshoots;
 
-    /* lookup stem top in top zones table */
+    /* look up stem top in top zones table */
     table = &blues->normal_top;
     count = table->count;
     zone  = table->zones;
@@ -565,7 +574,7 @@
 
       if ( stem_bot >= zone->org_bottom - blues->blue_fuzz )
       {
-        if ( no_shoots || delta < blues->blue_shift )
+        if ( no_shoots || delta < blues->blue_threshold )
         {
           alignment->align    |= PSH_BLUE_ALIGN_BOT;
           alignment->align_bot = zone->cur_ref;
@@ -644,7 +653,7 @@
           read++;
         }
 
-        dim->stdw.count = priv->num_snap_widths;
+        dim->stdw.count = priv->num_snap_widths + 1;
       }
 
       /* copy standard heights */
@@ -654,7 +663,7 @@
 
 
         write->org = priv->standard_height[0];
-        write++;                           
+        write++;
         read = priv->snap_heights;
         for ( count = priv->num_snap_heights; count > 0; count-- )
         {
@@ -663,7 +672,7 @@
           read++;
         }
 
-        dim->stdw.count = priv->num_snap_heights;
+        dim->stdw.count = priv->num_snap_heights + 1;
       }
 
       /* copy blue zones */
@@ -675,15 +684,9 @@
                            priv->family_blues, priv->num_family_other_blues,
                            priv->family_other_blues, priv->blue_fuzz, 1 );
 
-      globals->blues.blue_scale = priv->blue_scale
-                                  ? priv->blue_scale
-                                  : 0x27A000L; /* 0.039625 * 0x10000 * 1000 */
-
-      globals->blues.blue_shift = priv->blue_shift
-                                  ? priv->blue_shift
-                                  : 7;
-
-      globals->blues.blue_fuzz = priv->blue_fuzz;
+      globals->blues.blue_scale = priv->blue_scale;
+      globals->blues.blue_shift = priv->blue_shift;
+      globals->blues.blue_fuzz  = priv->blue_fuzz;
 
       globals->dimension[0].scale_mult  = 0;
       globals->dimension[0].scale_delta = 0;

reactos/lib/freetype/src/pshinter
pshrec.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- pshrec.c	15 Feb 2004 21:45:34 -0000	1.4
+++ pshrec.c	10 May 2004 17:48:33 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PostScript hints recorder (body).                           */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003 by                                          */
+/*  Copyright 2001, 2002, 2003, 2004 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -68,7 +68,7 @@
     if ( new_max > old_max )
     {
       /* try to grow the table */
-      new_max = ( new_max + 7 ) & -8;
+      new_max = FT_PAD_CEIL( new_max, 8 );
       if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
         table->max_hints = new_max;
     }
@@ -142,7 +142,7 @@
 
     if ( new_max > old_max )
     {
-      new_max = ( new_max + 7 ) & -8;
+      new_max = FT_PAD_CEIL( new_max, 8 );
       if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
         mask->max_bits = new_max * 8;
     }
@@ -239,7 +239,7 @@
 
     if ( new_max > old_max )
     {
-      new_max = ( new_max + 7 ) & -8;
+      new_max = FT_PAD_CEIL( new_max, 8 );
       if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) )
         table->max_masks = new_max;
     }
@@ -318,8 +318,7 @@
     PS_Mask   mask;
 
 
-    /* allocate new mask, and grow it to "bit_count" bits */
-    error = ps_mask_table_alloc( table, memory, &mask );
+    error = ps_mask_table_last( table, memory, &mask );
     if ( error )
       goto Exit;
 
@@ -1012,18 +1011,18 @@
         FT_ERROR(( "ps_hints_t2mask: "
                    "called with invalid bitcount %d (instead of %d)\n",
                    bit_count, count1 + count2 ));
-        
+
         /* simply ignore the operator */
         return;
       }
 
       /* set-up new horizontal and vertical hint mask now */
-      error = ps_dimension_set_mask_bits( &dim[0], bytes, 0, count1,
+      error = ps_dimension_set_mask_bits( &dim[0], bytes, count2, count1,
                                           end_point, memory );
       if ( error )
         goto Fail;
 
-      error = ps_dimension_set_mask_bits( &dim[1], bytes, count1, count2,
+      error = ps_dimension_set_mask_bits( &dim[1], bytes, 0, count2,
                                           end_point, memory );
       if ( error )
         goto Fail;
@@ -1057,7 +1056,7 @@
         FT_ERROR(( "ps_hints_t2counter: "
                    "called with invalid bitcount %d (instead of %d)\n",
                    bit_count, count1 + count2 ));
-                   
+
         /* simply ignore the operator */
         return;
       }

reactos/lib/freetype/src/pshinter
pshrec.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- pshrec.h	15 Feb 2004 21:45:34 -0000	1.4
+++ pshrec.h	10 May 2004 17:48:33 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Postscript (Type1/Type2) hints recorder (specification).             */
 /*                                                                         */
-/*  Copyright 2001, 2002 by                                                */
+/*  Copyright 2001, 2002, 2003 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */

reactos/lib/freetype/src/psnames
psmodule.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- psmodule.c	15 Feb 2004 21:45:34 -0000	1.4
+++ psmodule.c	10 May 2004 17:48:34 -0000	1.5
@@ -17,8 +17,8 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 #include "psmodule.h"
 #include "pstables.h"
@@ -176,10 +176,10 @@
 
   /* Builds a table that maps Unicode values to glyph indices */
   static FT_Error
-  ps_build_unicode_table( FT_Memory     memory,
-                          FT_UInt       num_glyphs,
-                          const char**  glyph_names,
-                          PS_Unicodes*  table )
+  ps_unicodes_init( FT_Memory     memory,
+                    FT_UInt       num_glyphs,
+                    const char**  glyph_names,
+                    PS_Unicodes*  table )
   {
     FT_Error  error;
 
@@ -242,8 +242,8 @@
 
 
   static FT_UInt
-  ps_lookup_unicode( PS_Unicodes*  table,
-                     FT_ULong      unicode )
+  ps_unicodes_char_index( PS_Unicodes*  table,
+                          FT_ULong      unicode )
   {
     PS_UniMap  *min, *max, *mid;
 
@@ -273,8 +273,8 @@
 
 
   static FT_ULong
-  ps_next_unicode( PS_Unicodes*  table,
-                   FT_ULong      unicode )
+  ps_unicodes_char_next( PS_Unicodes*  table,
+                         FT_ULong      unicode )
   {
     PS_UniMap  *min, *max, *mid;
 
@@ -335,40 +335,52 @@
 
 
   static
-  const PSNames_Interface  psnames_interface =
+  const FT_Service_PsCMapsRec  pscmaps_interface =
   {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
-    (PS_Unicode_Value_Func)    ps_unicode_value,
-    (PS_Build_Unicodes_Func)   ps_build_unicode_table,
-    (PS_Lookup_Unicode_Func)   ps_lookup_unicode,
+    (PS_Unicode_ValueFunc)     ps_unicode_value,
+    (PS_Unicodes_InitFunc)     ps_unicodes_init,
+    (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,
+    (PS_Unicodes_CharNextFunc) ps_unicodes_char_next,
 
 #else
 
     0,
     0,
     0,
+    0,
 
 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
-    (PS_Macintosh_Name_Func)    ps_get_macintosh_name,
-    (PS_Adobe_Std_Strings_Func) ps_get_standard_strings,
+    (PS_Macintosh_Name_Func)   ps_get_macintosh_name,
+    (PS_Adobe_Std_Strings_Func)ps_get_standard_strings,
 
     t1_standard_encoding,
-    t1_expert_encoding,
+    t1_expert_encoding
+  };
 
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-    (PS_Next_Unicode_Func)     ps_next_unicode
-#else
-    0
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
+  static const FT_ServiceDescRec  pscmaps_services[] =
+  {
+    { FT_SERVICE_ID_POSTSCRIPT_CMAPS, &pscmaps_interface },
+    { NULL, NULL }
   };
 
 
+  static FT_Pointer
+  psnames_get_service( FT_Module    module,
+                       const char*  service_id )
+  {
+    FT_UNUSED( module );
+
+    return ft_service_list_lookup( pscmaps_services, service_id );
+  }
+
 #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
 
 
+
   FT_CALLBACK_TABLE_DEF
   const FT_Module_Class  psnames_module_class =
   {
@@ -381,13 +393,15 @@
 
 #ifdef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
     0,
-#else
-    (void*)&psnames_interface,   /* module specific interface */
-#endif
-
     (FT_Module_Constructor)0,
     (FT_Module_Destructor) 0,
     (FT_Module_Requester)  0
+#else
+    (void*)&pscmaps_interface,   /* module specific interface */
+    (FT_Module_Constructor)0,
+    (FT_Module_Destructor) 0,
+    (FT_Module_Requester)  psnames_get_service
+#endif
   };
 
 

reactos/lib/freetype/src/raster
ftrend1.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftrend1.c	15 Feb 2004 21:45:34 -0000	1.4
+++ ftrend1.c	10 May 2004 17:48:34 -0000	1.5
@@ -140,10 +140,10 @@
     /* compute the control box, and grid fit it */
     FT_Outline_Get_CBox( outline, &cbox );
 
-    cbox.xMin &= -64;
-    cbox.yMin &= -64;
-    cbox.xMax  = ( cbox.xMax + 63 ) & -64;
-    cbox.yMax  = ( cbox.yMax + 63 ) & -64;
+    cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+    cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+    cbox.xMax = FT_PIX_CEIL( cbox.xMax );
+    cbox.yMax = FT_PIX_CEIL( cbox.yMax );
 
     width  = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
     height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
@@ -161,7 +161,7 @@
     if ( !( mode & FT_RENDER_MODE_MONO ) )
     {
       /* we pad to 32 bits, only for backwards compatibility with FT 1.x */
-      pitch = ( width + 3 ) & -4;
+      pitch = FT_PAD_CEIL( width, 4 );
       bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
       bitmap->num_grays  = 256;
     }
@@ -193,9 +193,9 @@
 
     /* render outline into the bitmap */
     error = render->raster_render( render->raster, &params );
-    
+
     FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );
-    
+
     if ( error )
       goto Exit;
 

reactos/lib/freetype/src/sfnt
Jamfile 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- Jamfile	15 Feb 2004 21:45:35 -0000	1.3
+++ Jamfile	10 May 2004 17:48:34 -0000	1.4
@@ -1,4 +1,4 @@
-# FreeType 2 src/sfnt Jamfile (c) 2001, 2002 David Turner
+# FreeType 2 src/sfnt Jamfile (c) 2001, 2002, 2004 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;
@@ -8,7 +8,7 @@
 
   if $(FT2_MULTI)
   {
-    _sources = sfobjs sfdriver ttcmap ttcmap0 ttpost ttload ttsbit ;
+    _sources = sfobjs sfdriver ttcmap0 ttpost ttload ttsbit ;
   }
   else
   {

reactos/lib/freetype/src/sfnt
rules.mk 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- rules.mk	15 Feb 2004 21:45:35 -0000	1.4
+++ rules.mk	10 May 2004 17:48:34 -0000	1.5
@@ -26,7 +26,6 @@
 # SFNT driver sources (i.e., C files)
 #
 SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c   \
-                $(SFNT_DIR)/ttcmap.c   \
                 $(SFNT_DIR)/ttcmap0.c  \
                 $(SFNT_DIR)/ttsbit.c   \
                 $(SFNT_DIR)/ttpost.c   \

reactos/lib/freetype/src/sfnt
sfdriver.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- sfdriver.c	15 Feb 2004 21:45:35 -0000	1.5
+++ sfdriver.c	10 May 2004 17:48:35 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level SFNT driver interface (body).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,9 +22,10 @@
 
 #include "sfdriver.h"
 #include "ttload.h"
-#include "ttcmap.h"
 #include "sfobjs.h"
 
+#include "sferrors.h"
+
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
 #include "ttsbit.h"
 #endif
@@ -33,6 +34,18 @@
 #include "ttpost.h"
 #endif
 
+#include "ttcmap0.h"
+
+#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_SFNT_H
+#include FT_SERVICE_TT_CMAP_H
+
+
+ /*
+  *  SFNT TABLE SERVICE
+  *
+  */
 
   static void*
   get_sfnt_table( TT_Face      face,
@@ -79,11 +92,22 @@
   }
 
 
+  static const FT_Service_SFNT_TableRec  sfnt_service_sfnt_table =
+  {
+    (FT_SFNT_TableLoadFunc)tt_face_load_any,
+    (FT_SFNT_TableGetFunc) get_sfnt_table
+  };
+
+
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
+ /*
+  *  GLYPH DICT SERVICE
+  *
+  */
 
   static FT_Error
-  get_sfnt_glyph_name( TT_Face     face,
+  sfnt_get_glyph_name( TT_Face     face,
                        FT_UInt     glyph_index,
                        FT_Pointer  buffer,
                        FT_UInt     buffer_max )
@@ -109,16 +133,30 @@
   }
 
 
+  static const FT_Service_GlyphDictRec  sfnt_service_glyph_dict =
+  {
+    (FT_GlyphDict_GetNameFunc)  sfnt_get_glyph_name,
+    (FT_GlyphDict_NameIndexFunc)NULL
+  };
+
+#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
+
+
+ /*
+  *  POSTSCRIPT NAME SERVICE
+  *
+  */
+
   static const char*
-  get_sfnt_postscript_name( TT_Face  face )
+  sfnt_get_ps_name( TT_Face  face )
   {
     FT_Int       n, found_win, found_apple;
     const char*  result = NULL;
 
 
     /* shouldn't happen, but just in case to avoid memory leaks */
-    if ( face->root.internal->postscript_name )
-      return face->root.internal->postscript_name;
+    if ( face->postscript_name )
+      return face->postscript_name;
 
     /* scan the name table to see whether we have a Postscript name here, */
     /* either in Macintosh or Windows platform encodings                  */
@@ -215,12 +253,42 @@
     }
 
   Exit:
-    face->root.internal->postscript_name = result;
+    face->postscript_name = result;
     return result;
   }
 
+  static const FT_Service_PsFontNameRec  sfnt_service_ps_name =
+  {
+    (FT_PsName_GetFunc)sfnt_get_ps_name
+  };
 
-#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
+
+ /*
+  *  TT CMAP INFO
+  *
+  */
+  static const FT_Service_TTCMapsRec  tt_service_get_cmap_info =
+  {
+    (TT_CMap_Info_GetFunc)tt_get_cmap_info
+  };
+
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  sfnt_services[] =
+  {
+    { FT_SERVICE_ID_SFNT_TABLE,           &sfnt_service_sfnt_table },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name },
+#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
+    { FT_SERVICE_ID_GLYPH_DICT,           &sfnt_service_glyph_dict },
+#endif
+    { FT_SERVICE_ID_TT_CMAP,              &tt_service_get_cmap_info },
+
+    { NULL, NULL }
+  };
 
 
   FT_CALLBACK_DEF( FT_Module_Interface )
@@ -235,15 +303,7 @@
     if ( ft_strcmp( module_interface, "load_sfnt" ) == 0 )
       return (FT_Module_Interface)tt_face_load_any;
 
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    if ( ft_strcmp( module_interface, "glyph_name" ) == 0 )
-      return (FT_Module_Interface)get_sfnt_glyph_name;
-#endif
-
-    if ( ft_strcmp( module_interface, "postscript_name" ) == 0 )
-      return (FT_Module_Interface)get_sfnt_postscript_name;
-
-    return 0;
+    return ft_service_list_lookup( sfnt_services, module_interface );
   }
 
 
@@ -283,9 +343,11 @@
     /* see `ttload.h' */
     tt_face_load_bitmap_header,
 
-    /* see `ttsbit.h' */
+    /* see `ttsbit.h' and `sfnt.h' */
     tt_face_set_sbit_strike,
     tt_face_load_sbit_strikes,
+    tt_find_sbit_image,
+    tt_load_sbit_metrics,
     tt_face_load_sbit_image,
     tt_face_free_sbit_strikes,
 
@@ -294,6 +356,8 @@
     0,
     0,
     0,
+    0, 
+    0, 
     0,
     0,
 
@@ -312,9 +376,6 @@
 
 #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
 
-    /* see `ttcmap.h' */
-    tt_face_load_charmap,
-    tt_face_free_charmap,
   };
 
 

reactos/lib/freetype/src/sfnt
sfnt.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- sfnt.c	15 Feb 2004 21:45:35 -0000	1.3
+++ sfnt.c	10 May 2004 17:48:35 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component.                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -20,7 +20,6 @@
 
 #include <ft2build.h>
 #include "ttload.c"
-#include "ttcmap.c"
 #include "ttcmap0.c"
 #include "sfobjs.c"
 #include "sfdriver.c"

reactos/lib/freetype/src/sfnt
sfobjs.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- sfobjs.c	15 Feb 2004 21:45:35 -0000	1.4
+++ sfobjs.c	10 May 2004 17:48:35 -0000	1.5
@@ -21,10 +21,9 @@
 #include "ttload.h"
 #include "ttcmap0.h"
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
-
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include "sferrors.h"
 
 
@@ -365,11 +364,7 @@
       face->goto_table = sfnt->goto_table;
     }
 
-    if ( !face->psnames )
-    {
-      face->psnames = (PSNames_Service)
-                        FT_Get_Module_Interface( library, "psnames" );
-    }
+    FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
 
     /* check that we have a valid TrueType file */
     error = sfnt->load_sfnt_header( face, stream, face_index, &sfnt_header );
@@ -405,7 +400,7 @@
                   FT_Int         num_params,
                   FT_Parameter*  params )
   {
-    FT_Error      error;
+    FT_Error      error, psnames_error;
     FT_Bool       has_outline;
     FT_Bool       is_apple_sbit;
 
@@ -467,7 +462,7 @@
     /* the following tables are optional in PCL fonts -- */
     /* don't check for errors                            */
     (void)LOAD_( names );
-    (void)LOAD_( psnames );
+    psnames_error = LOAD_( psnames );
 
     /* do not load the metrics headers and tables if this is an Apple */
     /* sbit font file                                                 */
@@ -534,9 +529,9 @@
                FT_FACE_FLAG_HORIZONTAL;   /* horizontal data   */
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-      /* might need more polish to detect the presence of a Postscript */
-      /* name table in the font                                        */
-      flags |= FT_FACE_FLAG_GLYPH_NAMES;
+      if ( psnames_error == SFNT_Err_Ok &&
+           face->postscript.FormatType != 0x00030000L )
+        flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
 
       /* fixed width font? */
@@ -643,14 +638,14 @@
           FT_Bitmap_Size*  bsize  = root->available_sizes + n;
           TT_SBit_Strike   strike = face->sbit_strikes + n;
           FT_UShort        fupem  = face->header.Units_Per_EM;
-          FT_Short         height = face->horizontal.Ascender -
-                                      face->horizontal.Descender +
-                                      face->horizontal.Line_Gap;
+          FT_Short         height = (FT_Short)( face->horizontal.Ascender -
+                                                face->horizontal.Descender +
+                                                face->horizontal.Line_Gap );
           FT_Short         avg    = face->os2.xAvgCharWidth;
 
 
           /* assume 72dpi */
-          bsize->height = 
+          bsize->height =
             (FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem );
           bsize->width  =
             (FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem );

reactos/lib/freetype/src/sfnt
ttcmap0.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ttcmap0.c	15 Feb 2004 21:45:35 -0000	1.4
+++ ttcmap0.c	10 May 2004 17:48:35 -0000	1.5
@@ -144,6 +144,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap0_get_info( TT_CMap       cmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 4;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap0_class_rec =
   {
@@ -156,7 +169,8 @@
       (FT_CMap_CharNextFunc) tt_cmap0_char_next
     },
     0,
-    (TT_CMap_ValidateFunc)   tt_cmap0_validate
+    (TT_CMap_ValidateFunc)   tt_cmap0_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap0_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_0 */
@@ -378,10 +392,13 @@
       else
       {
         /* a 16-bit character code */
-        p  += char_hi * 2;                          /* jump to key entry  */
-        sub = subs + ( TT_PEEK_USHORT( p ) & -8 );  /* jump to sub-header */
 
-        /* check that the hi byte isn't a valid one-byte value */
+        /* jump to key entry  */
+        p  += char_hi * 2;
+        /* jump to sub-header */
+        sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) );
+
+        /* check that the high byte isn't a valid one-byte value */
         if ( sub == subs )
           goto Exit;
       }
@@ -467,7 +484,7 @@
           pos = (FT_UInt)( char_lo - start );
 
         p       += offset + pos * 2;
-        charcode = ( charcode & -256 ) + char_lo;
+        charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo;
 
         for ( ; pos < count; pos++, charcode++ )
         {
@@ -487,7 +504,7 @@
 
       /* jump to next sub-header, i.e. higher byte value */
     Next_SubHeader:
-      charcode = ( charcode & -256 ) + 256;
+      charcode = FT_PAD_FLOOR( charcode, 256 ) + 256;
     }
 
   Exit:
@@ -497,6 +514,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap2_get_info( TT_CMap       cmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 4;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap2_class_rec =
   {
@@ -509,7 +539,8 @@
       (FT_CMap_CharNextFunc) tt_cmap2_char_next
     },
     2,
-    (TT_CMap_ValidateFunc)   tt_cmap2_validate
+    (TT_CMap_ValidateFunc)   tt_cmap2_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap2_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_2 */
@@ -767,7 +798,7 @@
 
 
       p         = table + 6;
-      num_segs2 = TT_PEEK_USHORT( p ) & -2;  /* be paranoid! */
+      num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );  /* be paranoid! */
 
 #if 1
       /* Some fonts have more than 170 segments in their charmaps! */
@@ -890,7 +921,7 @@
 
     code      = (FT_UInt)char_code + 1;
     p         = table + 6;
-    num_segs2 = TT_PEEK_USHORT(p) & -2;  /* ensure even-ness */
+    num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT(p), 2 );  /* ensure even-ness */
 
 #if 1
 
@@ -1058,6 +1089,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap4_get_info( TT_CMap       cmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 4;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap4_class_rec =
   {
@@ -1070,7 +1114,8 @@
       (FT_CMap_CharNextFunc) tt_cmap4_char_next
     },
     4,
-    (TT_CMap_ValidateFunc)   tt_cmap4_validate
+    (TT_CMap_ValidateFunc)   tt_cmap4_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap4_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_4 */
@@ -1202,6 +1247,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap6_get_info( TT_CMap       cmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 4;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap6_class_rec =
   {
@@ -1214,7 +1272,8 @@
       (FT_CMap_CharNextFunc) tt_cmap6_char_next
     },
     6,
-    (TT_CMap_ValidateFunc)   tt_cmap6_validate
+    (TT_CMap_ValidateFunc)   tt_cmap6_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap6_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_6 */
@@ -1439,6 +1498,18 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap8_get_info( TT_CMap       cmap,
+                     TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 8;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap8_class_rec =
   {
@@ -1451,7 +1522,8 @@
       (FT_CMap_CharNextFunc) tt_cmap8_char_next
     },
     8,
-    (TT_CMap_ValidateFunc)   tt_cmap8_validate
+    (TT_CMap_ValidateFunc)   tt_cmap8_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap8_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_8 */
@@ -1571,6 +1643,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap10_get_info( TT_CMap       cmap,
+                      TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 8;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap10_class_rec =
   {
@@ -1583,7 +1668,8 @@
       (FT_CMap_CharNextFunc) tt_cmap10_char_next
     },
     10,
-    (TT_CMap_ValidateFunc)   tt_cmap10_validate
+    (TT_CMap_ValidateFunc)   tt_cmap10_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap10_get_info
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_10 */
@@ -1741,6 +1827,19 @@
   }
 
 
+  FT_CALLBACK_DEF( FT_Error )
+  tt_cmap12_get_info( TT_CMap       cmap,
+                      TT_CMapInfo  *cmap_info )
+  {
+    FT_Byte*  p = cmap->data + 8;
+
+
+    cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
+
+    return FT_Err_Ok;
+  }
+
+
   FT_CALLBACK_TABLE_DEF
   const TT_CMap_ClassRec  tt_cmap12_class_rec =
   {
@@ -1753,7 +1852,8 @@
       (FT_CMap_CharNextFunc) tt_cmap12_char_next
     },
     12,
-    (TT_CMap_ValidateFunc)   tt_cmap12_validate
+    (TT_CMap_ValidateFunc)   tt_cmap12_validate,
+    (TT_CMap_Info_GetFunc)   tt_cmap12_get_info
   };
 
 
@@ -1866,6 +1966,7 @@
               FT_ERROR(( "tt_face_build_cmaps:" ));
               FT_ERROR(( " broken cmap sub-table ignored!\n" ));
             }
+            break;
           }
         }
       }
@@ -1875,4 +1976,16 @@
   }
 
 
+  FT_LOCAL( FT_Error )
+  tt_get_cmap_info( FT_CharMap    charmap,
+                    TT_CMapInfo  *cmap_info )
+  {
+    FT_CMap        cmap  = (FT_CMap)charmap;
+    TT_CMap_Class  clazz = (TT_CMap_Class)cmap->clazz;
+
+
+    return clazz->get_cmap_info( charmap, cmap_info );
+  }
+
+
 /* END */

reactos/lib/freetype/src/sfnt
ttcmap0.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttcmap0.h	15 Feb 2004 21:45:35 -0000	1.3
+++ ttcmap0.h	10 May 2004 17:48:35 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType new character mapping table (cmap) support (specification). */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2003 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -23,7 +23,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_TRUETYPE_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
-
+#include FT_SERVICE_TT_CMAP_H
 
 FT_BEGIN_HEADER
 
@@ -46,6 +46,7 @@
     FT_CMap_ClassRec      clazz;
     FT_UInt               format;
     TT_CMap_ValidateFunc  validate;
+    TT_CMap_Info_GetFunc  get_cmap_info;
 
   } TT_CMap_ClassRec;
 
@@ -65,6 +66,11 @@
   FT_LOCAL( FT_Error )
   tt_face_build_cmaps( TT_Face  face );
 
+  /* used in tt-cmaps service */
+  FT_LOCAL( FT_Error )
+  tt_get_cmap_info( FT_CharMap    charmap,
+                    TT_CMapInfo  *cmap_info );
+
 
 FT_END_HEADER
 

reactos/lib/freetype/src/sfnt
ttload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttload.c	15 Feb 2004 21:45:35 -0000	1.5
+++ ttload.c	10 May 2004 17:48:35 -0000	1.6
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (body).                                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,7 +22,6 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_TAGS_H
 #include "ttload.h"
-#include "ttcmap.h"
 
 #include "sferrors.h"
 
@@ -254,7 +253,7 @@
   /*    stream     :: The input stream.                                    */
   /*                                                                       */
   /*    face_index :: If the font is a collection, the number of the font  */
-  /*                  in the collection, ignored otherwise.                */
+  /*                  in the collection.  Must be zero otherwise.          */
   /*                                                                       */
   /* <Output>                                                              */
   /*    sfnt       :: The SFNT header.                                     */
@@ -277,7 +276,7 @@
                             SFNT_Header  sfnt )
   {
     FT_Error   error;
-    FT_ULong   format_tag, offset;
+    FT_ULong   font_format_tag, format_tag, offset;
     FT_Memory  memory = stream->memory;
 
     static const FT_Frame_Field  sfnt_header_fields[] =
@@ -314,16 +313,17 @@
 
     face->num_tables = 0;
 
-    /* first of all, read the first 4 bytes.  If it is `ttcf', then the */
-    /* file is a TrueType collection, otherwise it can be any other     */
-    /* kind of font.                                                    */
-    /*                                                                  */
+    /* First of all, read the first 4 bytes.  If it is `ttcf', then the   */
+    /* file is a TrueType collection, otherwise it is a single-face font. */
+    /*                                                                    */
     offset = FT_STREAM_POS();
 
-    if ( FT_READ_ULONG( format_tag ) )
+    if ( FT_READ_ULONG( font_format_tag ) )
       goto Exit;
 
-    if ( format_tag == TTAG_ttcf )
+    format_tag = font_format_tag;
+
+    if ( font_format_tag == TTAG_ttcf )
     {
       FT_Int  n;
 
@@ -355,8 +355,8 @@
       /* seek to the appropriate TrueType file, then read tag */
       offset = face->ttc_header.offsets[face_index];
 
-      if ( FT_STREAM_SEEK( offset ) ||
-           FT_READ_LONG( format_tag )                             )
+      if ( FT_STREAM_SEEK( offset )   ||
+           FT_READ_LONG( format_tag ) )
         goto Exit;
     }
 
@@ -373,8 +373,13 @@
     {
       FT_TRACE2(( "tt_face_load_sfnt_header: file is not SFNT!\n" ));
       error = SFNT_Err_Unknown_File_Format;
+      goto Exit;
     }
 
+    /* disallow face index values > 0 for non-TTC files */
+    if ( font_format_tag != TTAG_ttcf && face_index > 0 )
+      error = SFNT_Err_Bad_Argument;
+
   Exit:
     return error;
   }
@@ -741,12 +746,12 @@
       face->root.num_glyphs = maxProfile->numGlyphs;
 
       face->root.internal->max_points =
-        (FT_UShort)MAX( maxProfile->maxCompositePoints,
-                        maxProfile->maxPoints );
+        (FT_UShort)FT_MAX( maxProfile->maxCompositePoints,
+                           maxProfile->maxPoints );
 
       face->root.internal->max_contours =
-        (FT_Short)MAX( maxProfile->maxCompositeContours,
-                       maxProfile->maxContours );
+        (FT_Short)FT_MAX( maxProfile->maxCompositeContours,
+                          maxProfile->maxContours );
 
       face->max_components = (FT_ULong)maxProfile->maxComponentElements +
                              maxProfile->maxComponentDepth;
@@ -897,7 +902,8 @@
     /* do we have an inconsistent number of metric values? */
     {
       TT_ShortMetrics*  cur   = *shorts;
-      TT_ShortMetrics*  limit = cur + MIN( num_shorts, num_shorts_checked );
+      TT_ShortMetrics*  limit = cur +
+                                FT_MIN( num_shorts, num_shorts_checked );
 
 
       for ( ; cur < limit; cur++ )

reactos/lib/freetype/src/sfnt
ttpost.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttpost.c	15 Feb 2004 21:45:35 -0000	1.3
+++ ttpost.c	10 May 2004 17:48:35 -0000	1.4
@@ -5,7 +5,7 @@
 /*    Postcript name table processing for TrueType and OpenType fonts      */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -50,7 +50,7 @@
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 #define MAC_NAME( x )  ( (FT_String*)psnames->macintosh_name( x ) )
 
@@ -441,7 +441,7 @@
     FT_Fixed         format;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    PSNames_Service  psnames;
+    FT_Service_PsCMaps  psnames;
 #endif
 
 
@@ -452,7 +452,7 @@
       return SFNT_Err_Invalid_Glyph_Index;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    psnames = (PSNames_Service)face->psnames;
+    psnames = (FT_Service_PsCMaps)face->psnames;
     if ( !psnames )
       return SFNT_Err_Unimplemented_Feature;
 #endif
@@ -510,7 +510,7 @@
         *PSname = MAC_NAME( idx );
       }
     }
-    
+
     /* nothing to do for format == 0x00030000L */
 
   End:

reactos/lib/freetype/src/sfnt
ttsbit.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttsbit.c	15 Feb 2004 21:45:35 -0000	1.5
+++ ttsbit.c	10 May 2004 17:48:35 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -622,22 +622,22 @@
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_set_sbit_strike( TT_Face    face,
-                           FT_Int     x_ppem,
-                           FT_Int     y_ppem,
+                           FT_UInt    x_ppem,
+                           FT_UInt    y_ppem,
                            FT_ULong  *astrike_index )
   {
     FT_ULong  i;
 
 
-    if ( x_ppem < 0 || x_ppem > 255 ||
+    if ( x_ppem > 255 ||
          y_ppem < 1 || y_ppem > 255 )
       return SFNT_Err_Invalid_PPem;
 
     for ( i = 0; i < face->num_sbit_strikes; i++ )
     {
-      if ( ( face->sbit_strikes[i].y_ppem == y_ppem )     &&
-           ( ( x_ppem == 0 )                            ||
-             ( face->sbit_strikes[i].x_ppem == x_ppem ) ) )
+      if ( ( (FT_UInt)face->sbit_strikes[i].y_ppem == y_ppem )     &&
+           ( ( x_ppem == 0 )                                     ||
+             ( (FT_UInt)face->sbit_strikes[i].x_ppem == x_ppem ) ) )
       {
         *astrike_index = i;
         return SFNT_Err_Ok;
@@ -754,7 +754,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    find_sbit_image                                                    */
+  /*    tt_find_sbit_image                                                 */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Checks whether an embedded bitmap (an `sbit') exists for a given   */
@@ -779,13 +779,13 @@
   /*    SFNT_Err_Invalid_Argument if no sbit exists for the requested      */
   /*    glyph.                                                             */
   /*                                                                       */
-  static FT_Error
-  find_sbit_image( TT_Face          face,
-                   FT_UInt          glyph_index,
-                   FT_ULong         strike_index,
-                   TT_SBit_Range   *arange,
-                   TT_SBit_Strike  *astrike,
-                   FT_ULong        *aglyph_offset )
+  FT_LOCAL( FT_Error )
+  tt_find_sbit_image( TT_Face          face,
+                      FT_UInt          glyph_index,
+                      FT_ULong         strike_index,
+                      TT_SBit_Range   *arange,
+                      TT_SBit_Strike  *astrike,
+                      FT_ULong        *aglyph_offset )
   {
     FT_Error        error;
     TT_SBit_Strike  strike;
@@ -819,7 +819,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    load_sbit_metrics                                                  */
+  /*    tt_load_sbit_metrics                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Gets the big metrics for a given SBit.                             */
@@ -843,10 +843,10 @@
   /*    positioned just after the metrics header in the `EBDT' table on    */
   /*    function exit.                                                     */
   /*                                                                       */
-  static FT_Error
-  load_sbit_metrics( FT_Stream        stream,
-                     TT_SBit_Range    range,
-                     TT_SBit_Metrics  metrics )
+  FT_LOCAL( FT_Error )
+  tt_load_sbit_metrics( FT_Stream        stream,
+                        TT_SBit_Range    range,
+                        TT_SBit_Metrics  metrics )
   {
     FT_Error  error = SFNT_Err_Ok;
 
@@ -1228,7 +1228,7 @@
     if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) )
       goto Exit;
 
-    error = load_sbit_metrics( stream, range, metrics );
+    error = tt_load_sbit_metrics( stream, range, metrics );
     if ( error )
       goto Exit;
 
@@ -1419,8 +1419,8 @@
 
 
     /* Check whether there is a glyph sbit for the current index */
-    error = find_sbit_image( face, glyph_index, strike_index,
-                             &range, &strike, &glyph_offset );
+    error = tt_find_sbit_image( face, glyph_index, strike_index,
+                                &range, &strike, &glyph_offset );
     if ( error )
       goto Exit;
 

reactos/lib/freetype/src/sfnt
ttsbit.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttsbit.h	15 Feb 2004 21:45:35 -0000	1.3
+++ ttsbit.h	10 May 2004 17:48:35 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (specification).       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -37,11 +37,24 @@
 
   FT_LOCAL( FT_Error )
   tt_face_set_sbit_strike( TT_Face    face,
-                           FT_Int     x_ppem,
-                           FT_Int     y_ppem,
+                           FT_UInt    x_ppem,
+                           FT_UInt    y_ppem,
                            FT_ULong  *astrike_index );
 
   FT_LOCAL( FT_Error )
+  tt_find_sbit_image( TT_Face          face,
+                      FT_UInt          glyph_index,
+                      FT_ULong         strike_index,
+                      TT_SBit_Range   *arange,
+                      TT_SBit_Strike  *astrike,
+                      FT_ULong        *aglyph_offset );
+
+  FT_LOCAL( FT_Error )
+  tt_load_sbit_metrics( FT_Stream        stream,
+                        TT_SBit_Range    range,
+                        TT_SBit_Metrics  metrics );
+
+  FT_LOCAL( FT_Error )
   tt_face_load_sbit_image( TT_Face              face,
                            FT_ULong             strike_index,
                            FT_UInt              glyph_index,

reactos/lib/freetype/src/sfnt
ttcmap.c removed after 1.1
diff -N ttcmap.c
--- ttcmap.c	1 Apr 2003 08:38:22 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,1110 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ttcmap.c                                                               */
-/*                                                                         */
-/*    TrueType character mapping table (cmap) support (body).              */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include "ttload.h"
-#include "ttcmap.h"
-
-#include "sferrors.h"
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_ttcmap
-
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index0( TT_CMapTable  charmap,
-                  FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next0( TT_CMapTable  charmap,
-                 FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index2( TT_CMapTable  charmap,
-                  FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next2( TT_CMapTable  charmap,
-                 FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index4( TT_CMapTable  charmap,
-                  FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next4( TT_CMapTable  charmap,
-                 FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index6( TT_CMapTable  charmap,
-                  FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next6( TT_CMapTable  charmap,
-                 FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index8_12( TT_CMapTable  charmap,
-                     FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next8_12( TT_CMapTable  charmap,
-                    FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index10( TT_CMapTable  charmap,
-                   FT_ULong      char_code );
-
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next10( TT_CMapTable  charmap,
-                  FT_ULong      char_code );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_charmap                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads a given TrueType character map into memory.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the parent face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the current stream object.                   */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    table  :: A pointer to a cmap object.                              */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The function assumes that the stream is already in use (i.e.,      */
-  /*    opened).  In case of error, all partially allocated tables are     */
-  /*    released.                                                          */
-  /*                                                                       */
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_load_charmap( TT_Face       face,
-                        TT_CMapTable  cmap,
-                        FT_Stream     stream )
-  {
-    FT_Error     error;
-    FT_Memory    memory;
-    FT_UShort    num_SH, num_Seg, i;
-    FT_ULong     j, n;
-
-    FT_UShort    u, l;
-
-    TT_CMap0     cmap0;
-    TT_CMap2     cmap2;
-    TT_CMap4     cmap4;
-    TT_CMap6     cmap6;
-    TT_CMap8_12  cmap8_12;
-    TT_CMap10    cmap10;
-
-    TT_CMap2SubHeader  cmap2sub;
-    TT_CMap4Segment    segments;
-    TT_CMapGroup       groups;
-
-
-    if ( cmap->loaded )
-      return SFNT_Err_Ok;
-
-    memory = stream->memory;
-
-    if ( FT_STREAM_SEEK( cmap->offset ) )
-      return error;
-
-    switch ( cmap->format )
-    {
-    case 0:
-      cmap0 = &cmap->c.cmap0;
-
-      if ( FT_READ_USHORT( cmap0->language )           ||
-           FT_ALLOC( cmap0->glyphIdArray, 256L )       ||
-           FT_STREAM_READ( cmap0->glyphIdArray, 256L ) )
-        goto Fail;
-
-      cmap->get_index     = code_to_index0;
-      cmap->get_next_char = code_to_next0;
-      break;
-
-    case 2:
-      num_SH = 0;
-      cmap2  = &cmap->c.cmap2;
-
-      /* allocate subheader keys */
-
-      if ( FT_NEW_ARRAY( cmap2->subHeaderKeys, 256 ) ||
-           FT_FRAME_ENTER( 2L + 512L )               )
-        goto Fail;
-
-      cmap2->language = FT_GET_USHORT();
-
-      for ( i = 0; i < 256; i++ )
-      {
-        u = (FT_UShort)( FT_GET_USHORT() / 8 );
-        cmap2->subHeaderKeys[i] = u;
-
-        if ( num_SH < u )
-          num_SH = u;
-      }
-
-      FT_FRAME_EXIT();
-
-      /* load subheaders */
-
-      cmap2->numGlyphId = l = (FT_UShort)(
-        ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFFU ) / 2 );
-
-      if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 ) ||
-           FT_FRAME_ENTER( ( num_SH + 1 ) * 8L )         )
-      {
-        FT_FREE( cmap2->subHeaderKeys );
-        goto Fail;
-      }
-
-      cmap2sub = cmap2->subHeaders;
-
-      for ( i = 0; i <= num_SH; i++ )
-      {
-        cmap2sub->firstCode     = FT_GET_USHORT();
-        cmap2sub->entryCount    = FT_GET_USHORT();
-        cmap2sub->idDelta       = FT_GET_SHORT();
-        /* we apply the location offset immediately */
-        cmap2sub->idRangeOffset = (FT_UShort)(
-          FT_GET_USHORT() - ( num_SH - i ) * 8 - 2 );
-
-        cmap2sub++;
-      }
-
-      FT_FRAME_EXIT();
-
-      /* load glyph IDs */
-
-      if ( FT_NEW_ARRAY( cmap2->glyphIdArray, l ) ||
-           FT_FRAME_ENTER( l * 2L )               )
-      {
-        FT_FREE( cmap2->subHeaders );
-        FT_FREE( cmap2->subHeaderKeys );
-        goto Fail;
-      }
-
-      for ( i = 0; i < l; i++ )
-        cmap2->glyphIdArray[i] = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-
-      cmap->get_index = code_to_index2;
-      cmap->get_next_char = code_to_next2;
-      break;
-
-    case 4:
-      cmap4 = &cmap->c.cmap4;
-
-      /* load header */
-
-      if ( FT_FRAME_ENTER( 10L ) )
-        goto Fail;
-
-      cmap4->language      = FT_GET_USHORT();
-      cmap4->segCountX2    = FT_GET_USHORT();
-      cmap4->searchRange   = FT_GET_USHORT();
-      cmap4->entrySelector = FT_GET_USHORT();
-      cmap4->rangeShift    = FT_GET_USHORT();
-
-      num_Seg = (FT_UShort)( cmap4->segCountX2 / 2 );
-
-      FT_FRAME_EXIT();
-
-      /* load segments */
-
-      if ( FT_NEW_ARRAY( cmap4->segments, num_Seg )   ||
-           FT_FRAME_ENTER( ( num_Seg * 4 + 1 ) * 2L ) )
-        goto Fail;
-
-      segments = cmap4->segments;
-
-      for ( i = 0; i < num_Seg; i++ )
-        segments[i].endCount = FT_GET_USHORT();
-
-      (void)FT_GET_USHORT();
-
-      for ( i = 0; i < num_Seg; i++ )
-        segments[i].startCount = FT_GET_USHORT();
-
-      for ( i = 0; i < num_Seg; i++ )
-        segments[i].idDelta = FT_GET_SHORT();
-
-      for ( i = 0; i < num_Seg; i++ )
-        segments[i].idRangeOffset = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-
-      cmap4->numGlyphId = l = (FT_UShort)(
-        ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFFU ) / 2 );
-
-      /* load IDs */
-
-      if ( FT_NEW_ARRAY( cmap4->glyphIdArray, l ) ||
-           FT_FRAME_ENTER( l * 2L )               )
-      {
-        FT_FREE( cmap4->segments );
-        goto Fail;
-      }
-
-      for ( i = 0; i < l; i++ )
-        cmap4->glyphIdArray[i] = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-
-      cmap4->last_segment = cmap4->segments;
-
-      cmap->get_index     = code_to_index4;
-      cmap->get_next_char = code_to_next4;
-      break;
-
-    case 6:
-      cmap6 = &cmap->c.cmap6;
-
-      if ( FT_FRAME_ENTER( 6L ) )
-        goto Fail;
-
-      cmap6->language   = FT_GET_USHORT();
-      cmap6->firstCode  = FT_GET_USHORT();
-      cmap6->entryCount = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-
-      l = cmap6->entryCount;
-
-      if ( FT_NEW_ARRAY( cmap6->glyphIdArray, l ) ||
-           FT_FRAME_ENTER( l * 2L )               )
-        goto Fail;
-
-      for ( i = 0; i < l; i++ )
-        cmap6->glyphIdArray[i] = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-      cmap->get_index     = code_to_index6;
-      cmap->get_next_char = code_to_next6;
-      break;
-
-    case 8:
-    case 12:
-      cmap8_12 = &cmap->c.cmap8_12;
-
-      if ( FT_FRAME_ENTER( 8L ) )
-        goto Fail;
-
-      cmap->length       = FT_GET_ULONG();
-      cmap8_12->language = FT_GET_ULONG();
-
-      FT_FRAME_EXIT();
-
-      if ( cmap->format == 8 )
-        if ( FT_STREAM_SKIP( 8192L ) )
-          goto Fail;
-
-      if ( FT_READ_ULONG( cmap8_12->nGroups ) )
-        goto Fail;
-
-      n = cmap8_12->nGroups;
-
-      if ( FT_NEW_ARRAY( cmap8_12->groups, n ) ||
-           FT_FRAME_ENTER( n * 3 * 4L )        )
-        goto Fail;
-
-      groups = cmap8_12->groups;
-
-      for ( j = 0; j < n; j++ )
-      {
-        groups[j].startCharCode = FT_GET_ULONG();
-        groups[j].endCharCode   = FT_GET_ULONG();
-        groups[j].startGlyphID  = FT_GET_ULONG();
-      }
-
-      FT_FRAME_EXIT();
-
-      cmap8_12->last_group = cmap8_12->groups;
-
-      cmap->get_index     = code_to_index8_12;
-      cmap->get_next_char = code_to_next8_12;
-      break;
-
-    case 10:
-      cmap10 = &cmap->c.cmap10;
-
-      if ( FT_FRAME_ENTER( 16L ) )
-        goto Fail;
-
-      cmap->length          = FT_GET_ULONG();
-      cmap10->language      = FT_GET_ULONG();
-      cmap10->startCharCode = FT_GET_ULONG();
-      cmap10->numChars      = FT_GET_ULONG();
-
-      FT_FRAME_EXIT();
-
-      n = cmap10->numChars;
-
-      if ( FT_NEW_ARRAY( cmap10->glyphs, n ) ||
-           FT_FRAME_ENTER( n * 2L )          )
-        goto Fail;
-
-      for ( j = 0; j < n; j++ )
-        cmap10->glyphs[j] = FT_GET_USHORT();
-
-      FT_FRAME_EXIT();
-      cmap->get_index     = code_to_index10;
-      cmap->get_next_char = code_to_next10;
-      break;
-
-    default:   /* corrupt character mapping table */
-      return SFNT_Err_Invalid_CharMap_Format;
-
-    }
-
-    return SFNT_Err_Ok;
-
-  Fail:
-    tt_face_free_charmap( face, cmap );
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_free_charmap                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Destroys a character mapping table.                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A handle to the parent face object.                        */
-  /*                                                                       */
-  /*    cmap :: A handle to a cmap object.                                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_LOCAL_DEF( FT_Error )
-  tt_face_free_charmap( TT_Face       face,
-                        TT_CMapTable  cmap )
-  {
-    FT_Memory  memory;
-
-
-    if ( !cmap )
-      return SFNT_Err_Ok;
-
-    memory = face->root.driver->root.memory;
-
-    switch ( cmap->format )
-    {
-    case 0:
-      FT_FREE( cmap->c.cmap0.glyphIdArray );
-      break;
-
-    case 2:
-      FT_FREE( cmap->c.cmap2.subHeaderKeys );
-      FT_FREE( cmap->c.cmap2.subHeaders );
-      FT_FREE( cmap->c.cmap2.glyphIdArray );
-      break;
-
-    case 4:
-      FT_FREE( cmap->c.cmap4.segments );
-      FT_FREE( cmap->c.cmap4.glyphIdArray );
-      cmap->c.cmap4.segCountX2 = 0;
-      break;
-
-    case 6:
-      FT_FREE( cmap->c.cmap6.glyphIdArray );
-      cmap->c.cmap6.entryCount = 0;
-      break;
-
-    case 8:
-    case 12:
-      FT_FREE( cmap->c.cmap8_12.groups );
-      cmap->c.cmap8_12.nGroups = 0;
-      break;
-
-    case 10:
-      FT_FREE( cmap->c.cmap10.glyphs );
-      cmap->c.cmap10.numChars = 0;
-      break;
-
-    default:
-      /* invalid table format, do nothing */
-      ;
-    }
-
-    cmap->loaded = FALSE;
-    return SFNT_Err_Ok;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_index0                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Converts the character code into a glyph index.  Uses format 0.    */
-  /*    `charCode' must be in the range 0x00-0xFF (otherwise 0 is          */
-  /*    returned).                                                         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap0    :: A pointer to a cmap table in format 0.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index0( TT_CMapTable  cmap,
-                  FT_ULong      charCode )
-  {
-    TT_CMap0  cmap0 = &cmap->c.cmap0;
-
-
-    return ( charCode <= 0xFF ? cmap0->glyphIdArray[charCode] : 0 );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_next0                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Finds the next encoded character after the given one.  Uses        */
-  /*    format 0. `charCode' must be in the range 0x00-0xFF (otherwise 0   */
-  /*    is returned).                                                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap0    :: A pointer to a cmap table in format 0.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Next char code.  0 if no higher one is encoded.                    */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next0( TT_CMapTable  cmap,
-                 FT_ULong      charCode )
-  {
-    TT_CMap0  cmap0 = &cmap->c.cmap0;
-
-
-    while ( ++charCode <= 0xFF )
-      if ( cmap0->glyphIdArray[charCode] )
-        return ( charCode );
-    return ( 0 );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_index2                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Converts the character code into a glyph index.  Uses format 2.    */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap2    :: A pointer to a cmap table in format 2.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index2( TT_CMapTable  cmap,
-                  FT_ULong      charCode )
-  {
-    FT_UInt            result, index1, offset;
-    FT_UInt            char_lo;
-    FT_ULong           char_hi;
-    TT_CMap2SubHeader  sh2;
-    TT_CMap2           cmap2;
-
-
-    cmap2   = &cmap->c.cmap2;
-    result  = 0;
-    char_lo = (FT_UInt)( charCode & 0xFF );
-    char_hi = charCode >> 8;
-
-    if ( char_hi == 0 )
-    {
-      /* an 8-bit character code -- we use the subHeader 0 in this case */
-      /* to test whether the character code is in the charmap           */
-      index1 = cmap2->subHeaderKeys[char_lo];
-      if ( index1 != 0 )
-        return 0;
-    }
-    else
-    {
-      /* a 16-bit character code */
-      index1 = cmap2->subHeaderKeys[char_hi & 0xFF];
-      if ( index1 == 0 )
-        return 0;
-    }
-
-    sh2      = cmap2->subHeaders + index1;
-    char_lo -= sh2->firstCode;
-
-    if ( char_lo < (FT_UInt)sh2->entryCount )
-    {
-      offset = sh2->idRangeOffset / 2 + char_lo;
-      if ( offset < (FT_UInt)cmap2->numGlyphId )
-      {
-        result = cmap2->glyphIdArray[offset];
-        if ( result )
-          result = ( result + sh2->idDelta ) & 0xFFFFU;
-      }
-    }
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_next2                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Find the next encoded character.  Uses format 2.                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap2    :: A pointer to a cmap table in format 2.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Next encoded character.  0 if none exists.                         */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next2( TT_CMapTable  cmap,
-                 FT_ULong      charCode )
-  {
-    FT_UInt            index1, offset;
-    FT_UInt            char_lo;
-    FT_ULong           char_hi;
-    TT_CMap2SubHeader  sh2;
-    TT_CMap2           cmap2;
-
-
-    cmap2 = &cmap->c.cmap2;
-    charCode++;
-
-    /*
-     * This is relatively simplistic -- look for a subHeader containing
-     * glyphs and then walk to the first glyph in that subHeader.
-     */
-    while ( charCode < 0x10000L )
-    {
-      char_lo = (FT_UInt)( charCode & 0xFF );
-      char_hi = charCode >> 8;
-
-      if ( char_hi == 0 )
-      {
-        /* an 8-bit character code -- we use the subHeader 0 in this case */
-        /* to test whether the character code is in the charmap           */
-        index1 = cmap2->subHeaderKeys[char_lo];
-        if ( index1 != 0 )
-        {
-          charCode++;
-          continue;
-        }
-      }
-      else
-      {
-        /* a 16-bit character code */
-        index1 = cmap2->subHeaderKeys[char_hi & 0xFF];
-        if ( index1 == 0 )
-        {
-          charCode = ( char_hi + 1 ) << 8;
-          continue;
-        }
-      }
-
-      sh2      = cmap2->subHeaders + index1;
-      char_lo -= sh2->firstCode;
-
-      if ( char_lo > (FT_UInt)sh2->entryCount )
-      {
-        charCode = ( char_hi + 1 ) << 8;
-        continue;
-      }
-
-      offset = sh2->idRangeOffset / 2 + char_lo;
-      if ( offset >= (FT_UInt)cmap2->numGlyphId ||
-           cmap2->glyphIdArray[offset] == 0     )
-      {
-        charCode++;
-        continue;
-      }
-
-      return charCode;
-    }
-    return 0;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_index4                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Converts the character code into a glyph index.  Uses format 4.    */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap4    :: A pointer to a cmap table in format 4.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index4( TT_CMapTable  cmap,
-                  FT_ULong      charCode )
-  {
-    FT_UInt             result, index1, segCount;
-    TT_CMap4            cmap4;
-    TT_CMap4SegmentRec  *seg4, *limit;
-
-
-    cmap4    = &cmap->c.cmap4;
-    result   = 0;
-    segCount = cmap4->segCountX2 / 2;
-    limit    = cmap4->segments + segCount;
-
-    /* first, check against the last used segment */
-
-    seg4 = cmap4->last_segment;
-
-    /* the following is equivalent to performing two tests, as in         */
-    /*                                                                    */
-    /*  if ( charCode >= seg4->startCount && charCode <= seg4->endCount ) */
-    /*                                                                    */
-    /* This is a bit strange, but it is faster, and the idea behind the   */
-    /* cache is to significantly speed up charcode to glyph index         */
-    /* conversion.                                                        */
-
-    if ( (FT_ULong)( charCode       - seg4->startCount ) <
-         (FT_ULong)( seg4->endCount - seg4->startCount ) )
-      goto Found1;
-
-    for ( seg4 = cmap4->segments; seg4 < limit; seg4++ )
-    {
-      /* the ranges are sorted in increasing order.  If we are out of */
-      /* the range here, the char code isn't in the charmap, so exit. */
-
-      if ( charCode > (FT_UInt)seg4->endCount )
-        continue;
-
-      if ( charCode >= (FT_UInt)seg4->startCount )
-        goto Found;
-    }
-    return 0;
-
-  Found:
-    cmap4->last_segment = seg4;
-
-  Found1:
-    /* if the idRangeOffset is 0, we can compute the glyph index */
-    /* directly                                                  */
-
-    if ( seg4->idRangeOffset == 0 )
-      result = (FT_UInt)( charCode + seg4->idDelta ) & 0xFFFFU;
-    else
-    {
-      /* otherwise, we must use the glyphIdArray to do it */
-      index1 = (FT_UInt)( seg4->idRangeOffset / 2
-                          + ( charCode - seg4->startCount )
-                          + ( seg4 - cmap4->segments )
-                          - segCount );
-
-      if ( index1 < (FT_UInt)cmap4->numGlyphId &&
-           cmap4->glyphIdArray[index1] != 0    )
-        result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFFU;
-    }
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_next4                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Find the next encoded character.  Uses format 4.                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap     :: A pointer to a cmap table in format 4.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Next encoded character.  0 if none exists.                         */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next4( TT_CMapTable  cmap,
-                 FT_ULong      charCode )
-  {
-    FT_UInt             index1, segCount;
-    TT_CMap4            cmap4;
-    TT_CMap4SegmentRec  *seg4, *limit;
-
-
-    cmap4    = &cmap->c.cmap4;
-    segCount = cmap4->segCountX2 / 2;
-    limit    = cmap4->segments + segCount;
-
-    charCode++;
-
-    for ( seg4 = cmap4->segments; seg4 < limit; seg4++ )
-    {
-      /* The ranges are sorted in increasing order.  If we are out of */
-      /* the range here, the char code isn't in the charmap, so exit. */
-
-      if ( charCode <= (FT_UInt)seg4->endCount )
-        goto Found;
-    }
-    return 0;
-
-  Found:
-    if ( charCode < (FT_ULong) seg4->startCount )
-      charCode = seg4->startCount;
-
-    /* if the idRangeOffset is 0, all chars in the map exist */
-
-    if ( seg4->idRangeOffset == 0 )
-      return ( charCode );
-
-    while ( charCode <= (FT_UInt) seg4->endCount )
-    {
-      /* otherwise, we must use the glyphIdArray to do it */
-      index1 = (FT_UInt)( seg4->idRangeOffset / 2
-                          + ( charCode - seg4->startCount )
-                          + ( seg4 - cmap4->segments )
-                          - segCount );
-
-      if ( index1 < (FT_UInt)cmap4->numGlyphId &&
-           cmap4->glyphIdArray[index1] != 0    )
-        return ( charCode );
-      charCode++;
-    }
-
-    return 0;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_index6                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Converts the character code into a glyph index.  Uses format 6.    */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap6    :: A pointer to a cmap table in format 6.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index6( TT_CMapTable  cmap,
-                  FT_ULong      charCode )
-  {
-    TT_CMap6  cmap6;
-    FT_UInt   result = 0;
-
-
-    cmap6     = &cmap->c.cmap6;
-    charCode -= cmap6->firstCode;
-
-    if ( charCode < (FT_UInt)cmap6->entryCount )
-      result = cmap6->glyphIdArray[charCode];
-
-    return result;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_next6                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Find the next encoded character.  Uses format 6.                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap     :: A pointer to a cmap table in format 6.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Next encoded character.  0 if none exists.                         */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next6( TT_CMapTable  cmap,
-                 FT_ULong      charCode )
-  {
-    TT_CMap6  cmap6;
-
-
-    charCode++;
-
-    cmap6 = &cmap->c.cmap6;
-
-    if ( charCode < (FT_ULong) cmap6->firstCode )
-      charCode = cmap6->firstCode;
-
-    charCode -= cmap6->firstCode;
-
-    while ( charCode < (FT_UInt)cmap6->entryCount )
-    {
-      if ( cmap6->glyphIdArray[charCode] != 0 )
-        return charCode + cmap6->firstCode;
-      charCode++;
-    }
-
-    return 0;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_index8_12                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Converts the (possibly 32bit) character code into a glyph index.   */
-  /*    Uses format 8 or 12.                                               */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap8_12 :: A pointer to a cmap table in format 8 or 12.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_UInt )
-  code_to_index8_12( TT_CMapTable  cmap,
-                     FT_ULong      charCode )
-  {
-    TT_CMap8_12      cmap8_12;
-    TT_CMapGroupRec  *group, *limit;
-
-
-    cmap8_12 = &cmap->c.cmap8_12;
-    limit    = cmap8_12->groups + cmap8_12->nGroups;
-
-    /* first, check against the last used group */
-
-    group = cmap8_12->last_group;
-
-    /* the following is equivalent to performing two tests, as in       */
-    /*                                                                  */
-    /*  if ( charCode >= group->startCharCode &&                        */
-    /*       charCode <= group->endCharCode   )                         */
-    /*                                                                  */
-    /* This is a bit strange, but it is faster, and the idea behind the */
-    /* cache is to significantly speed up charcode to glyph index       */
-    /* conversion.                                                      */
-
-    if ( (FT_ULong)( charCode           - group->startCharCode ) <
-         (FT_ULong)( group->endCharCode - group->startCharCode ) )
-      goto Found1;
-
-    for ( group = cmap8_12->groups; group < limit; group++ )
-    {
-      /* the ranges are sorted in increasing order.  If we are out of */
-      /* the range here, the char code isn't in the charmap, so exit. */
-
-      if ( charCode > group->endCharCode )
-        continue;
-
-      if ( charCode >= group->startCharCode )
-        goto Found;
-    }
-    return 0;
-
-  Found:
-    cmap8_12->last_group = group;
-
-  Found1:
-    return (FT_UInt)( group->startGlyphID +
-                      ( charCode - group->startCharCode ) );
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    code_to_next8_12                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Find the next encoded character.  Uses format 8 or 12.             */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    charCode :: The wanted character code.                             */
-  /*                                                                       */
-  /*    cmap     :: A pointer to a cmap table in format 8 or 12.           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Next encoded character.  0 if none exists.                         */
-  /*                                                                       */
-  FT_CALLBACK_DEF( FT_ULong )
-  code_to_next8_12( TT_CMapTable  cmap,
[truncated at 1000 lines; 114 more skipped]

reactos/lib/freetype/src/sfnt
ttcmap.h removed after 1.1
diff -N ttcmap.h
--- ttcmap.h	1 Apr 2003 08:38:22 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ttcmap.h                                                               */
-/*                                                                         */
-/*    TrueType character mapping table (cmap) support (specification).     */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef __TTCMAP_H__
-#define __TTCMAP_H__
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
-  FT_LOCAL( FT_Error )
-  tt_face_load_charmap( TT_Face       face,
-                        TT_CMapTable  cmap,
-                        FT_Stream     input );
-
-  FT_LOCAL( FT_Error )
-  tt_face_free_charmap( TT_Face       face,
-                        TT_CMapTable  cmap );
-
-
-FT_END_HEADER
-
-#endif /* __TTCMAP_H__ */
-
-
-/* END */

reactos/lib/freetype/src/smooth
ftsmooth.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftsmooth.c	15 Feb 2004 21:45:36 -0000	1.4
+++ ftsmooth.c	10 May 2004 17:48:35 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Anti-aliasing renderer interface (body).                             */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003 by                                     */
+/*  Copyright 2000-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -132,10 +132,10 @@
     /* compute the control box, and grid fit it */
     FT_Outline_Get_CBox( outline, &cbox );
 
-    cbox.xMin &= -64;
-    cbox.yMin &= -64;
-    cbox.xMax  = ( cbox.xMax + 63 ) & -64;
-    cbox.yMax  = ( cbox.yMax + 63 ) & -64;
+    cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+    cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+    cbox.xMax = FT_PIX_CEIL( cbox.xMax );
+    cbox.yMax = FT_PIX_CEIL( cbox.yMax );
 
     width  = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
     height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
@@ -154,7 +154,7 @@
     if ( hmul )
     {
       width = width * hmul;
-      pitch = ( width + 3 ) & -4;
+      pitch = FT_PAD_CEIL( width, 4 );
     }
 
     if ( vmul )
@@ -236,6 +236,9 @@
                     FT_Render_Mode  mode,
                     FT_Vector*      origin )
   {
+    if ( mode == FT_RENDER_MODE_LIGHT )
+      mode = FT_RENDER_MODE_NORMAL;
+
     return ft_smooth_render_generic( render, slot, mode, origin,
                                      FT_RENDER_MODE_NORMAL,
                                      0, 0 );

reactos/lib/freetype/src/tools/docmaker
docbeauty.py 1.2 -> 1.3
diff -N docbeauty.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ docbeauty.py	10 May 2004 17:48:35 -0000	1.3
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+#  DocBeauty (c) 2003, 2004 David Turner <david@freetype.org>
+#
+# This program is used to beautify the documentation comments used
+# in the FreeType 2 public headers.
+#
+
+from sources   import *
+from content   import *
+from utils     import *
+
+import utils
+
+import sys, os, time, string, getopt
+
+content_processor = ContentProcessor()
+
+
+def beautify_block( block ):
+    if block.content:
+        content_processor.reset()
+
+        markups = content_processor.process_content( block.content )
+        text    = []
+        first   = 1
+
+        for markup in markups:
+            text.extend( markup.beautify( first ) )
+            first = 0
+        
+        # now beautify the documentation "borders" themselves
+        lines = [ " /*************************************************************************" ]
+        for l in text:
+            lines.append( "  *" + l )
+        lines.append( "  */" )
+        
+        block.lines = lines
+        
+
+def usage():
+    print "\nDocBeauty 0.1 Usage information\n"
+    print "  docbeauty [options] file1 [ file2 ... ]\n"
+    print "using the following options:\n"
+    print "  -h : print this page"
+    print "  -b : backup original files with the 'orig' extension"
+    print ""
+    print "  --backup : same as -b"
+    
+
+def main( argv ):
+    """main program loop"""
+
+    global output_dir
+
+    try:
+        opts, args = getopt.getopt( sys.argv[1:],
+                                    "hb",
+                                    [ "help", "backup" ] )
+
+    except getopt.GetoptError:
+        usage()
+        sys.exit( 2 )
+
+    if args == []:
+        usage()
+        sys.exit( 1 )
+
+    # process options
+    #
+    output_dir = None
+    do_backup  = None
+
+    for opt in opts:
+        if opt[0] in ( "-h", "--help" ):
+            usage()
+            sys.exit( 0 )
+
+        if opt[0] in ( "-b", "--backup" ):
+            do_backup = 1
+
+    # create context and processor
+    source_processor  = SourceProcessor()
+
+    # retrieve the list of files to process
+    file_list = make_file_list( args )
+    for filename in file_list:
+        source_processor.parse_file( filename )
+        for block in source_processor.blocks:
+            beautify_block( block )
+        new_name = filename + ".new"
+        ok       = None
+        try:
+            file = open( new_name, "wt" )
+            for block in source_processor.blocks:
+                for line in block.lines:
+                    file.write( line )
+                    file.write( "\n" )
+            file.close()
+        except:
+            ok = 0
+
+# if called from the command line
+#
+if __name__ == '__main__':
+    main( sys.argv )
+
+
+# eof

reactos/lib/freetype/src/tools/docmaker
content.py 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- content.py	15 Feb 2004 21:45:36 -0000	1.3
+++ content.py	10 May 2004 17:48:35 -0000	1.4
@@ -56,8 +56,16 @@
             self.lines.append( l )
 
     def dump( self, prefix = "", width=60 ):
-        for l in self.lines:
+        lines = self.dump_lines( 0, width )
+        for l in lines:
             print prefix + l
+    
+    def dump_lines( self, margin=0, width=60 ):
+        result = []
+        for l in self.lines:
+            result.append( " "*margin + l )
+        return result
+    
 
 
 #############################################################################
@@ -76,8 +84,14 @@
             self.words.extend( string.split( l ) )
 
     def dump( self, prefix = "", width = 60 ):
-        cur  = ""  # current line
-        col  = 0   # current width
+        lines = self.dump_lines( 0, width )
+        for l in lines:
+            print prefix + l
+    
+    def dump_lines( self, margin=0, width = 60 ):
+        cur    = ""  # current line
+        col    = 0   # current width
+        result = []
 
         for word in self.words:
             ln = len(word)
@@ -85,7 +99,7 @@
                 ln = ln+1
 
             if col + ln > width:
-                print prefix + cur
+                result.append( " "*margin + cur )
                 cur = word
                 col = len(word)
             else:
@@ -95,8 +109,11 @@
                 col = col + ln
 
         if col > 0:
-            print prefix + cur
+            result.append( " "*margin + cur )
+            
+        return result
 
+    
 
 
 #############################################################################
@@ -187,6 +204,17 @@
             p.dump( prefix )
             first = 0
 
+    def dump_lines( self, margin=0, width=60 ):
+        result = []
+        nl     = None
+        for p in self.items:
+            if nl:
+                result.append( "" )
+                
+            result.extend( p.dump_lines( margin, width ) )
+            nl = 1
+            
+        return result
 
 # this regular expression is used to detect field definitions
 #
@@ -233,6 +261,16 @@
 
         except:
             return None
+        
+    def get_start( self ):
+        try:
+            result = ""
+            for word in self.fields[0].items[0].words:
+                result = result + " " + word
+            return result[1:]
+        
+        except:
+            return "ERROR"
 
     def dump( self, margin ):
         print " "*margin + "<" + self.tag + ">"
@@ -544,4 +582,4 @@
             m = self.get_markup( tag_name )
             return m.fields[0].items
         except:
-            return None
\ No newline at end of file
+            return None

reactos/lib/freetype/src/tools/docmaker
docmaker.py 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- docmaker.py	15 Feb 2004 21:45:36 -0000	1.3
+++ docmaker.py	10 May 2004 17:48:35 -0000	1.4
@@ -1,16 +1,16 @@
 #!/usr/bin/env python
 #
-#  DocMaker 0.2 (c) 2002 David Turner <david@freetype.org>
+#  DocMaker (c) 2002, 2004 David Turner <david@freetype.org>
 #
 # This program is a re-write of the original DocMaker took used
 # to generate the API Reference of the FreeType font engine
-# by converting in-source comments into structured HTML
+# by converting in-source comments into structured HTML.
 #
 # This new version is capable of outputting XML data, as well
-# as accepts more liberal formatting options
+# as accepts more liberal formatting options.
 #
 # It also uses regular expression matching and substitution
-# to speed things significantly
+# to speed things significantly.
 #
 
 from sources   import *
@@ -24,50 +24,8 @@
 import sys, os, time, string, glob, getopt
 
 
-def file_exists( pathname ):
-    """checks that a given file exists"""
-    result = 1
-    try:
-        file = open( pathname, "r" )
-        file.close()
-    except:
-        result = None
-        sys.stderr.write( pathname + " couldn't be accessed\n" )
-
-    return result
-
-
-def make_file_list( args = None ):
-    """builds a list of input files from command-line arguments"""
-
-    file_list = []
-    # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' )
-
-    if not args:
-        args = sys.argv[1 :]
-
-    for pathname in args:
-        if string.find( pathname, '*' ) >= 0:
-            newpath = glob.glob( pathname )
-            newpath.sort()  # sort files -- this is important because
-                            # of the order of files
-        else:
-            newpath = [pathname]
-            
-        file_list.extend( newpath )
-
-    if len( file_list ) == 0:
-        file_list = None
-    else:
-        # now filter the file list to remove non-existing ones
-        file_list = filter( file_exists, file_list )
-    
-    return file_list
-
-
-
 def usage():
-    print "\nDocMaker 0.2 Usage information\n"
+    print "\nDocMaker Usage information\n"
     print "  docmaker [options] file1 [ file2 ... ]\n"
     print "using the following options:\n"
     print "  -h : print this page"

reactos/lib/freetype/src/tools/docmaker
formatter.py 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- formatter.py	15 Feb 2004 21:45:36 -0000	1.3
+++ formatter.py	10 May 2004 17:48:35 -0000	1.4
@@ -2,6 +2,15 @@
 from content import *
 from utils   import *
 
+# This is the base Formatter class. its purpose is to convert
+# a content processor's data into specific documents (i.e. table of
+# contents, global index, and individual API reference indices).
+#
+# You'll need to sub-class it to output anything sensible.  For example,
+# the file tohtml.py contains the definition of the HtmlFormatter sub-class
+# used to output, you guessed it, HTML.
+#
+
 class Formatter:
 
     def __init__( self, processor ):

reactos/lib/freetype/src/tools/docmaker
sources.py 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- sources.py	15 Feb 2004 21:45:36 -0000	1.4
+++ sources.py	10 May 2004 17:48:35 -0000	1.5
@@ -200,7 +200,7 @@
         self.processor = processor
         self.filename  = filename
         self.lineno    = lineno
-        self.lines     = lines
+        self.lines     = lines[:]
         self.format    = processor.format
         self.content   = []
 
@@ -212,7 +212,7 @@
         # extract comment lines
         lines = []
 
-        for line0 in self.lines[1:]:
+        for line0 in self.lines:
             m = self.format.column.match( line0 )
             if m:
                 lines.append( m.group(1) )
@@ -304,7 +304,7 @@
                 if self.format.end.match( line ):
                     # that's a normal block end, add it to lines and
                     # create a new block
-                    self.lines.append( line )
+                    self.lines.append( line )
                     self.add_block_lines()
 
                 elif self.format.column.match( line ):

reactos/lib/freetype/src/tools/docmaker
utils.py 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- utils.py	15 Feb 2004 21:45:36 -0000	1.3
+++ utils.py	10 May 2004 17:48:35 -0000	1.4
@@ -1,4 +1,4 @@
-import string, sys, os
+import string, sys, os, glob
 
 # current output directory
 #
@@ -85,3 +85,44 @@
                 sys.exit( 2 )
         else:
             output_dir = None
+
+def file_exists( pathname ):
+    """checks that a given file exists"""
+    result = 1
+    try:
+        file = open( pathname, "r" )
+        file.close()
+    except:
+        result = None
+        sys.stderr.write( pathname + " couldn't be accessed\n" )
+
+    return result
+
+
+def make_file_list( args = None ):
+    """builds a list of input files from command-line arguments"""
+
+    file_list = []
+    # sys.stderr.write( repr( sys.argv[1 :] ) + '\n' )
+
+    if not args:
+        args = sys.argv[1 :]
+
+    for pathname in args:
+        if string.find( pathname, '*' ) >= 0:
+            newpath = glob.glob( pathname )
+            newpath.sort()  # sort files -- this is important because
+                            # of the order of files
+        else:
+            newpath = [pathname]
+            
+        file_list.extend( newpath )
+
+    if len( file_list ) == 0:
+        file_list = None
+    else:
+        # now filter the file list to remove non-existing ones
+        file_list = filter( file_exists, file_list )
+    
+    return file_list
+

reactos/lib/freetype/src/truetype
ttdriver.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttdriver.c	15 Feb 2004 21:45:36 -0000	1.5
+++ ttdriver.c	10 May 2004 17:48:35 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,6 +21,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_TRUETYPE_IDS_H
+#include FT_SERVICE_XFREE86_NAME_H
 
 #include "ttdriver.h"
 #include "ttgload.h"
@@ -207,8 +208,8 @@
      /* we need to use rounding in the following computations. Otherwise,
       * the resulting hinted outlines will be very slightly distorted
       */
-      dim_x = ( ( char_width  * horz_resolution + (36+32*72) ) / 72 ) & -64;
-      dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
+      dim_x = ( ( char_width  * horz_resolution + (36+32*72) ) / 72 ) & ~63;
+      dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & ~63;
     }
     else
     {
@@ -292,7 +293,7 @@
   static FT_Error
   Load_Glyph( TT_GlyphSlot  slot,
               TT_Size       size,
-              FT_UShort     glyph_index,
+              FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
     FT_Error  error;
@@ -344,17 +345,27 @@
   /*************************************************************************/
   /*************************************************************************/
 
+  static const FT_ServiceDescRec  tt_services[] =
+  {
+    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE },
+    { NULL, NULL }
+  };
 
   static FT_Module_Interface
   tt_get_interface( TT_Driver    driver,
                     const char*  tt_interface )
   {
-    FT_Module     sfntd = FT_Get_Module( driver->root.root.library,
-                                         "sfnt" );
-    SFNT_Service  sfnt;
+    FT_Module_Interface  result;
+    FT_Module            sfntd;
+    SFNT_Service         sfnt;
+
 
+    result = ft_service_list_lookup( tt_services, tt_interface );
+    if ( result != NULL )
+      return result;
 
     /* only return the default interface from the SFNT module */
+    sfntd = FT_Get_Module( driver->root.root.library, "sfnt" );
     if ( sfntd )
     {
       sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
@@ -398,20 +409,20 @@
     sizeof ( FT_GlyphSlotRec ),
 
 
-    (FT_Face_InitFunc)        tt_face_init,
-    (FT_Face_DoneFunc)        tt_face_done,
-    (FT_Size_InitFunc)        tt_size_init,
-    (FT_Size_DoneFunc)        tt_size_done,
-    (FT_Slot_InitFunc)        0,
-    (FT_Slot_DoneFunc)        0,
-
-    (FT_Size_ResetPointsFunc) Set_Char_Sizes,
-    (FT_Size_ResetPixelsFunc) Set_Pixel_Sizes,
-    (FT_Slot_LoadFunc)        Load_Glyph,
-
-    (FT_Face_GetKerningFunc)  Get_Kerning,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
+    (FT_Face_InitFunc)       tt_face_init,
+    (FT_Face_DoneFunc)       tt_face_done,
+    (FT_Size_InitFunc)       tt_size_init,
+    (FT_Size_DoneFunc)       tt_size_done,
+    (FT_Slot_InitFunc)       0,
+    (FT_Slot_DoneFunc)       0,
+
+    (FT_Size_ResetPointsFunc)Set_Char_Sizes,
+    (FT_Size_ResetPixelsFunc)Set_Pixel_Sizes,
+    (FT_Slot_LoadFunc)       Load_Glyph,
+
+    (FT_Face_GetKerningFunc) Get_Kerning,
+    (FT_Face_AttachFunc)     0,
+    (FT_Face_GetAdvancesFunc)0
   };
 
 

reactos/lib/freetype/src/truetype
ttgload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttgload.c	15 Feb 2004 21:45:36 -0000	1.5
+++ ttgload.c	10 May 2004 17:48:35 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -162,11 +162,62 @@
   }
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* Returns the vertical metrics in font units for a given glyph.         */
+  /* Greg Hitchcock from Microsoft told us that if there were no `vmtx'    */
+  /* table, typoAscender/Descender from the `OS/2' table would be used     */
+  /* instead, and if there were no `OS/2' table, use ascender/descender    */
+  /* from the `hhea' table.  But that is not what Microsoft's rasterizer   */
+  /* apparently does: It uses the ppem value as the advance height, and    */
+  /* sets the top side bearing to be zero.                                 */
+  /*                                                                       */
+  /* The monospace `check' is probably not meaningful here, but we leave   */
+  /* it in for a consistent interface.                                     */
+  /*                                                                       */
+  static void
+  Get_VMetrics( TT_Face     face,
+                FT_UInt     idx,
+                FT_Bool     check,
+                FT_Short*   tsb,
+                FT_UShort*  ah )
+  {
+    FT_UNUSED( check );
+
+    if ( face->vertical_info )
+      TT_Get_Metrics( (TT_HoriHeader *)&face->vertical, idx, tsb, ah );
+
+#if 1             /* Emperically determined, at variance with what MS said */
+
+    else
+    {
+      *tsb = 0;
+      *ah  = face->root.units_per_EM;
+    }
+
+#else      /* This is what MS said to do.  It isn't what they do, however. */
+
+    else if ( face->os2.version != 0xFFFFU )
+    {
+      *tsb = face->os2.sTypoAscender;
+      *ah  = face->os2.sTypoAscender - face->os2.sTypoDescender;
+    }
+    else 
+    {
+      *tsb = face->horizontal.Ascender;
+      *ah  = face->horizontal.Ascender - face->horizontal.Descender;
+    }
+
+#endif
+
+  }
+
+
 #define cur_to_org( n, zone ) \
-          FT_MEM_COPY( (zone)->org, (zone)->cur, (n) * sizeof ( FT_Vector ) )
+          FT_ARRAY_COPY( (zone)->org, (zone)->cur, (n) )
 
 #define org_to_cur( n, zone ) \
-          FT_MEM_COPY( (zone)->cur, (zone)->org, (n) * sizeof ( FT_Vector ) )
+          FT_ARRAY_COPY( (zone)->cur, (zone)->org, (n) )
 
 
   /*************************************************************************/
@@ -317,7 +368,7 @@
     if ( n_contours > 0 )
       n_points = cont[-1] + 1;
 
-    error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
+    error = FT_GlyphLoader_CheckPoints( gloader, n_points + 4, 0 );
     if ( error )
       goto Fail;
 
@@ -635,12 +686,16 @@
 
     /* add shadow points */
 
-    /* Now add the two shadow points at n and n + 1.    */
+    /* Add two horizontal shadow points at n and n+1.   */
     /* We need the left side bearing and advance width. */
+    /* Add two vertical shadow points at n+2 and n+3.   */
+    /* We need the top side bearing and advance height. */
 
     {
       FT_Vector*  pp1;
       FT_Vector*  pp2;
+      FT_Vector*  pp3;
+      FT_Vector*  pp4;
 
 
       /* pp1 = xMin - lsb */
@@ -653,14 +708,26 @@
       pp2->x = pp1->x + load->advance;
       pp2->y = 0;
 
+      /* pp3 = top side bearing */
+      pp3    = pp1 + 2;
+      pp3->x = 0;
+      pp3->y = load->top_bearing + load->bbox.yMax;
+
+      /* pp4 = pp3 - ah */
+      pp4    = pp1 + 3;
+      pp4->x = 0;
+      pp4->y = pp3->y - load->vadvance;
+
       outline->tags[n_points    ] = 0;
       outline->tags[n_points + 1] = 0;
+      outline->tags[n_points + 2] = 0;
+      outline->tags[n_points + 3] = 0;
     }
 
     /* Note that we return two more points that are not */
     /* part of the glyph outline.                       */
 
-    n_points += 2;
+    n_points += 4;
 
     /* set up zone for hinting */
     tt_prepare_zone( zone, &gloader->current, 0, 0 );
@@ -687,15 +754,18 @@
     /* eventually hint the glyph */
     if ( IS_HINTED( load->load_flags ) )
     {
-      FT_Pos  x = zone->org[n_points-2].x;
+      FT_Pos  x = zone->org[n_points-4].x;
+      FT_Pos  y = zone->org[n_points-2].y;
 
 
-      x = ( ( x + 32 ) & -64 ) - x;
-      translate_array( n_points, zone->org, x, 0 );
+      x = FT_PIX_ROUND( x ) - x;
+      y = FT_PIX_ROUND( y ) - y;
+      translate_array( n_points, zone->org, x, y );
 
       org_to_cur( n_points, zone );
 
-      zone->cur[n_points - 1].x = ( zone->cur[n_points - 1].x + 32 ) & -64;
+      zone->cur[n_points - 3].x = FT_PIX_ROUND( zone->cur[n_points - 3].x );
+      zone->cur[n_points - 1].y = FT_PIX_ROUND( zone->cur[n_points - 1].y );
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
@@ -711,7 +781,7 @@
         load->exec->pedantic_hinting = (FT_Bool)( load->load_flags &
                                                   FT_LOAD_PEDANTIC );
         load->exec->pts              = *zone;
-        load->exec->pts.n_points    += 2;
+        load->exec->pts.n_points    += 4;
 
         error = TT_Run_Context( load->exec, debug );
         if ( error && load->exec->pedantic_hinting )
@@ -727,8 +797,10 @@
     /* save glyph phantom points */
     if ( !load->preserve_pps )
     {
-      load->pp1 = zone->cur[n_points - 2];
-      load->pp2 = zone->cur[n_points - 1];
+      load->pp1 = zone->cur[n_points - 4];
+      load->pp2 = zone->cur[n_points - 3];
+      load->pp3 = zone->cur[n_points - 2];
+      load->pp4 = zone->cur[n_points - 1];
     }
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -797,16 +869,22 @@
       y_scale = loader->size->metrics.y_scale;
     }
 
-    /* get horizontal metrics */
+    /* get metrics, horizontal and vertical */
     {
-      FT_Short   left_bearing = 0;
-      FT_UShort  advance_width = 0;
+      FT_Short   left_bearing = 0, top_bearing = 0;
+      FT_UShort  advance_width = 0, advance_height = 0;
+
 
       Get_HMetrics( face, glyph_index,
                     (FT_Bool)!( loader->load_flags &
                                 FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
                     &left_bearing,
                     &advance_width );
+      Get_VMetrics( face, glyph_index,
+                    (FT_Bool)!( loader->load_flags &
+                                FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+                    &top_bearing,
+                    &advance_height );
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
@@ -830,10 +908,33 @@
         advance_width = (FT_UShort)metrics.advance;
       }
 
+# if 0
+      /* GWW: Do I do the same for vertical metrics ??? */
+      if ( face->root.internal->incremental_interface &&
+           face->root.internal->incremental_interface->funcs->get_glyph_metrics )
+      {
+        FT_Incremental_MetricsRec  metrics;
+
+
+        metrics.bearing_x = 0;
+        metrics.bearing_y = top_bearing;
+        metrics.advance = advance_height;
+        error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
+                  face->root.internal->incremental_interface->object,
+                  glyph_index, TRUE, &metrics );
+        if ( error )
+          goto Exit;
+        top_bearing  = (FT_Short)metrics.bearing_y;
+        advance_height = (FT_UShort)metrics.advance;
+      }
+# endif
+
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
       loader->left_bearing = left_bearing;
       loader->advance      = advance_width;
+      loader->top_bearing  = top_bearing;
+      loader->vadvance     = advance_height;
 
       if ( !loader->linear_def )
       {
@@ -893,9 +994,14 @@
 
       loader->pp1.x = 0;
       loader->pp2.x = loader->advance;
+      loader->pp3.y = 0;
+      loader->pp4.y = loader->pp3.y-loader->vadvance;
 
       if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
+      {
         loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
+        loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
+      }
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
@@ -933,10 +1039,17 @@
     loader->pp2.x = loader->pp1.x + loader->advance;
     loader->pp2.y = 0;
 
+    loader->pp3.x = 0;
+    loader->pp3.y = loader->top_bearing + loader->bbox.yMax;
+    loader->pp4.x = 0;
+    loader->pp4.y = loader->pp3.y - loader->vadvance;
+
     if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
     {
       loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
       loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
+      loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
+      loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
     }
 
     /***********************************************************************/
@@ -1045,7 +1158,7 @@
 
         for ( n = 0; n < (FT_Int)num_subglyphs; n++ )
         {
-          FT_Vector  pp1, pp2;
+          FT_Vector  pp1, pp2, pp3, pp4;
           FT_Pos     x, y;
 
 
@@ -1057,6 +1170,8 @@
 
           pp1 = loader->pp1;
           pp2 = loader->pp2;
+          pp3 = loader->pp3;
+          pp4 = loader->pp4;
 
           num_base_points = gloader->base.outline.n_points;
 
@@ -1072,11 +1187,15 @@
           {
             pp1 = loader->pp1;
             pp2 = loader->pp2;
+            pp3 = loader->pp3;
+            pp4 = loader->pp4;
           }
           else
           {
             loader->pp1 = pp1;
             loader->pp2 = pp2;
+            loader->pp3 = pp3;
+            loader->pp4 = pp4;
           }
 
           num_points = gloader->base.outline.n_points;
@@ -1202,8 +1321,8 @@
 
               if ( subglyph->flags & ROUND_XY_TO_GRID )
               {
-                x = ( x + 32 ) & -64;
-                y = ( y + 32 ) & -64;
+                x = FT_PIX_ROUND( x );
+                y = FT_PIX_ROUND( y );
               }
             }
           }
@@ -1273,7 +1392,7 @@
           if ( error )
             goto Fail;
 
-          error = FT_GlyphLoader_CheckPoints( gloader, num_points + 2, 0 );
+          error = FT_GlyphLoader_CheckPoints( gloader, num_points + 4, 0 );
           if ( error )
             goto Fail;
 
@@ -1282,22 +1401,28 @@
                            start_point, start_contour );
           pts = &exec->pts;
 
-          pts->n_points   = (short)(num_points + 2);
+          pts->n_points   = (short)( num_points + 4 );
           pts->n_contours = gloader->base.outline.n_contours;
 
           /* add phantom points */
           pp1    = pts->cur + num_points;
           pp1[0] = loader->pp1;
           pp1[1] = loader->pp2;
+          pp1[2] = loader->pp3;
+          pp1[3] = loader->pp4;
 
           pts->tags[num_points    ] = 0;
           pts->tags[num_points + 1] = 0;
+          pts->tags[num_points + 2] = 0;
+          pts->tags[num_points + 3] = 0;
 
           /* if hinting, round the phantom points */
           if ( IS_HINTED( loader->load_flags ) )
           {
-            pp1[0].x = ( ( loader->pp1.x + 32 ) & -64 );
-            pp1[1].x = ( ( loader->pp2.x + 32 ) & -64 );
+            pp1[0].x = FT_PIX_ROUND( loader->pp1.x );
+            pp1[1].x = FT_PIX_ROUND( loader->pp2.x );
+            pp1[2].y = FT_PIX_ROUND( loader->pp3.y );
+            pp1[3].y = FT_PIX_ROUND( loader->pp4.y );
           }
 
           {
@@ -1308,7 +1433,7 @@
               pts->tags[k] &= FT_CURVE_TAG_ON;
           }
 
-          cur_to_org( num_points + 2, pts );
+          cur_to_org( num_points + 4, pts );
 
           /* now consider hinting */
           if ( IS_HINTED( loader->load_flags ) && n_ins > 0 )
@@ -1324,6 +1449,8 @@
           /* save glyph origin and advance points */
           loader->pp1 = pp1[0];
           loader->pp2 = pp1[1];
+          loader->pp3 = pp1[2];
+          loader->pp4 = pp1[3];
         }
 
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
@@ -1390,10 +1517,10 @@
       if ( IS_HINTED( loader->load_flags ) )
       {
         /* grid-fit the bounding box */
-        bbox.xMin &= -64;
-        bbox.yMin &= -64;
-        bbox.xMax  = ( bbox.xMax + 63 ) & -64;
-        bbox.yMax  = ( bbox.yMax + 63 ) & -64;
+        bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
+        bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
+        bbox.xMax = FT_PIX_CEIL( bbox.xMax );
+        bbox.yMax = FT_PIX_CEIL( bbox.yMax );
       }
     }
     else
@@ -1425,7 +1552,7 @@
 
     /* don't forget to hint the advance when we need to */
     if ( IS_HINTED( loader->load_flags ) )
-      glyph->metrics.horiAdvance = ( glyph->metrics.horiAdvance + 32 ) & -64;
+      glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance );
 
     /* Now take care of vertical metrics.  In the case where there is    */
     /* no vertical information within the font (relatively common), make */
@@ -1443,13 +1570,9 @@
       if ( face->vertical_info &&
            face->vertical.number_Of_VMetrics > 0 )
       {
-        /* Don't assume that both the vertical header and vertical */
-        /* metrics are present in the same font :-)                */
+        advance_height = loader->pp4.y - loader->pp3.y;
+        top_bearing    = loader->pp3.y - bbox.yMax;
 
-        TT_Get_Metrics( (TT_HoriHeader*)&face->vertical,
-                        glyph_index,
-                        &top_bearing,
-                        &advance_height );
       }
       else
       {
@@ -1465,6 +1588,12 @@
         /*        here with:                                   */
         /*             ascender - descender + linegap          */
         /*                                                     */
+        /* NOTE3: This is different from what MS's rasterizer  */
+        /*        appears to do when getting default values    */
+        /*        for the vertical phantom points.  We leave   */
+        /*        the old code untouched, but relying on       */
+        /*        phantom points alone might be reasonable     */
+        /*        (i.e., removing the `if' above).             */
         if ( face->os2.version != 0xFFFFU )
         {
           top_bearing    = (FT_Short)( face->os2.sTypoLineGap / 2 );
@@ -1507,6 +1636,8 @@
         advance_height = (FT_UShort)metrics.advance;
       }
 
+      /* GWW: Do vertical metrics get loaded incrementally too? */
+
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
       /* We must adjust the top_bearing value from the bounding box given */
@@ -1538,9 +1669,9 @@
       /* grid-fit them if necessary */
       if ( IS_HINTED( loader->load_flags ) )
       {
-        left   &= -64;
-        top     = ( top + 63     ) & -64;
-        advance = ( advance + 32 ) & -64;
+        left    = FT_PIX_FLOOR( left );
+        top     = FT_PIX_CEIL( top );
+        advance = FT_PIX_ROUND( advance );
       }
 
       glyph->metrics.vertBearingX = left;
@@ -1598,7 +1729,7 @@
   FT_LOCAL_DEF( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags )
   {
     SFNT_Service  sfnt;
@@ -1641,7 +1772,7 @@
 
       error = sfnt->load_sbit_image( face,
                                      (FT_ULong)size->strike_index,
-                                     (FT_UInt)glyph_index,
+                                     glyph_index,
                                      (FT_Int)load_flags,
                                      stream,
                                      &glyph->bitmap,

reactos/lib/freetype/src/truetype
ttgload.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ttgload.h	21 Jan 2004 19:23:47 -0000	1.2
+++ ttgload.h	10 May 2004 17:48:36 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -43,7 +43,7 @@
   FT_LOCAL( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags );
 
 

reactos/lib/freetype/src/truetype
ttinterp.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttinterp.c	15 Feb 2004 21:45:36 -0000	1.5
+++ ttinterp.c	10 May 2004 17:48:36 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType bytecode interpreter (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -30,9 +30,10 @@
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
 
-#define TT_MULFIX  FT_MulFix
-#define TT_MULDIV  FT_MulDiv
-#define TT_INT64   FT_Int64
+#define TT_MULFIX           FT_MulFix
+#define TT_MULDIV           FT_MulDiv
+#define TT_MULDIV_NO_ROUND  FT_MulDiv_No_Round
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -162,6 +163,9 @@
 #define CUR_Func_move( z, p, d ) \
           CUR.func_move( EXEC_ARG_ z, p, d )
 
+#define CUR_Func_move_orig( z, p, d ) \
+          CUR.func_move_orig( EXEC_ARG_ z, p, d )
+
 #define CUR_Func_dualproj( x, y ) \
           CUR.func_dualproj( EXEC_ARG_ x, y )
 
@@ -515,8 +519,7 @@
 
     if ( *size < new_max )
     {
-      FT_FREE( *buff );
-      if ( FT_ALLOC( *buff, new_max * multiplier ) )
+      if ( FT_REALLOC( *buff, *size, new_max * multiplier ) )
         return error;
       *size = new_max;
     }
@@ -1566,7 +1569,6 @@
 
     if ( v != 0 )
     {
-
       zone->cur[point].x += TT_MULDIV( distance,
                                        v * 0x10000L,
                                        CUR.F_dot_P );
@@ -1578,7 +1580,6 @@
 
     if ( v != 0 )
     {
-
       zone->cur[point].y += TT_MULDIV( distance,
                                        v * 0x10000L,
                                        CUR.F_dot_P );
@@ -1590,6 +1591,51 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* <Function>                                                            */
+  /*    Direct_Move_Orig                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Moves the *original* position of a point by a given distance along */
+  /*    the freedom vector.  Obviously, the point will not be `touched'.   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    point    :: The index of the point to move.                        */
+  /*                                                                       */
+  /*    distance :: The distance to apply.                                 */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    zone     :: The affected glyph zone.                               */
+  /*                                                                       */
+  static void
+  Direct_Move_Orig( EXEC_OP_ TT_GlyphZone  zone,
+                             FT_UShort     point,
+                             FT_F26Dot6    distance )
+  {
+    FT_F26Dot6  v;
+
+
+#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
+    FT_ASSERT( !CUR.face->unpatented_hinting );
+#endif
+
+    v = CUR.GS.freeVector.x;
+
+    if ( v != 0 )
+      zone->org[point].x += TT_MULDIV( distance,
+                                       v * 0x10000L,
+                                       CUR.F_dot_P );
+
+    v = CUR.GS.freeVector.y;
+
+    if ( v != 0 )
+      zone->org[point].y += TT_MULDIV( distance,
+                                       v * 0x10000L,
+                                       CUR.F_dot_P );
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* Special versions of Direct_Move()                                     */
   /*                                                                       */
   /*   The following versions are used whenever both vectors are both      */
@@ -1624,6 +1670,38 @@
 
   /*************************************************************************/
   /*                                                                       */
+  /* Special versions of Direct_Move_Orig()                                */
+  /*                                                                       */
+  /*   The following versions are used whenever both vectors are both      */
+  /*   along one of the coordinate unit vectors, i.e. in 90% of the cases. */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+  static void
+  Direct_Move_Orig_X( EXEC_OP_ TT_GlyphZone  zone,
+                               FT_UShort     point,
+                               FT_F26Dot6    distance )
+  {
+    FT_UNUSED_EXEC;
+
+    zone->org[point].x += distance;
+  }
+
+
+  static void
+  Direct_Move_Orig_Y( EXEC_OP_ TT_GlyphZone  zone,
+                               FT_UShort     point,
+                               FT_F26Dot6    distance )
+  {
+    FT_UNUSED_EXEC;
+
+    zone->org[point].y += distance;
+  }
+
+
+  /*************************************************************************/
+  /*                                                                       */
   /* <Function>                                                            */
   /*    Round_None                                                         */
   /*                                                                       */
@@ -1656,7 +1734,7 @@
     if ( distance >= 0 )
     {
       val = distance + compensation;
-      if ( val < 0 )
+      if ( distance && val < 0 )
         val = 0;
     }
     else {
@@ -1696,14 +1774,14 @@
     if ( distance >= 0 )
     {
       val = distance + compensation + 32;
-      if ( val > 0 )
+      if ( distance && val > 0 )
         val &= ~63;
       else
         val = 0;
     }
     else
     {
-      val = -( ( compensation - distance + 32 ) & -64 );
+      val = -FT_PIX_ROUND( compensation - distance );
       if ( val > 0 )
         val = 0;
     }
@@ -1739,13 +1817,13 @@
 
     if ( distance >= 0 )
     {
-      val = ( ( distance + compensation ) & -64 ) + 32;
-      if ( val < 0 )
+      val = FT_PIX_FLOOR( distance + compensation ) + 32;
+      if ( distance && val < 0 )
         val = 0;
     }
     else
     {
-      val = -( ( (compensation - distance) & -64 ) + 32 );
+      val = -( FT_PIX_FLOOR( compensation - distance ) + 32 );
       if ( val > 0 )
         val = 0;
     }
@@ -1782,7 +1860,7 @@
     if ( distance >= 0 )
     {
       val = distance + compensation;
-      if ( val > 0 )
+      if ( distance && val > 0 )
         val &= ~63;
       else
         val = 0;
@@ -1826,14 +1904,14 @@
     if ( distance >= 0 )
     {
       val = distance + compensation + 63;
-      if ( val > 0 )
+      if ( distance && val > 0 )
         val &= ~63;
       else
         val = 0;
     }
     else
     {
-      val = -( ( compensation - distance + 63 ) & -64 );
+      val = - FT_PIX_CEIL( compensation - distance );
       if ( val > 0 )
         val = 0;
     }
@@ -1870,14 +1948,14 @@
     if ( distance >= 0 )
     {
       val = distance + compensation + 16;
-      if ( val > 0 )
+      if ( distance && val > 0 )
         val &= ~31;
       else
         val = 0;
     }
     else
     {
-      val = -( ( compensation - distance + 16 ) & -32 );
+      val = -FT_PAD_ROUND( compensation - distance, 32 );
       if ( val > 0 )
         val = 0;
     }
@@ -1919,7 +1997,7 @@
     {
       val = ( distance - CUR.phase + CUR.threshold + compensation ) &
               -CUR.period;
-      if ( val < 0 )
+      if ( distance && val < 0 )
         val = 0;
       val += CUR.phase;
     }
@@ -1967,7 +2045,7 @@
     {
       val = ( ( distance - CUR.phase + CUR.threshold + compensation ) /
                 CUR.period ) * CUR.period;
-      if ( val < 0 )
+      if ( distance && val < 0 )
         val = 0;
       val += CUR.phase;
     }
@@ -2243,13 +2321,15 @@
 
       if ( CUR.GS.both_x_axis )
       {
-        CUR.func_project  = Project_x;
-        CUR.func_move     = Direct_Move_X;
+        CUR.func_project   = Project_x;
+        CUR.func_move      = Direct_Move_X;
+        CUR.func_move_orig = Direct_Move_Orig_X;
       }
       else
       {
-        CUR.func_project  = Project_y;
-        CUR.func_move     = Direct_Move_Y;
+        CUR.func_project   = Project_y;
+        CUR.func_move      = Direct_Move_Y;
+        CUR.func_move_orig = Direct_Move_Orig_Y;
       }
 
       if ( CUR.GS.dualVector.x == 0x4000 )
@@ -2300,23 +2380,30 @@
         CUR.func_dualproj = (TT_Project_Func)Dual_Project;
     }
 
-    CUR.func_move = (TT_Move_Func)Direct_Move;
+    CUR.func_move      = (TT_Move_Func)Direct_Move;
+    CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig;
 
     if ( CUR.F_dot_P == 0x40000000L )
     {
       if ( CUR.GS.freeVector.x == 0x4000 )
-        CUR.func_move = (TT_Move_Func)Direct_Move_X;
+      {
+        CUR.func_move      = (TT_Move_Func)Direct_Move_X;
+        CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_X;
+      }
       else
       {
         if ( CUR.GS.freeVector.y == 0x4000 )
-          CUR.func_move = (TT_Move_Func)Direct_Move_Y;
+        {
+          CUR.func_move      = (TT_Move_Func)Direct_Move_Y;
+          CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y;
+        }
       }
     }
 
     /* at small sizes, F_dot_P can become too small, resulting   */
     /* in overflows and `spikes' in a number of glyphs like `w'. */
 
-    if ( ABS( CUR.F_dot_P ) < 0x4000000L )
+    if ( FT_ABS( CUR.F_dot_P ) < 0x4000000L )
       CUR.F_dot_P = 0x40000000L;
 
     /* Disable cached aspect ratio */
@@ -2359,7 +2446,7 @@
     FT_UNUSED_EXEC;
 
 
-    if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
+    if ( FT_ABS( Vx ) < 0x10000L && FT_ABS( Vy ) < 0x10000L )
     {
       Vx *= 0x100;
       Vy *= 0x100;
@@ -2887,19 +2974,19 @@
     args[0] -= args[1];
 
 
-#define DO_DIV                                      \
-    if ( args[1] == 0 )                             \
-      CUR.error = TT_Err_Divide_By_Zero;            \
-    else                                            \
-      args[0] = TT_MULDIV( args[0], 64L, args[1] );
+#define DO_DIV                                               \
+    if ( args[1] == 0 )                                      \
+      CUR.error = TT_Err_Divide_By_Zero;                     \
+    else                                                     \
+      args[0] = TT_MULDIV_NO_ROUND( args[0], 64L, args[1] );
 
 
 #define DO_MUL                                    \
     args[0] = TT_MULDIV( args[0], args[1], 64L );
 
 
-#define DO_ABS                \
-    args[0] = ABS( args[0] );
+#define DO_ABS                   \
+    args[0] = FT_ABS( args[0] );
 
 
 #define DO_NEG          \
@@ -2907,11 +2994,11 @@
 
 
 #define DO_FLOOR    \
-    args[0] &= -64;
+    args[0] = FT_PIX_FLOOR( args[0] );
 
 
 #define DO_CEILING                    \
-    args[0] = ( args[0] + 63 ) & -64;
+    args[0] = FT_PIX_CEIL( args[0] );
 
 
 #define DO_RS                          \
@@ -4019,9 +4106,9 @@
 
     K = CUR.stack[CUR.args - L];
 
-    FT_MEM_MOVE( &CUR.stack[CUR.args - L    ],
-                 &CUR.stack[CUR.args - L + 1],
-                 ( L - 1 ) * sizeof ( FT_Long ) );
+    FT_ARRAY_MOVE( &CUR.stack[CUR.args - L    ],
+                   &CUR.stack[CUR.args - L + 1],
+                   ( L - 1 ) );
 
     CUR.stack[CUR.args - 1] = K;
   }
@@ -5201,7 +5288,7 @@
       {
         *x = 0;
         *y = d;
-      }    
+      }
     }
     else
 #endif
@@ -5359,11 +5446,11 @@
         last_point = 0;
     }
 
-    /* XXX: UNDOCUMENTED! SHC doesn't touch the points */
+    /* XXX: UNDOCUMENTED! SHC does touch the points */
     for ( i = first_point; i <= last_point; i++ )
     {
       if ( zp.cur != CUR.zp2.cur || refp != i )
-        MOVE_Zp2_Point( i, dx, dy, FALSE );
+        MOVE_Zp2_Point( i, dx, dy, TRUE );
     }
   }
 
@@ -5498,9 +5585,11 @@
     }
 
     /* XXX: UNDOCUMENTED! behaviour */
-    if ( CUR.GS.gep0 == 0 )   /* if in twilight zone */
+    if ( CUR.GS.gep1 == 0 )   /* if the point that is to be moved */
+                              /* is in twilight zone              */
     {
       CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];
+      CUR_Func_move_orig( &CUR.zp1, point, args[1] );
       CUR.zp1.cur[point] = CUR.zp1.org[point];
     }
 
@@ -5619,7 +5708,7 @@
 
     if ( ( CUR.opcode & 1 ) != 0 )   /* rounding and control cutin flag */
     {
-      if ( ABS( distance - org_dist ) > CUR.GS.control_value_cutin )
+      if ( FT_ABS( distance - org_dist ) > CUR.GS.control_value_cutin )
         distance = org_dist;
 
       distance = CUR_Func_round( distance, CUR.tt_metrics.compensations[0] );
@@ -5663,7 +5752,7 @@
 
     /* single width cutin test */
 
-    if ( ABS( org_dist - CUR.GS.single_width_value ) <
+    if ( FT_ABS( org_dist - CUR.GS.single_width_value ) <
          CUR.GS.single_width_cutin )
     {
       if ( org_dist >= 0 )
@@ -5753,7 +5842,7 @@
 
     /* single width test */
 
-    if ( ABS( cvt_dist - CUR.GS.single_width_value ) <
+    if ( FT_ABS( cvt_dist - CUR.GS.single_width_value ) <
          CUR.GS.single_width_cutin )
     {
       if ( cvt_dist >= 0 )
@@ -5797,7 +5886,7 @@
       /*      refer to the same zone.                                  */
 
       if ( CUR.GS.gep0 == CUR.GS.gep1 )
-        if ( ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin )
+        if ( FT_ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin )
           cvt_dist = org_dist;
 
       distance = CUR_Func_round(
@@ -5947,7 +6036,7 @@
     discriminant = TT_MULDIV( dax, -dby, 0x40 ) +
                    TT_MULDIV( day, dbx, 0x40 );
 
-    if ( ABS( discriminant ) >= 0x40 )
+    if ( FT_ABS( discriminant ) >= 0x40 )
     {
       val = TT_MULDIV( dx, -dby, 0x40 ) + TT_MULDIV( dy, dbx, 0x40 );
 

reactos/lib/freetype/src/truetype
ttinterp.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttinterp.h	15 Feb 2004 21:45:36 -0000	1.3
+++ ttinterp.h	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType bytecode interpreter (specification).                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -210,6 +210,7 @@
                        func_freeProj;  /* current freedom proj. func  */
 
     TT_Move_Func       func_move;      /* current point move function */
+    TT_Move_Func       func_move_orig; /* move original position function */
 
     TT_Get_CVT_Func    func_read_cvt;  /* read a cvt entry              */
     TT_Set_CVT_Func    func_write_cvt; /* write a cvt entry (in pixels) */

reactos/lib/freetype/src/truetype
ttobjs.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ttobjs.c	15 Feb 2004 21:45:36 -0000	1.5
+++ ttobjs.c	10 May 2004 17:48:36 -0000	1.6
@@ -23,7 +23,6 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #include "ttgload.h"
 #include "ttpload.h"
@@ -228,7 +227,7 @@
 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
 
     /* Determine whether unpatented hinting is to be used for this face. */
-    face->unpatented_hinting =
+    face->unpatented_hinting = FT_BOOL
        ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
 
     {
@@ -591,14 +590,15 @@
     }
 
     /* Compute root ascender, descender, text height, and max_advance */
-    metrics->ascender    = ( FT_MulFix( face->root.ascender,
-                                        metrics->y_scale ) + 32 ) & -64;
-    metrics->descender   = ( FT_MulFix( face->root.descender,
-                                        metrics->y_scale ) + 32 ) & -64;
-    metrics->height      = ( FT_MulFix( face->root.height,
-                                        metrics->y_scale ) + 32 ) & -64;
-    metrics->max_advance = ( FT_MulFix( face->root.max_advance_width,
-                                        metrics->x_scale ) + 32 ) & -64;
+    metrics->ascender =
+      FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );
+    metrics->descender =
+      FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );
+    metrics->height =
+      FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );
+    metrics->max_advance =
+      FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,
+                               metrics->x_scale ) );
 
 
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@@ -749,7 +749,8 @@
       sbit_metrics->descender = strike->hori.descender << 6;
 
       /* XXX: Is this correct? */
-      sbit_metrics->height = sbit_metrics->ascender - sbit_metrics->descender;
+      sbit_metrics->height = sbit_metrics->ascender -
+                             sbit_metrics->descender;
 
       /* XXX: Is this correct? */
       sbit_metrics->max_advance = ( strike->hori.min_origin_SB  +

reactos/lib/freetype/src/truetype
ttobjs.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ttobjs.h	21 Jan 2004 19:23:47 -0000	1.3
+++ ttobjs.h	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (specification).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -216,7 +216,8 @@
 
     TT_Transform     transform;    /* transformation matrix               */
 
-    FT_Vector        pp1, pp2;     /* phantom points                      */
+    FT_Vector        pp1, pp2;     /* phantom points (horizontal)         */
+    FT_Vector        pp3, pp4;     /* phantom points (vertical)           */
 
   } TT_SubGlyphRec, *TT_SubGlyph_Stack;
 

reactos/lib/freetype/src/type1
t1driver.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1driver.c	15 Feb 2004 21:45:36 -0000	1.4
+++ t1driver.c	10 May 2004 17:48:36 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 driver interface (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -29,8 +29,13 @@
 
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
+#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_XFREE86_NAME_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -41,6 +46,10 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_t1driver
 
+ /*
+  *  GLYPH DICT SERVICE
+  *
+  */
 
   static FT_Error
   t1_get_glyph_name( T1_Face     face,
@@ -69,23 +78,6 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    t1_get_name_index                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Uses the Type 1 font's `glyph_names' table to find a given glyph   */
-  /*    name's glyph index.                                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face       :: A handle to the source face object.                  */
-  /*                                                                       */
-  /*    glyph_name :: The glyph name.                                      */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Glyph index.  0 means `undefined character code'.                  */
-  /*                                                                       */
   static FT_UInt
   t1_get_name_index( T1_Face     face,
                      FT_String*  glyph_name )
@@ -105,6 +97,17 @@
     return 0;
   }
 
+  static const FT_Service_GlyphDictRec  t1_service_glyph_dict =
+  {
+    (FT_GlyphDict_GetNameFunc)  t1_get_glyph_name,
+    (FT_GlyphDict_NameIndexFunc)t1_get_name_index
+  };
+
+
+ /*
+  *  POSTSCRIPT NAME SERVICE
+  *
+  */
 
   static const char*
   t1_get_ps_name( T1_Face  face )
@@ -112,61 +115,82 @@
     return (const char*) face->type1.font_name;
   }
 
+  static const FT_Service_PsFontNameRec  t1_service_ps_name =
+  {
+    (FT_PsName_GetFunc)t1_get_ps_name
+  };
+
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    Get_Interface                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Each driver can provide one or more extensions to the base         */
-  /*    FreeType API.  These can be used to access format specific         */
-  /*    features (e.g., all TrueType/OpenType resources share a common     */
-  /*    file structure and common tables which can be accessed through the */
-  /*    `sfnt' interface), or more simply generic ones (e.g., the          */
-  /*    `postscript names' interface which can be used to retrieve the     */
-  /*     PostScript name of a given glyph index).                          */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    driver       :: A handle to a driver object.                       */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    t1_interface :: A string designing the interface.  Examples are    */
-  /*                    `sfnt', `post_names', `charmaps', etc.             */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    A typeless pointer to the extension's interface (normally a table  */
-  /*    of function pointers).  Returns NULL if the requested extension    */
-  /*    isn't available (i.e., wasn't compiled in the driver at build      */
-  /*    time).                                                             */
-  /*                                                                       */
-  static FT_Module_Interface
-  Get_Interface( FT_Driver         driver,
-                 const FT_String*  t1_interface )
+ /*
+  *  MULTIPLE MASTERS SERVICE
+  *
+  */
+
+#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
+  static const FT_Service_MultiMastersRec  t1_service_multi_masters =
   {
-    FT_UNUSED( driver );
-    FT_UNUSED( t1_interface );
+    (FT_Get_MM_Func)       T1_Get_Multi_Master,
+    (FT_Set_MM_Design_Func)T1_Set_MM_Design,
+    (FT_Set_MM_Blend_Func) T1_Set_MM_Blend
+  };
+#endif
+
 
-    if ( ft_strcmp( (const char*)t1_interface, "glyph_name" ) == 0 )
-      return (FT_Module_Interface)t1_get_glyph_name;
+ /*
+  *  POSTSCRIPT INFO SERVICE
+  *
+  */
+
+  static FT_Error
+  t1_ps_get_font_info( FT_Face          face,
+                       PS_FontInfoRec*  afont_info )
+  {
+    *afont_info = ((T1_Face)face)->type1.font_info;
+    return 0;
+  }
 
-    if ( ft_strcmp( (const char*)t1_interface, "name_index" ) == 0 )
-      return (FT_Module_Interface)t1_get_name_index;
 
-    if ( ft_strcmp( (const char*)t1_interface, "postscript_name" ) == 0 )
-      return (FT_Module_Interface)t1_get_ps_name;
+  static FT_Int
+  t1_ps_has_glyph_names( FT_Face  face )
+  {
+    FT_UNUSED( face );
+    return 1;
+  }
 
-#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-    if ( ft_strcmp( (const char*)t1_interface, "get_mm" ) == 0 )
-      return (FT_Module_Interface)T1_Get_Multi_Master;
 
-    if ( ft_strcmp( (const char*)t1_interface, "set_mm_design") == 0 )
-      return (FT_Module_Interface)T1_Set_MM_Design;
+  static const FT_Service_PsInfoRec  t1_service_ps_info =
+  {
+    (PS_GetFontInfoFunc)  t1_ps_get_font_info,
+    (PS_HasGlyphNamesFunc)t1_ps_has_glyph_names
+  };
 
-    if ( ft_strcmp( (const char*)t1_interface, "set_mm_blend") == 0 )
-      return (FT_Module_Interface)T1_Set_MM_Blend;
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  t1_services[] =
+  {
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name },
+    { FT_SERVICE_ID_GLYPH_DICT,           &t1_service_glyph_dict },
+    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_1 },
+    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &t1_service_ps_info },
+
+#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
+    { FT_SERVICE_ID_MULTI_MASTERS,        &t1_service_multi_masters },
 #endif
-    return 0;
+    { NULL, NULL }
+  };
+
+
+  static FT_Module_Interface
+  Get_Interface( FT_Driver         driver,
+                 const FT_String*  t1_interface )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( t1_services, t1_interface );
   }
 
 

reactos/lib/freetype/src/type1
t1gload.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- t1gload.c	15 Feb 2004 21:45:37 -0000	1.5
+++ t1gload.c	10 May 2004 17:48:36 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 Glyph Loader (body).                                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -81,7 +81,7 @@
     /* For ordinary fonts get the character data stored in the face record. */
     {
       char_string->pointer = type1->charstrings[glyph_index];
-      char_string->length  = type1->charstrings_len[glyph_index];
+      char_string->length  = (FT_Int)type1->charstrings_len[glyph_index];
     }
 
     if ( !error )
@@ -97,6 +97,7 @@
     {
       FT_Incremental_MetricsRec  metrics;
 
+
       metrics.bearing_x = decoder->builder.left_bearing.x;
       metrics.bearing_y = decoder->builder.left_bearing.y;
       metrics.advance   = decoder->builder.advance.x;
@@ -111,7 +112,7 @@
 
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
-  return error;
+    return error;
   }
 
 
@@ -120,11 +121,12 @@
                   FT_UInt     glyph_index )
   {
     FT_Data   glyph_data;
-    FT_Error  error = T1_Parse_Glyph_And_Get_Char_String( 
+    FT_Error  error = T1_Parse_Glyph_And_Get_Char_String(
                         decoder, glyph_index, &glyph_data );
 
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
+
     if ( !error )
     {
       T1_Face  face = (T1_Face)decoder->builder.face;
@@ -135,6 +137,7 @@
           face->root.internal->incremental_interface->object,
           &glyph_data );
     }
+
 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
     return error;
@@ -184,7 +187,7 @@
       error = T1_Parse_Glyph( &decoder, glyph_index );
       if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
         *max_advance = decoder.builder.advance.x;
-        
+
       /* ignore the error if one occurred - skip to next glyph */
     }
 
@@ -252,7 +255,7 @@
                                  (FT_Byte**)type1->glyph_names,
                                  face->blend,
                                  FT_BOOL( hinting ),
-                                 FT_LOAD_TARGET_MODE(load_flags),
+                                 FT_LOAD_TARGET_MODE( load_flags ),
                                  T1_Parse_Glyph );
     if ( error )
       goto Exit;
@@ -371,11 +374,11 @@
 
           if ( hinting )
           {
-            metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64;
-            metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64;
+            metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
+            metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
 
-            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;
-            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;
+            metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
+            metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
           }
         }
 
@@ -385,10 +388,10 @@
         /* grid fit the bounding box if necessary */
         if ( hinting )
         {
-          cbox.xMin &= -64;
-          cbox.yMin &= -64;
-          cbox.xMax  = ( cbox.xMax+63 ) & -64;
-          cbox.yMax  = ( cbox.yMax+63 ) & -64;
+          cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+          cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+          cbox.xMax = FT_PIX_CEIL( cbox.xMax );
+          cbox.yMax = FT_PIX_CEIL( cbox.yMax );
         }
 
         metrics->width  = cbox.xMax - cbox.xMin;

reactos/lib/freetype/src/type1
t1load.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- t1load.c	15 Feb 2004 21:45:37 -0000	1.5
+++ t1load.c	10 May 2004 17:48:36 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 font loader (body).                                           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -41,11 +41,10 @@
   /*                                                                       */
   /* All other common cases are handled very simply.  The matching rules   */
   /* are defined in the file `t1tokens.h' through the use of several       */
-  /* macros calls PARSE_XXX.                                               */
-  /*                                                                       */
-  /* This file is included twice here; the first time to generate parsing  */
-  /* callback functions, the second to generate a table of keywords (with  */
-  /* pointers to the associated callback).                                 */
+  /* macros calls PARSE_XXX.  This file is included twice here; the first  */
+  /* time to generate parsing callback functions, the second time to       */
+  /* generate a table of keywords (with pointers to the associated         */
+  /* callback functions).                                                  */
   /*                                                                       */
   /* The function `parse_dict' simply scans *linearly* a given dictionary  */
   /* (either the top-level or private one) and calls the appropriate       */
@@ -71,7 +70,6 @@
 #include "t1errors.h"
 
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -100,7 +98,7 @@
   {
     PS_Blend   blend;
     FT_Memory  memory = face->root.memory;
-    FT_Error   error  = 0;
+    FT_Error   error  = T1_Err_Ok;
 
 
     blend = face->blend;
@@ -174,7 +172,7 @@
     return error;
 
   Fail:
-    error = -1;
+    error = T1_Err_Invalid_File_Format;
     goto Exit;
   }
 
@@ -205,8 +203,10 @@
         axis->minimum = map->design_points[0];
         axis->maximum = map->design_points[map->num_points - 1];
       }
-      error = 0;
+
+      error = T1_Err_Ok;
     }
+
     return error;
   }
 
@@ -253,6 +253,7 @@
 
       error = T1_Err_Ok;
     }
+
     return error;
   }
 
@@ -289,7 +290,7 @@
           FT_Fixed  p_design = designs[p];
 
 
-          /* exact match ? */
+          /* exact match? */
           if ( design == p_design )
           {
             the_blend = blends[p];
@@ -305,7 +306,7 @@
           before = p;
         }
 
-        /* now, interpolate if needed */
+        /* now interpolate if necessary */
         if ( before < 0 )
           the_blend = blends[0];
 
@@ -386,9 +387,9 @@
   parse_blend_axis_types( T1_Face    face,
                           T1_Loader  loader )
   {
-    T1_TokenRec  axis_tokens[ T1_MAX_MM_AXIS ];
+    T1_TokenRec  axis_tokens[T1_MAX_MM_AXIS];
     FT_Int       n, num_axis;
-    FT_Error     error = 0;
+    FT_Error     error = T1_Err_Ok;
     PS_Blend     blend;
     FT_Memory    memory;
 
@@ -396,7 +397,12 @@
     /* take an array of objects */
     T1_ToTokenArray( &loader->parser, axis_tokens,
                      T1_MAX_MM_AXIS, &num_axis );
-    if ( num_axis <= 0 || num_axis > T1_MAX_MM_AXIS )
+    if ( num_axis < 0 )
+    {
+      error = T1_Err_Ignore;
+      goto Exit;
+    }
+    if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )
     {
       FT_ERROR(( "parse_blend_axis_types: incorrect number of axes: %d\n",
                  num_axis ));
@@ -448,18 +454,24 @@
   parse_blend_design_positions( T1_Face    face,
                                 T1_Loader  loader )
   {
-    T1_TokenRec  design_tokens[ T1_MAX_MM_DESIGNS ];
+    T1_TokenRec  design_tokens[T1_MAX_MM_DESIGNS];
     FT_Int       num_designs;
     FT_Int       num_axis;
     T1_Parser    parser = &loader->parser;
 
-    FT_Error     error = 0;
+    FT_Error     error = T1_Err_Ok;
     PS_Blend     blend;
 
 
-    /* get the array of design tokens - compute number of designs */
-    T1_ToTokenArray( parser, design_tokens, T1_MAX_MM_DESIGNS, &num_designs );
-    if ( num_designs <= 0 || num_designs > T1_MAX_MM_DESIGNS )
+    /* get the array of design tokens -- compute number of designs */
+    T1_ToTokenArray( parser, design_tokens,
+                     T1_MAX_MM_DESIGNS, &num_designs );
+    if ( num_designs < 0 )
+    {
+      error = T1_Err_Ignore;
+      goto Exit;
+    }
+    if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
       FT_ERROR(( "parse_blend_design_positions:" ));
       FT_ERROR(( " incorrect number of designs: %d\n",
@@ -471,23 +483,23 @@
     {
       FT_Byte*  old_cursor = parser->root.cursor;
       FT_Byte*  old_limit  = parser->root.limit;
-      FT_UInt   n;
+      FT_Int    n;
 
 
       blend    = face->blend;
       num_axis = 0;  /* make compiler happy */
 
-      for ( n = 0; n < (FT_UInt)num_designs; n++ )
+      for ( n = 0; n < num_designs; n++ )
       {
-        T1_TokenRec  axis_tokens[ T1_MAX_MM_DESIGNS ];
+        T1_TokenRec  axis_tokens[T1_MAX_MM_DESIGNS];
         T1_Token     token;
         FT_Int       axis, n_axis;
 
 
         /* read axis/coordinates tokens */
         token = design_tokens + n;
-        parser->root.cursor = token->start - 1;
-        parser->root.limit  = token->limit + 1;
+        parser->root.cursor = token->start;
+        parser->root.limit  = token->limit;
         T1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &n_axis );
 
         if ( n == 0 )
@@ -505,7 +517,7 @@
           goto Exit;
         }
 
-        /* now, read each axis token into the design position */
+        /* now read each axis token into the design position */
         for ( axis = 0; axis < n_axis; axis++ )
         {
           T1_Token  token2 = axis_tokens + axis;
@@ -530,7 +542,7 @@
   parse_blend_design_map( T1_Face    face,
                           T1_Loader  loader )
   {
-    FT_Error     error  = 0;
+    FT_Error     error  = T1_Err_Ok;
     T1_Parser    parser = &loader->parser;
     PS_Blend     blend;
     T1_TokenRec  axis_tokens[T1_MAX_MM_AXIS];
@@ -540,14 +552,21 @@
     FT_Memory    memory = face->root.memory;
 
 
-    T1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &num_axis );
-    if ( num_axis <= 0 || num_axis > T1_MAX_MM_AXIS )
+    T1_ToTokenArray( parser, axis_tokens, 
+                     T1_MAX_MM_AXIS, &num_axis );
+    if ( num_axis < 0 )
+    {
+      error = T1_Err_Ignore;
+      goto Exit;
+    }
+    if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS )
     {
       FT_ERROR(( "parse_blend_design_map: incorrect number of axes: %d\n",
                  num_axis ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     }
+
     old_cursor = parser->root.cursor;
     old_limit  = parser->root.limit;
 
@@ -556,29 +575,22 @@
       goto Exit;
     blend = face->blend;
 
-    /* now, read each axis design map */
+    /* now read each axis design map */
     for ( n = 0; n < num_axis; n++ )
     {
       PS_DesignMap  map = blend->design_map + n;
-      T1_Token      token;
+      T1_Token      axis_token;
+      T1_TokenRec   point_tokens[T1_MAX_MM_MAP_POINTS];
       FT_Int        p, num_points;
 
 
-      token = axis_tokens + n;
-      parser->root.cursor = token->start;
-      parser->root.limit  = token->limit;
-
-      /* count the number of map points */
-      {
-        FT_Byte*  ptr   = token->start;
-        FT_Byte*  limit = token->limit;
+      axis_token = axis_tokens + n;
 
+      parser->root.cursor = axis_token->start;
+      parser->root.limit  = axis_token->limit;
+      T1_ToTokenArray( parser, point_tokens,
+                       T1_MAX_MM_MAP_POINTS, &num_points );
 
-        num_points = 0;
-        for ( ; ptr < limit; ptr++ )
-          if ( ptr[0] == '[' )
-            num_points++;
-      }
       if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS )
       {
         FT_ERROR(( "parse_blend_design_map: incorrect table\n" ));
@@ -594,6 +606,15 @@
 
       for ( p = 0; p < num_points; p++ )
       {
+        T1_Token  point_token;
+
+
+        point_token = point_tokens + p;
+
+        /* don't include delimiting brackets */
+        parser->root.cursor = point_token->start + 1;
+        parser->root.limit  = point_token->limit - 1;
+
         map->design_points[p] = T1_ToInt( parser );
         map->blend_points [p] = T1_ToFixed( parser, 0 );
       }
@@ -611,26 +632,46 @@
   parse_weight_vector( T1_Face    face,
                        T1_Loader  loader )
   {
-    FT_Error     error  = 0;
+    T1_TokenRec  design_tokens[T1_MAX_MM_DESIGNS];
+    FT_Int       num_designs;
+    FT_Error     error  = T1_Err_Ok;
     T1_Parser    parser = &loader->parser;
     PS_Blend     blend  = face->blend;
-    T1_TokenRec  master;
-    FT_UInt      n;
+    T1_Token     token;
+    FT_Int       n;
     FT_Byte*     old_cursor;
     FT_Byte*     old_limit;
 
 
-    if ( !blend || blend->num_designs == 0 )
+    T1_ToTokenArray( parser, design_tokens,
+                     T1_MAX_MM_DESIGNS, &num_designs );
+    if ( num_designs < 0 )
+    {
+      error = T1_Err_Ignore;
+      goto Exit;
+    }
+    if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS )
     {
-      FT_ERROR(( "parse_weight_vector: too early!\n" ));
+      FT_ERROR(( "parse_weight_vector:" ));
+      FT_ERROR(( " incorrect number of designs: %d\n",
+                 num_designs ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     }
 
-    T1_ToToken( parser, &master );
-    if ( master.type != T1_TOKEN_TYPE_ARRAY )
+    if ( !blend || !blend->num_designs )
+    {
+      error = t1_allocate_blend( face, num_designs, 0 );
+      if ( error )
+        goto Exit;
+      blend = face->blend;
+    }
+    else if ( blend->num_designs != (FT_UInt)num_designs )
     {
-      FT_ERROR(( "parse_weight_vector: incorrect format!\n" ));
+      FT_ERROR(( "parse_weight_vector:"
+                 " /BlendDesignPosition and /WeightVector have\n" ));
+      FT_ERROR(( "                    "
+                 " different number of elements!\n" ));
       error = T1_Err_Invalid_File_Format;
       goto Exit;
     }
@@ -638,11 +679,12 @@
     old_cursor = parser->root.cursor;
     old_limit  = parser->root.limit;
 
-    parser->root.cursor = master.start;
-    parser->root.limit  = master.limit;
-
-    for ( n = 0; n < blend->num_designs; n++ )
+    for ( n = 0; n < num_designs; n++ )
     {
+      token = design_tokens + n;
+      parser->root.cursor = token->start;
+      parser->root.limit  = token->limit;
+
       blend->default_weight_vector[n] =
       blend->weight_vector[n]         = T1_ToFixed( parser, 0 );
     }
@@ -655,24 +697,9 @@
   }
 
 
-  /* the keyword `/shareddict' appears in some multiple master fonts   */
-  /* with a lot of Postscript garbage behind it (that's completely out */
-  /* of spec!); we detect it and terminate the parsing                 */
-  /*                                                                   */
-  static void
-  parse_shared_dict( T1_Face    face,
-                     T1_Loader  loader )
-  {
-    T1_Parser  parser = &loader->parser;
-
-    FT_UNUSED( face );
-
+#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */
 
-    parser->root.cursor = parser->root.limit;
-    parser->root.error  = 0;
-  }
 
-#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */
 
 
   /*************************************************************************/
@@ -683,15 +710,6 @@
   /*************************************************************************/
   /*************************************************************************/
 
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* First of all, define the token field static variables.  This is a set */
-  /* of T1_FieldRec variables used later.                                  */
-  /*                                                                       */
-  /*************************************************************************/
-
-
   static FT_Error
   t1_load_keyword( T1_Face         face,
                    T1_Loader       loader,
@@ -774,33 +792,13 @@
   static int
   is_space( FT_Byte  c )
   {
-    return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' );
+    return ( c == ' '  || c == '\t'              ||
+             c == '\r' || c == '\n' || c == '\f' ||
+             c == '\0'                           );
   }
 
 
   static int
-  is_name_char( FT_Byte  c )
-  {
-    /* Note: PostScript allows any non-delimiting, non-whitespace      */
-    /*       in a name (PS Ref Manual, 3rd Ed, p31)                    */
-    /*       PostScript delimiters include (,),<,>,[,],{,},/ and %     */
-
-    return ( c != '(' &&
-             c != ')' &&
-             c != '<' &&
-             c != '>' &&
-             c != '[' &&
-             c != ']' &&
-             c != '{' &&
-             c != '}' &&
-             c != '/' &&
-             c != '%' &&
-             ! is_space( c )
-             );
- }
-
-
-  static int
   read_binary_data( T1_Parser  parser,
                     FT_Long*   size,
                     FT_Byte**  base )
@@ -809,20 +807,21 @@
     FT_Byte*  limit = parser->root.limit;
 
 
-    /* the binary data has the following format */
-    /*                                          */
-    /* `size' [white*] RD white ....... ND      */
-    /*                                          */
+    /* the binary data has one of the following formats */
+    /*                                                  */
+    /*   `size' [white*] RD white ....... ND            */
+    /*   `size' [white*] -| white ....... |-            */
+    /*                                                  */
 
     T1_Skip_Spaces( parser );
+
     cur = parser->root.cursor;
 
-    if ( cur < limit && (FT_Byte)( *cur - '0' ) < 10 )
+    if ( cur < limit && ft_isdigit( *cur ) )
     {
       *size = T1_ToInt( parser );
 
-      T1_Skip_Spaces( parser );
-      T1_Skip_Alpha ( parser );  /* `RD' or `-|' or something else */
+      T1_Skip_PS_Token( parser );   /* `RD' or `-|' or something else */
 
       /* there is only one whitespace char after the */
       /* `RD' or `-|' token                          */
@@ -838,9 +837,8 @@
   }
 
 
-  /* we will now define the routines used to handle */
-  /* the `/Encoding', `/Subrs', and `/CharStrings'  */
-  /* dictionaries                                   */
+  /* We now define the routines to handle the `/Encoding', `/Subrs', */
+  /* and `/CharStrings' dictionaries.                                */
 
   static void
   parse_font_matrix( T1_Face    face,
@@ -854,13 +852,9 @@
     FT_Fixed    temp_scale;
 
 
-    if ( matrix->xx || matrix->yx )
-      /* with synthetic fonts, it's possible we get here twice  */
-      return;
-
     (void)T1_ToFixedArray( parser, 6, temp, 3 );
 
-    temp_scale = ABS( temp[3] );
+    temp_scale = FT_ABS( temp[3] );
 
     /* Set Units per EM based on FontMatrix values.  We set the value to */
     /* 1000 / temp_scale, because temp_scale was already multiplied by   */
@@ -886,8 +880,8 @@
     matrix->yy = temp[3];
 
     /* note that the offsets must be expressed in integer font units */
-    offset->x  = temp[4] >> 16;
-    offset->y  = temp[5] >> 16;
+    offset->x = temp[4] >> 16;
+    offset->y = temp[5] >> 16;
   }
 
 
@@ -895,49 +889,52 @@
   parse_encoding( T1_Face    face,
                   T1_Loader  loader )
   {
-    T1_Parser      parser = &loader->parser;
-    FT_Byte*       cur    = parser->root.cursor;
-    FT_Byte*       limit  = parser->root.limit;
+    T1_Parser  parser = &loader->parser;
+    FT_Byte*   cur;
+    FT_Byte*   limit  = parser->root.limit;
 
-    PSAux_Service  psaux  = (PSAux_Service)face->psaux;
+    PSAux_Service  psaux = (PSAux_Service)face->psaux;
 
 
-    /* skip whitespace */
-    while ( is_space( *cur ) )
+    T1_Skip_Spaces( parser );
+    cur = parser->root.cursor;
+    if ( cur >= limit )
     {
-      cur++;
-      if ( cur >= limit )
-      {
-        FT_ERROR(( "parse_encoding: out of bounds!\n" ));
-        parser->root.error = T1_Err_Invalid_File_Format;
-        return;
-      }
+      FT_ERROR(( "parse_encoding: out of bounds!\n" ));
+      parser->root.error = T1_Err_Invalid_File_Format;
+      return;
     }
 
-    /* if we have a number, then the encoding is an array, */
-    /* and we must load it now                             */
-    if ( (FT_Byte)( *cur - '0' ) < 10 )
+    /* if we have a number or `[', the encoding is an array, */
+    /* and we must load it now                               */
+    if ( ft_isdigit( *cur ) || *cur == '[' )
     {
-      T1_Encoding  encode     = &face->type1.encoding;
+      T1_Encoding  encode          = &face->type1.encoding;
       FT_Int       count, n;
-      PS_Table     char_table = &loader->encoding_table;
-      FT_Memory    memory     = parser->root.memory;
+      PS_Table     char_table      = &loader->encoding_table;
+      FT_Memory    memory          = parser->root.memory;
       FT_Error     error;
+      FT_Bool      only_immediates = 0;
 
 
-      if ( encode->char_index )
-        /*  with synthetic fonts, it's possible we get here twice  */
-        return;
+      /* read the number of entries in the encoding; should be 256 */
+      if ( *cur == '[' )
+      {
+        count           = 256;
+        only_immediates = 1;
+        parser->root.cursor++;
+      }
+      else
+        count = (FT_Int)T1_ToInt( parser );
 
-      /* read the number of entries in the encoding, should be 256 */
-      count = (FT_Int)T1_ToInt( parser );
-      if ( parser->root.error )
+      T1_Skip_Spaces( parser );
+      if ( parser->root.cursor >= limit )
         return;
 
       /* we use a T1_Table to store our charnames */
       loader->num_chars = encode->num_chars = count;
-      if ( FT_NEW_ARRAY( encode->char_index, count ) ||
-           FT_NEW_ARRAY( encode->char_name,  count ) ||
+      if ( FT_NEW_ARRAY( encode->char_index, count )     ||
+           FT_NEW_ARRAY( encode->char_name,  count )     ||
            FT_SET_ERROR( psaux->ps_table_funcs->init(
                            char_table, count, memory ) ) )
       {
@@ -954,8 +951,11 @@
         T1_Add_Table( char_table, n, notdef, 8 );
       }
 
-      /* Now, we will need to read a record of the form         */
-      /* ... charcode /charname ... for each entry in our table */
+      /* Now we need to read records of the form                */
+      /*                                                        */
+      /*   ... charcode /charname ...                           */
+      /*                                                        */
+      /* for each entry in our table.                           */
       /*                                                        */
       /* We simply look for a number followed by an immediate   */
       /* name.  Note that this ignores correctly the sequence   */
@@ -965,75 +965,85 @@
       /*                                                        */
       /* used to clean the encoding array before anything else. */
       /*                                                        */
-      /* We stop when we encounter a `def'.                     */
+      /* Alternatively, if the array is directly given as       */
+      /*                                                        */
+      /*   /Encoding [ ... ]                                    */
+      /*                                                        */
+      /* we only read immediates.                               */
 
-      cur   = parser->root.cursor;
-      limit = parser->root.limit;
-      n     = 0;
+      n = 0;
+      T1_Skip_Spaces( parser );
 
-      for ( ; cur < limit; )
+      while ( parser->root.cursor < limit )
       {
-        FT_Byte  c;
+        cur = parser->root.cursor;
 
-
-        c = *cur;
-
-        /* we stop when we encounter a `def' */
-        if ( c == 'd' && cur + 3 < limit )
+        /* we stop when we encounter a `def' or `]' */
+        if ( *cur == 'd' && cur + 3 < limit )
         {
-          if ( cur[1] == 'e'       &&
-               cur[2] == 'f'       &&
-               is_space( cur[-1] ) &&
-               is_space( cur[3] )  )
+          if ( cur[1] == 'e'      &&
+               cur[2] == 'f'      &&
+               is_space( cur[3] ) )
           {
             FT_TRACE6(( "encoding end\n" ));
+            cur += 3;
             break;
           }
         }
+        if ( *cur == ']' )
+        {
+          FT_TRACE6(( "encoding end\n" ));
+          cur++;
+          break;
+        }
 
-        /* otherwise, we must find a number before anything else */
-        if ( (FT_Byte)( c - '0' ) < 10 )
+        /* check whether we've found an entry */
+        if ( ft_isdigit( *cur ) || only_immediates )
         {
           FT_Int  charcode;
 
 
-          parser->root.cursor = cur;
-          charcode = (FT_Int)T1_ToInt( parser );
-          cur      = parser->root.cursor;
+          if ( only_immediates )
+            charcode = n;
+          else
+          {
+            charcode = (FT_Int)T1_ToInt( parser );
+            T1_Skip_Spaces( parser );
+          }
 
-          /* skip whitespace */
-          while ( cur < limit && is_space( *cur ) )
-            cur++;
+          cur = parser->root.cursor;
 
-          if ( cur < limit && *cur == '/' )
+          if ( *cur == '/' && cur + 2 < limit && n < count )
           {
-            /* bingo, we have an immediate name -- it must be a */
-            /* character name                                   */
-            FT_Byte*    cur2 = cur + 1;
             FT_PtrDist  len;
 
 
-            while ( cur2 < limit && is_name_char( *cur2 ) )
-              cur2++;
+            cur++;
+
+            parser->root.cursor = cur;
+            T1_Skip_PS_Token( parser );
 
-            len = cur2 - cur - 1;
+            len = parser->root.cursor - cur;
 
             parser->root.error = T1_Add_Table( char_table, charcode,
-                                               cur + 1, len + 1 );
-            char_table->elements[charcode][len] = '\0';
+                                               cur, len + 1 );
             if ( parser->root.error )
               return;
+            char_table->elements[charcode][len] = '\0';
 
-            cur = cur2;
+            n++;
           }
         }
         else
-          cur++;
+          T1_Skip_PS_Token( parser );
+
+        T1_Skip_Spaces( parser );
       }
 
       face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY;
       parser->root.cursor       = cur;
     }
+
     /* Otherwise, we should have either `StandardEncoding', */
     /* `ExpertEncoding', or `ISOLatin1Encoding'             */
     else
@@ -1051,10 +1061,7 @@
         face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
 
       else
-      {
-        FT_ERROR(( "parse_encoding: invalid token!\n" ));
-        parser->root.error = T1_Err_Invalid_File_Format;
-      }
+        parser->root.error = T1_Err_Ignore;
     }
   }
 
@@ -1063,46 +1070,49 @@
   parse_subrs( T1_Face    face,
                T1_Loader  loader )
   {
-    T1_Parser      parser = &loader->parser;
-    PS_Table       table  = &loader->subrs;
-    FT_Memory      memory = parser->root.memory;
-    FT_Error       error;
-    FT_Int         n;
+    T1_Parser  parser = &loader->parser;
+    PS_Table   table  = &loader->subrs;
+    FT_Memory  memory = parser->root.memory;
+    FT_Error   error;
+    FT_Int     n, num_subrs;
 
     PSAux_Service  psaux  = (PSAux_Service)face->psaux;
 
 
-    if ( loader->num_subrs )
-      /*  with synthetic fonts, it's possible we get here twice  */
-      return;
+    T1_Skip_Spaces( parser );
 
-    if ( parser->root.cursor + 2 > parser->root.limit &&
-         parser->root.cursor[0] == '['                &&
-         parser->root.cursor[1] == ']'                )
-    {
-      /* empty array */
+    /* test for empty array */
+    if ( parser->root.cursor < parser->root.limit &&
+         *parser->root.cursor == '['              )
+    {
+      T1_Skip_PS_Token( parser );
+      T1_Skip_Spaces  ( parser );
+      if ( parser->root.cursor >= parser->root.limit ||
+           *parser->root.cursor != ']'               )
+        parser->root.error = T1_Err_Invalid_File_Format;
       return;
     }
 
-    loader->num_subrs = (FT_Int)T1_ToInt( parser );
-    if ( parser->root.error )
-      return;
+    num_subrs = (FT_Int)T1_ToInt( parser );
 
     /* position the parser right before the `dup' of the first subr */
-    T1_Skip_Spaces( parser );
-    T1_Skip_Alpha( parser );      /* `array' */
-    T1_Skip_Spaces( parser );
+    T1_Skip_PS_Token( parser );         /* `array' */
+    T1_Skip_Spaces  ( parser );
 
-    /* initialize subrs array */
-    error = psaux->ps_table_funcs->init( table, loader->num_subrs, memory );
-    if ( error )
-      goto Fail;
+    /* initialize subrs array -- with synthetic fonts it is possible */
+    /* we get here twice                                             */
+    if ( !loader->num_subrs )
+    {
+      error = psaux->ps_table_funcs->init( table, num_subrs, memory );
+      if ( error )
+        goto Fail;
+    }
 
     /* the format is simple:                                 */
     /*                                                       */
     /*   `index' + binary data                               */
     /*                                                       */
-    for ( n = 0; n < loader->num_subrs; n++ )
+    for ( n = 0; n < num_subrs; n++ )
     {
       FT_Long   idx, size;
       FT_Byte*  base;
@@ -1113,6 +1123,8 @@
       if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
         break;
 
+      T1_Skip_PS_Token( parser );       /* `dup' */
+
       idx = T1_ToInt( parser );
 
       if ( !read_binary_data( parser, &size, &base ) )
@@ -1122,16 +1134,19 @@
       /* (bound to `noaccess put') or by two separate tokens:  */
       /* `noaccess' & `put'.  We position the parser right     */
       /* before the next `dup', if any.                        */
-      T1_Skip_Spaces( parser );
-      T1_Skip_Alpha( parser );    /* `NP' or `I' or `noaccess' */
-      T1_Skip_Spaces( parser );
+      T1_Skip_PS_Token( parser );   /* `NP' or `|' or `noaccess' */
+      T1_Skip_Spaces  ( parser );
 
       if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 )
       {
-        T1_Skip_Alpha( parser );  /* skip `put' */
-        T1_Skip_Spaces( parser );
+        T1_Skip_PS_Token( parser ); /* skip `put' */
+        T1_Skip_Spaces  ( parser );
       }
 
+      /* with synthetic fonts it is possible we get here twice */
+      if ( loader->num_subrs )
+        continue;
+
       /* some fonts use a value of -1 for lenIV to indicate that */
       /* the charstrings are unencoded                           */
       /*                                                         */
@@ -1157,6 +1172,10 @@
       if ( error )
         goto Fail;
     }
+
+    if ( !loader->num_subrs )
+      loader->num_subrs = num_subrs;
+
     return;
 
   Fail:
@@ -1164,6 +1183,9 @@
   }
 
 
+#define TABLE_EXTEND  5
+
+
   static void
   parse_charstrings( T1_Face    face,
                      T1_Loader  loader )
@@ -1179,41 +1201,43 @@
 
     FT_Byte*       cur;
     FT_Byte*       limit        = parser->root.limit;
-    FT_Int         n;
+    FT_Int         n, num_glyphs;
     FT_UInt        notdef_index = 0;
     FT_Byte        notdef_found = 0;
 
 
-    if ( loader->num_glyphs )
-      /*  with synthetic fonts, it's possible we get here twice  */
-      return;
-
-    loader->num_glyphs = (FT_Int)T1_ToInt( parser );
-    if ( parser->root.error )
+    num_glyphs = (FT_Int)T1_ToInt( parser );
+    /* some fonts like Optima-Oblique not only define the /CharStrings */
+    /* array but access it also                                        */
+    if ( num_glyphs == 0 || parser->root.error )
       return;
 
-    /* initialize tables (leaving room for addition of .notdef, */
-    /* if necessary).                                           */
-
-    error = psaux->ps_table_funcs->init( code_table,
-                                         loader->num_glyphs + 1,
-                                         memory );
-    if ( error )
-      goto Fail;
-
-    error = psaux->ps_table_funcs->init( name_table,
-                                         loader->num_glyphs + 1,
-                                         memory );
-    if ( error )
-      goto Fail;
+    /* initialize tables, leaving space for addition of .notdef, */
+    /* if necessary, and a few other glyphs to handle buggy      */
+    /* fonts which have more glyphs than specified.              */
+
+    /* for some non-standard fonts like `Optima' which provides  */
+    /* different outlines depending on the resolution it is      */
+    /* possible to get here twice                                */
+    if ( !loader->num_glyphs )
+    {
+      error = psaux->ps_table_funcs->init(
+                code_table, num_glyphs + 1 + TABLE_EXTEND, memory );
+      if ( error )
+        goto Fail;
 
-    /* Initialize table for swapping index notdef_index and */
-    /* index 0 names and codes (if necessary).              */
+      error = psaux->ps_table_funcs->init(
+                name_table, num_glyphs + 1 + TABLE_EXTEND, memory );
+      if ( error )
+        goto Fail;
 
-    error = psaux->ps_table_funcs->init( swap_table, 4, memory );
+      /* Initialize table for swapping index notdef_index and */
+      /* index 0 names and codes (if necessary).              */
 
-    if ( error )
-      goto Fail;
+      error = psaux->ps_table_funcs->init( swap_table, 4, memory );
+      if ( error )
+        goto Fail;
+    }
 
     n = 0;
 
@@ -1223,11 +1247,9 @@
       FT_Byte*  base;
 
 
-      /* the format is simple:                    */
-      /*   `/glyphname' + binary data             */
-      /*                                          */
-      /* note that we stop when we find a `def'   */
-      /*                                          */
+      /* the format is simple:        */
+      /*   `/glyphname' + binary data */
+
       T1_Skip_Spaces( parser );
 
       cur = parser->root.cursor;
@@ -1235,50 +1257,62 @@
         break;
 
       /* we stop when we find a `def' or `end' keyword */
-      if ( *cur   == 'd'   &&
-           cur + 3 < limit &&
-           cur[1] == 'e'   &&
-           cur[2] == 'f'   )
-        break;
+      if ( cur + 3 < limit && is_space( cur[3] ) )
+      {
+        if ( cur[0] == 'd' &&
+             cur[1] == 'e' &&
+             cur[2] == 'f' )
+          break;
 
-      if ( *cur   == 'e'   &&
-           cur + 3 < limit &&
-           cur[1] == 'n'   &&
-           cur[2] == 'd'   )
-        break;
+        if ( cur[0] == 'e' &&
+             cur[1] == 'n' &&
+             cur[2] == 'd' )
+          break;
+      }
 
-      if ( *cur != '/' )
-        T1_Skip_Alpha( parser );
-      else
+      T1_Skip_PS_Token( parser );
+
+      if ( *cur == '/' )
       {
-        FT_Byte*    cur2 = cur + 1;
         FT_PtrDist  len;
 
 
-        while ( cur2 < limit && is_name_char( *cur2 ) )
-          cur2++;
-        len = cur2 - cur - 1;
+        if ( cur + 1 >= limit )
+        {
+          error = T1_Err_Invalid_File_Format;
+          goto Fail;
+        }
+
+        cur++;                              /* skip `/' */
+        len = parser->root.cursor - cur;
+
+        if ( !read_binary_data( parser, &size, &base ) )
+          return;
+
+        /* for some non-standard fonts like `Optima' which provides */
+        /* different outlines depending on the resolution it is     */
+        /* possible to get here twice                               */
+        if ( loader->num_glyphs )
+          continue;
 
-        error = T1_Add_Table( name_table, n, cur + 1, len + 1 );
+        error = T1_Add_Table( name_table, n, cur, len + 1 );
         if ( error )
           goto Fail;
 
         /* add a trailing zero to the name table */
         name_table->elements[n][len] = '\0';
 
-        /* record index of /.notdef              */
-        if ( ft_strcmp( (const char*)".notdef",
[truncated at 1000 lines; 449 more skipped]

reactos/lib/freetype/src/type1
t1objs.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t1objs.c	15 Feb 2004 21:45:37 -0000	1.4
+++ t1objs.c	10 May 2004 17:48:36 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 objects manager (body).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
+#include FT_TRUETYPE_IDS_H
 
 #include "t1gload.h"
 #include "t1load.h"
@@ -29,7 +30,7 @@
 #include "t1afm.h"
 #endif
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 
@@ -229,9 +230,6 @@
       FT_FREE( type1->encoding.char_name );
       FT_FREE( type1->font_name );
 
-      FT_FREE( type1->paint_type );
-      FT_FREE( type1->stroke_width );
-
 #ifndef T1_CONFIG_OPTION_NO_AFM
       /* release afm data if present */
       if ( face->afm_data )
@@ -278,11 +276,11 @@
                 FT_Int         num_params,
                 FT_Parameter*  params )
   {
-    FT_Error         error;
-    PSNames_Service  psnames;
-    PSAux_Service    psaux;
-    T1_Font          type1 = &face->type1;
-    PS_FontInfo      info = &type1->font_info;
+    FT_Error            error;
+    FT_Service_PsCMaps  psnames;
+    PSAux_Service       psaux;
+    T1_Font             type1 = &face->type1;
+    PS_FontInfo         info = &type1->font_info;
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
@@ -292,9 +290,8 @@
 
     face->root.num_faces = 1;
 
-    face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
-                                             "psnames" );
-    psnames = (PSNames_Service)face->psnames;
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
+    face->psnames = psnames;
 
     face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
                                            "psaux" );
@@ -434,8 +431,8 @@
 
       root->max_advance_height = root->height;
 
-      root->underline_position  = info->underline_position >> 16;
-      root->underline_thickness = info->underline_thickness >> 16;
+      root->underline_position  = (FT_Short)info->underline_position;
+      root->underline_thickness = (FT_Short)info->underline_thickness;
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;
@@ -469,25 +466,25 @@
         {
         case T1_ENCODING_TYPE_STANDARD:
           charmap.encoding    = FT_ENCODING_ADOBE_STANDARD;
-          charmap.encoding_id = 0;
+          charmap.encoding_id = TT_ADOBE_ID_STANDARD;
           clazz               = cmap_classes->standard;
           break;
 
         case T1_ENCODING_TYPE_EXPERT:
           charmap.encoding    = FT_ENCODING_ADOBE_EXPERT;
-          charmap.encoding_id = 1;
+          charmap.encoding_id = TT_ADOBE_ID_EXPERT;
           clazz               = cmap_classes->expert;
           break;
 
         case T1_ENCODING_TYPE_ARRAY:
           charmap.encoding    = FT_ENCODING_ADOBE_CUSTOM;
-          charmap.encoding_id = 2;
+          charmap.encoding_id = TT_ADOBE_ID_CUSTOM;
           clazz               = cmap_classes->custom;
           break;
 
         case T1_ENCODING_TYPE_ISOLATIN1:
           charmap.encoding    = FT_ENCODING_ADOBE_LATIN_1;
-          charmap.encoding_id = 3;
+          charmap.encoding_id = TT_ADOBE_ID_LATIN_1;
           clazz               = cmap_classes->unicode;
           break;
 

reactos/lib/freetype/src/type1
t1parse.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- t1parse.c	15 Feb 2004 21:45:37 -0000	1.3
+++ t1parse.c	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 parser (body).                                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -65,53 +65,30 @@
   /*************************************************************************/
 
 
-#define IS_T1_WHITESPACE( c )  ( (c) == ' '  || (c) == '\t' )
-#define IS_T1_LINESPACE( c )   ( (c) == '\r' || (c) == '\n' )
-
-#define IS_T1_SPACE( c )  ( IS_T1_WHITESPACE( c ) || IS_T1_LINESPACE( c ) )
-
-
-  typedef struct  PFB_Tag_
+  static FT_Error
+  read_pfb_tag( FT_Stream   stream,
+                FT_UShort  *atag,
+                FT_Long    *asize )
   {
+    FT_Error   error;
     FT_UShort  tag;
     FT_Long    size;
 
-  } PFB_Tag;
-
 
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PFB_Tag
+    *atag  = 0;
+    *asize = 0;
 
-
-  static
-  const FT_Frame_Field  pfb_tag_fields[] =
-  {
-    FT_FRAME_START( 6 ),
-      FT_FRAME_USHORT ( tag ),
-      FT_FRAME_LONG_LE( size ),
-    FT_FRAME_END
-  };
-
-
-  static FT_Error
-  read_pfb_tag( FT_Stream   stream,
-                FT_UShort*  tag,
-                FT_Long*    size )
-  {
-    FT_Error  error;
-    PFB_Tag   head;
-
-
-    *tag  = 0;
-    *size = 0;
-    if ( !FT_STREAM_READ_FIELDS( pfb_tag_fields, &head ) )
+    if ( !FT_READ_USHORT( tag ) )
     {
-      if ( head.tag == 0x8001U || head.tag == 0x8002U )
+      if ( tag == 0x8001U || tag == 0x8002U )
       {
-        *tag  = head.tag;
-        *size = head.size;
+        if ( !FT_READ_LONG_LE( size ) )
+          *asize = size;
       }
+
+      *atag = tag;
     }
+
     return error;
   }
 
@@ -127,7 +104,7 @@
     FT_Long    size;
 
 
-    psaux->ps_parser_funcs->init( &parser->root,0, 0, memory );
+    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
 
     parser->stream       = stream;
     parser->base_len     = 0;
@@ -242,36 +219,13 @@
   }
 
 
-  /* return the value of an hexadecimal digit */
-  static int
-  hexa_value( char  c )
-  {
-    unsigned int  d;
-
-
-    d = (unsigned int)( c - '0' );
-    if ( d <= 9 )
-      return (int)d;
-
-    d = (unsigned int)( c - 'a' );
-    if ( d <= 5 )
-      return (int)( d + 10 );
-
-    d = (unsigned int)( c - 'A' );
-    if ( d <= 5 )
-      return (int)( d + 10 );
-
-    return -1;
-  }
-
-
   FT_LOCAL_DEF( FT_Error )
   T1_Get_Private_Dict( T1_Parser      parser,
                        PSAux_Service  psaux )
   {
     FT_Stream  stream = parser->stream;
     FT_Memory  memory = parser->root.memory;
-    FT_Error   error  = 0;
+    FT_Error   error  = T1_Err_Ok;
     FT_Long    size;
 
 
@@ -325,7 +279,8 @@
           break;
         }
 
-        if ( FT_STREAM_READ( parser->private_dict + parser->private_len, size ) )
+        if ( FT_STREAM_READ( parser->private_dict + parser->private_len,
+                             size ) )
           goto Fail;
 
         parser->private_len += size;
@@ -333,9 +288,9 @@
     }
     else
     {
-      /* we have already `loaded' the whole PFA font file into memory; */
+      /* We have already `loaded' the whole PFA font file into memory; */
       /* if this is a memory resource, allocate a new block to hold    */
-      /* the private dict. Otherwise, simply overwrite into the base   */
+      /* the private dict.  Otherwise, simply overwrite into the base  */
       /* dictionary block in the heap.                                 */
 
       /* first of all, look at the `eexec' keyword */
@@ -344,24 +299,18 @@
       FT_Byte   c;
 
 
+    Again:
       for (;;)
       {
         c = cur[0];
         if ( c == 'e' && cur + 9 < limit )  /* 9 = 5 letters for `eexec' + */
                                             /* newline + 4 chars           */
         {
-          if ( cur[1] == 'e' && cur[2] == 'x' &&
-               cur[3] == 'e' && cur[4] == 'c' )
-          {
-            cur += 6; /* we skip the newling after the `eexec' */
-
-            /* XXX: Some fonts use DOS-linefeeds, i.e. \r\n; we need to */
-            /*      skip the extra \n if we find it                     */
-            if ( cur[0] == '\n' )
-              cur++;
-
+          if ( cur[1] == 'e' &&
+               cur[2] == 'x' &&
+               cur[3] == 'e' &&
+               cur[4] == 'c' )
             break;
-          }
         }
         cur++;
         if ( cur >= limit )
@@ -373,10 +322,57 @@
         }
       }
 
+      /* check whether `eexec' was real -- it could be in a comment */
+      /* or string (as e.g. in u003043t.gsf from ghostscript)       */
+
+      parser->root.cursor = parser->base_dict;
+      parser->root.limit  = cur + 9;
+
+      cur   = parser->root.cursor;
+      limit = parser->root.limit;
+
+      while ( cur < limit )
+      {
+        if ( *cur == 'e' && ft_strncmp( (char*)cur, "eexec", 5 ) == 0 )
+          goto Found;
+
+        T1_Skip_PS_Token( parser );
+        T1_Skip_Spaces  ( parser );
+        cur = parser->root.cursor;
+      }
+
+      /* we haven't found the correct `eexec'; go back and continue */
+      /* searching                                                  */
+
+      cur   = limit;
+      limit = parser->base_dict + parser->base_len;
+      goto Again;
+
       /* now determine where to write the _encrypted_ binary private  */
       /* dictionary.  We overwrite the base dictionary for disk-based */
       /* resources and allocate a new block otherwise                 */
 
+    Found:
+      parser->root.limit = parser->base_dict + parser->base_len;
+
+      T1_Skip_PS_Token( parser );
+      cur = parser->root.cursor;
+      if ( *cur == '\r' )
+      {
+        cur++;
+        if ( *cur == '\n' )
+          cur++;
+      }
+      else if ( *cur == '\n' )
+        cur++;
+      else
+      {
+        FT_ERROR(( "T1_Get_Private_Dict:" ));
+        FT_ERROR(( " `eexec' not properly terminated\n" ));
+        error = T1_Err_Invalid_File_Format;
+        goto Exit;
+      }
+
       size = (FT_Long)( parser->base_len - ( cur - parser->base_dict ) );
 
       if ( parser->in_memory )
@@ -402,51 +398,38 @@
       /* the `eexec' keyword); if they all are hexadecimal digits, then   */
       /* we have a case of ASCII storage                                  */
 
-      if ( ( hexa_value( cur[0] ) | hexa_value( cur[1] ) |
-             hexa_value( cur[2] ) | hexa_value( cur[3] ) ) < 0 )
-
-        /* binary encoding -- `simply' copy the private dict */
-        FT_MEM_COPY( parser->private_dict, cur, size );
-
-      else
+      if ( ft_isxdigit( cur[0] ) && ft_isxdigit( cur[1] ) &&
+           ft_isxdigit( cur[2] ) && ft_isxdigit( cur[3] ) )
       {
         /* ASCII hexadecimal encoding */
-
-        FT_Byte*  write;
-        FT_Int    count;
-
-
-        write = parser->private_dict;
-        count = 0;
-
-        for ( ;cur < limit; cur++ )
-        {
-          int  hex1;
+        FT_Long  len;
 
 
-          /* check for newline */
-          if ( cur[0] == '\r' || cur[0] == '\n' )
-            continue;
-
-          /* exit if we have a non-hexadecimal digit that isn't a newline */
-          hex1 = hexa_value( cur[0] );
-          if ( hex1 < 0 || cur + 1 >= limit )
-            break;
-
-          /* otherwise, store byte */
-          *write++ = (FT_Byte)( ( hex1 << 4 ) | hexa_value( cur[1] ) );
-          count++;
-          cur++;
-        }
+        parser->root.cursor = cur;
+        (void)psaux->ps_parser_funcs->to_bytes( &parser->root,
+                                                parser->private_dict,
+                                                parser->private_len,
+                                                &len,
+                                                0 );
+        parser->private_len = len;
 
         /* put a safeguard */
-        parser->private_len = write - parser->private_dict;
-        *write++ = 0;
+        parser->private_dict[len] = '\0';
       }
+      else
+        /* binary encoding -- copy the private dict */
+        FT_MEM_MOVE( parser->private_dict, cur, size );
     }
 
     /* we now decrypt the encoded binary private dictionary */
     psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U );
+
+    /* replace the four random bytes at the beginning with whitespace */
+    parser->private_dict[0] = ' ';
+    parser->private_dict[1] = ' ';
+    parser->private_dict[2] = ' ';
+    parser->private_dict[3] = ' ';
+
     parser->root.base   = parser->private_dict;
     parser->root.cursor = parser->private_dict;
     parser->root.limit  = parser->root.cursor + parser->private_len;

reactos/lib/freetype/src/type1
t1parse.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- t1parse.h	15 Feb 2004 21:45:37 -0000	1.3
+++ t1parse.h	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 parser (specification).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -69,9 +69,9 @@
     FT_Byte*      private_dict;
     FT_Long       private_len;
 
-    FT_Byte       in_pfb;
-    FT_Byte       in_memory;
-    FT_Byte       single_block;
+    FT_Bool       in_pfb;
+    FT_Bool       in_memory;
+    FT_Bool       single_block;
 
   } T1_ParserRec, *T1_Parser;
 
@@ -91,8 +91,8 @@
           } while ( 0 )
 
 
-#define T1_Skip_Spaces( p )  (p)->root.funcs.skip_spaces( &(p)->root )
-#define T1_Skip_Alpha( p )   (p)->root.funcs.skip_alpha ( &(p)->root )
+#define T1_Skip_Spaces( p )    (p)->root.funcs.skip_spaces( &(p)->root )
+#define T1_Skip_PS_Token( p )  (p)->root.funcs.skip_PS_token( &(p)->root )
 
 #define T1_ToInt( p )       (p)->root.funcs.to_int( &(p)->root )
 #define T1_ToFixed( p, t )  (p)->root.funcs.to_fixed( &(p)->root, t )

reactos/lib/freetype/src/type1
t1tokens.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- t1tokens.h	21 Jan 2004 19:23:47 -0000	1.2
+++ t1tokens.h	10 May 2004 17:48:36 -0000	1.3
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 tokenizer (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -60,6 +60,8 @@
   T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12 )
   T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12 )
 
+  T1_FIELD_FIXED     ( "ExpansionFactor", expansion_factor )
+
 
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  T1_FontRec

reactos/lib/freetype/src/type42
t42types.h 1.2 -> 1.3
diff -N t42types.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ t42types.h	10 May 2004 17:48:36 -0000	1.3
@@ -0,0 +1,54 @@
+/***************************************************************************/
+/*                                                                         */
+/*  t42types.h                                                             */
+/*                                                                         */
+/*    Type 42 font data types (specification only).                        */
+/*                                                                         */
+/*  Copyright 2002, 2003 by Roberto Alameda.                               */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef __T42TYPES_H__
+#define __T42TYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TYPE1_TABLES_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+
+
+FT_BEGIN_HEADER
+
+
+  typedef struct  T42_FaceRec_
+  {
+    FT_FaceRec     root;
+    T1_FontRec     type1;
+    const void*    psnames;
+    const void*    psaux;
+    const void*    afm_data;
+    FT_Byte*       ttf_data;
+    FT_ULong       ttf_size;
+    FT_Face        ttf_face;
+    FT_CharMapRec  charmaprecs[2];
+    FT_CharMap     charmaps[2];
+    PS_Unicodes    unicode_map;
+
+  } T42_FaceRec, *T42_Face;
+
+
+FT_END_HEADER
+
+#endif /* __T1TYPES_H__ */
+
+
+/* END */

reactos/lib/freetype/src/type42
t42drivr.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t42drivr.c	15 Feb 2004 21:45:37 -0000	1.4
+++ t42drivr.c	10 May 2004 17:48:36 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level Type 42 driver interface (body).                          */
 /*                                                                         */
-/*  Copyright 2002, 2003 by Roberto Alameda.                               */
+/*  Copyright 2002, 2003, 2004 by Roberto Alameda.                         */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -24,10 +24,9 @@
   /* 2) Incremental fonts making use of the GlyphDirectory keyword         */
   /*    will be loaded, but the rendering will be using the TrueType       */
   /*    tables.                                                            */
-  /* 3) The sfnts array is expected to be ASCII, not binary.               */
-  /* 4) As for Type1 fonts, CDevProc is not supported.                     */
-  /* 5) The Metrics dictionary is not supported.                           */
-  /* 6) AFM metrics are not supported.                                     */
+  /* 3) As for Type1 fonts, CDevProc is not supported.                     */
+  /* 4) The Metrics dictionary is not supported.                           */
+  /* 5) AFM metrics are not supported.                                     */
   /*                                                                       */
   /* In other words, this driver supports Type42 fonts derived from        */
   /* TrueType fonts in a non-CID manner, as done by usual conversion       */
@@ -41,11 +40,21 @@
 #include "t42error.h"
 #include FT_INTERNAL_DEBUG_H
 
+#include FT_SERVICE_XFREE86_NAME_H
+#include FT_SERVICE_GLYPH_DICT_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_t42
 
 
+ /*
+  *
+  *  GLYPH DICT SERVICE
+  *
+  */
+
   static FT_Error
   t42_get_glyph_name( T42_Face    face,
                       FT_UInt     glyph_index,
@@ -73,13 +82,6 @@
   }
 
 
-  static const char*
-  t42_get_ps_name( T42_Face  face )
-  {
-    return (const char*)face->type1.font_name;
-  }
-
-
   static FT_UInt
   t42_get_name_index( T42_Face    face,
                       FT_String*  glyph_name )
@@ -93,33 +95,95 @@
       gname = face->type1.glyph_names[i];
 
       if ( !ft_strcmp( glyph_name, gname ) )
-        return ft_atoi( (const char *)face->type1.charstrings[i] );
+        return (FT_UInt)ft_atol( (const char *)face->type1.charstrings[i] );
     }
 
     return 0;
   }
 
 
-  static FT_Module_Interface
-  T42_Get_Interface( FT_Driver         driver,
-                     const FT_String*  t42_interface )
+  static const FT_Service_GlyphDictRec  t42_service_glyph_dict =
   {
-    FT_UNUSED( driver );
+    (FT_GlyphDict_GetNameFunc)  t42_get_glyph_name,
+    (FT_GlyphDict_NameIndexFunc)t42_get_name_index
+  };
 
-    /* Any additional interface are defined here */
-    if (ft_strcmp( (const char*)t42_interface, "glyph_name" ) == 0 )
-      return (FT_Module_Interface)t42_get_glyph_name;
 
-    if ( ft_strcmp( (const char*)t42_interface, "name_index" ) == 0 )
-      return (FT_Module_Interface)t42_get_name_index;
+ /*
+  *
+  *  POSTSCRIPT NAME SERVICE
+  *
+  */
+
+  static const char*
+  t42_get_ps_font_name( T42_Face  face )
+  {
+    return (const char*)face->type1.font_name;
+  }
 
-    if ( ft_strcmp( (const char*)t42_interface, "postscript_name" ) == 0 )
-      return (FT_Module_Interface)t42_get_ps_name;
 
+  static const FT_Service_PsFontNameRec  t42_service_ps_font_name =
+  {
+    (FT_PsName_GetFunc)t42_get_ps_font_name
+  };
+
+
+ /*
+  *
+  *  POSTSCRIPT INFO SERVICE
+  *
+  */
+
+  static FT_Error
+  t42_ps_get_font_info( FT_Face          face,
+                        PS_FontInfoRec*  afont_info )
+  {
+    *afont_info = ((T42_Face)face)->type1.font_info;
     return 0;
   }
 
 
+  static FT_Int
+  t42_ps_has_glyph_names( FT_Face  face )
+  {
+    FT_UNUSED( face );
+    return 1;
+  }
+
+
+  static const FT_Service_PsInfoRec  t42_service_ps_info =
+  {
+    (PS_GetFontInfoFunc)  t42_ps_get_font_info,
+    (PS_HasGlyphNamesFunc)t42_ps_has_glyph_names
+  };
+
+
+ /*
+  *
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  t42_services[] =
+  {
+    { FT_SERVICE_ID_GLYPH_DICT,           &t42_service_glyph_dict },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t42_service_ps_font_name },
+    { FT_SERVICE_ID_POSTSCRIPT_INFO,      &t42_service_ps_info },
+    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_42 },
+    { NULL, NULL }
+  };
+
+
+  static FT_Module_Interface
+  T42_Get_Interface( FT_Driver         driver,
+                     const FT_String*  t42_interface )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( t42_services, t42_interface );
+  }
+
+
   const FT_Driver_ClassRec  t42_driver_class =
   {
     {

reactos/lib/freetype/src/type42
t42objs.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- t42objs.c	15 Feb 2004 21:45:37 -0000	1.5
+++ t42objs.c	10 May 2004 17:48:36 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 objects manager (body).                                      */
 /*                                                                         */
-/*  Copyright 2002, 2003 by Roberto Alameda.                               */
+/*  Copyright 2002, 2003, 2004 by Roberto Alameda.                         */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -53,7 +53,8 @@
     if ( error )
       goto Exit;
 
-    error = t42_parse_dict( face, &loader, parser->base_dict, parser->base_len );
+    error = t42_parse_dict( face, &loader,
+                            parser->base_dict, parser->base_len );
 
     if ( type1->font_type != 42 )
     {
@@ -65,7 +66,8 @@
     /* to the Type1 data                                    */
     type1->num_glyphs = loader.num_glyphs;
 
-    if ( !loader.charstrings.init ) {
+    if ( !loader.charstrings.init )
+    {
       FT_ERROR(( "T42_Open_Face: no charstrings array in face!\n" ));
       error = T42_Err_Invalid_File_Format;
     }
@@ -121,8 +123,10 @@
               if ( ft_strcmp( (const char*)".notdef",
                               (const char*)glyph_name ) != 0 )
               {
-                if ( charcode < min_char ) min_char = charcode;
-                if ( charcode > max_char ) max_char = charcode;
+                if ( charcode < min_char )
+                  min_char = charcode;
+                if ( charcode > max_char )
+                  max_char = charcode;
               }
               break;
             }
@@ -149,12 +153,12 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error         error;
-    PSNames_Service  psnames;
-    PSAux_Service    psaux;
-    FT_Face          root  = (FT_Face)&face->root;
-    T1_Font          type1 = &face->type1;
-    PS_FontInfo      info  = &type1->font_info;
+    FT_Error            error;
+    FT_Service_PsCMaps  psnames;
+    PSAux_Service       psaux;
+    FT_Face             root  = (FT_Face)&face->root;
+    T1_Font             type1 = &face->type1;
+    PS_FontInfo         info  = &type1->font_info;
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
@@ -165,9 +169,8 @@
     face->ttf_face       = NULL;
     face->root.num_faces = 1;
 
-    face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
-                                             "psnames" );
-    psnames = (PSNames_Service)face->psnames;
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
+    face->psnames = psnames;
 
     face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
                                            "psaux" );
@@ -190,7 +193,7 @@
       goto Exit;
     }
 
-    /* Now, load the font program into the face object */
+    /* Now load the font program into the face object */
 
     /* Init the face object fields */
     /* Now set up root face fields */
@@ -278,8 +281,8 @@
     root->max_advance_width  = face->ttf_face->max_advance_width;
     root->max_advance_height = face->ttf_face->max_advance_height;
 
-    root->underline_position  = info->underline_position >> 16;
-    root->underline_thickness = info->underline_thickness >> 16;
+    root->underline_position  = (FT_Short)info->underline_position;
+    root->underline_thickness = (FT_Short)info->underline_thickness;
 
     root->internal->max_points   = 0;
     root->internal->max_contours = 0;
@@ -351,7 +354,7 @@
 
 #if 0
         /* Select default charmap */
-        if (root->num_charmaps)
+        if ( root->num_charmaps )
           root->charmap = root->charmaps[0];
 #endif
       }
@@ -398,9 +401,6 @@
       FT_FREE( type1->encoding.char_name );
       FT_FREE( type1->font_name );
 
-      FT_FREE( type1->paint_type );
-      FT_FREE( type1->stroke_width );
-
       FT_FREE( face->ttf_data );
 
 #if 0
@@ -453,8 +453,6 @@
   }
 
 
-
-
   FT_LOCAL_DEF( FT_Error )
   T42_Size_Init( T42_Size  size )
   {
@@ -602,7 +600,7 @@
   FT_LOCAL_DEF( FT_Error )
   T42_GlyphSlot_Load( FT_GlyphSlot  glyph,
                       FT_Size       size,
-                      FT_Int        glyph_index,
+                      FT_UInt       glyph_index,
                       FT_Int32      load_flags )
   {
     FT_Error         error;

reactos/lib/freetype/src/type42
t42objs.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- t42objs.h	15 Feb 2004 21:45:37 -0000	1.3
+++ t42objs.h	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 objects manager (specification).                             */
 /*                                                                         */
-/*  Copyright 2002 by Roberto Alameda.                                     */
+/*  Copyright 2002, 2003 by Roberto Alameda.                               */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -22,10 +22,10 @@
 #include FT_FREETYPE_H
 #include FT_TYPE1_TABLES_H
 #include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_TYPE42_TYPES_H
+#include "t42types.h"
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
 
@@ -102,7 +102,7 @@
   FT_LOCAL( FT_Error )
   T42_GlyphSlot_Load( FT_GlyphSlot  glyph,
                       FT_Size       size,
-                      FT_Int        glyph_index,
+                      FT_UInt       glyph_index,
                       FT_Int32      load_flags );
 
   FT_LOCAL( void )

reactos/lib/freetype/src/type42
t42parse.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t42parse.c	15 Feb 2004 21:45:37 -0000	1.4
+++ t42parse.c	10 May 2004 17:48:36 -0000	1.5
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 font parser (body).                                          */
 /*                                                                         */
-/*  Copyright 2002, 2003 by Roberto Alameda.                               */
+/*  Copyright 2002, 2003, 2004 by Roberto Alameda.                         */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 /*  modified, and distributed under the terms of the FreeType project      */
@@ -93,10 +93,6 @@
   };
 
 
-#define T42_KEYWORD_COUNT                                          \
-          ( sizeof ( t42_keywords ) / sizeof ( t42_keywords[0] ) )
-
-
 #define T1_Add_Table( p, i, o, l )  (p)->funcs.add( (p), i, o, l )
 #define T1_Done_Table( p )          \
           do                        \
@@ -111,20 +107,18 @@
               (p)->funcs.release( p ); \
           } while ( 0 )
 
-#define T1_Skip_Spaces( p )  (p)->root.funcs.skip_spaces( &(p)->root )
-#define T1_Skip_Alpha( p )   (p)->root.funcs.skip_alpha ( &(p)->root )
+#define T1_Skip_Spaces( p )    (p)->root.funcs.skip_spaces( &(p)->root )
+#define T1_Skip_PS_Token( p )  (p)->root.funcs.skip_PS_token( &(p)->root )
 
-#define T1_ToInt( p )       (p)->root.funcs.to_int( &(p)->root )
-#define T1_ToFixed( p, t )  (p)->root.funcs.to_fixed( &(p)->root, t )
+#define T1_ToInt( p )                          \
+          (p)->root.funcs.to_int( &(p)->root )
+#define T1_ToBytes( p, b, m, n, d )                          \
+          (p)->root.funcs.to_bytes( &(p)->root, b, m, n, d )
 
-#define T1_ToCoordArray( p, m, c )                           \
-          (p)->root.funcs.to_coord_array( &(p)->root, m, c )
 #define T1_ToFixedArray( p, m, f, t )                           \
           (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
 #define T1_ToToken( p, t )                          \
           (p)->root.funcs.to_token( &(p)->root, t )
-#define T1_ToTokenArray( p, t, m, c )                           \
-          (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
 
 #define T1_Load_Field( p, f, o, m, pf )                         \
           (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
@@ -158,8 +152,8 @@
     /*   When creating a new Type 42 parser, we try to locate and load */
     /*   the base dictionary, loading the whole font into memory.      */
     /*                                                                 */
-    /*   When `loading' the base dictionary, we only setup pointers in */
-    /*   the case of a memory-based stream.  Otherwise, we allocate    */
+    /*   When `loading' the base dictionary, we only set up pointers   */
+    /*   in the case of a memory-based stream.  Otherwise, we allocate */
     /*   and load the base dictionary in it.                           */
     /*                                                                 */
     /*   parser->in_memory is set if we have a memory stream.          */
@@ -195,9 +189,9 @@
     }
 
     /* Now check font format; we must see `%!PS-TrueTypeFont' */
-    if (size <= 17                                    ||
-        ( ft_strncmp( (const char*)parser->base_dict,
-                      "%!PS-TrueTypeFont", 17) )      )
+    if ( size <= 17                                    ||
+         ( ft_strncmp( (const char*)parser->base_dict,
+                       "%!PS-TrueTypeFont", 17 ) )     )
       error = T42_Err_Unknown_File_Format;
     else
     {
@@ -229,23 +223,11 @@
 
 
   static int
-  t42_is_alpha( FT_Byte  c )
-  {
-    /* Note: we must accept "+" as a valid character, as it is used in */
-    /*       embedded type1 fonts in PDF documents.                    */
-    /*                                                                 */
-    return ( ft_isalnum( c ) ||
-             c == '.'        ||
-             c == '_'        ||
-             c == '-'        ||
-             c == '+'        );
-  }
-
-
-  static int
   t42_is_space( FT_Byte  c )
   {
-    return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' );
+    return ( c == ' '  || c == '\t'              ||
+             c == '\r' || c == '\n' || c == '\f' ||
+             c == '\0'                           );
   }
 
 
@@ -263,7 +245,7 @@
 
     (void)T1_ToFixedArray( parser, 6, temp, 3 );
 
-    temp_scale = ABS( temp[3] );
+    temp_scale = FT_ABS( temp[3] );
 
     /* Set Units per EM based on FontMatrix values.  We set the value to */
     /* 1000 / temp_scale, because temp_scale was already multiplied by   */
@@ -288,8 +270,8 @@
     matrix->yy = temp[3];
 
     /* note that the offsets must be expressed in integer font units */
-    offset->x  = temp[4] >> 16;
-    offset->y  = temp[5] >> 16;
+    offset->x = temp[4] >> 16;
+    offset->y = temp[5] >> 16;
   }
 
 
@@ -297,45 +279,52 @@
   t42_parse_encoding( T42_Face    face,
                       T42_Loader  loader )
   {
-    T42_Parser     parser = &loader->parser;
-    FT_Byte*       cur    = parser->root.cursor;
-    FT_Byte*       limit  = parser->root.limit;
+    T42_Parser  parser = &loader->parser;
+    FT_Byte*    cur;
+    FT_Byte*    limit  = parser->root.limit;
 
     PSAux_Service  psaux  = (PSAux_Service)face->psaux;
 
 
-    /* skip whitespace */
-    while ( t42_is_space( *cur ) )
+    T1_Skip_Spaces( parser );
+    cur = parser->root.cursor;
+    if ( cur >= limit )
     {
-      cur++;
-      if ( cur >= limit )
-      {
-        FT_ERROR(( "t42_parse_encoding: out of bounds!\n" ));
-        parser->root.error = T42_Err_Invalid_File_Format;
-        return;
-      }
+      FT_ERROR(( "t42_parse_encoding: out of bounds!\n" ));
+      parser->root.error = T42_Err_Invalid_File_Format;
+      return;
     }
 
-    /* if we have a number, then the encoding is an array, */
-    /* and we must load it now                             */
-    if ( (FT_Byte)( *cur - '0' ) < 10 )
-    {
-      T1_Encoding  encode     = &face->type1.encoding;
-      FT_Int       count, n;
-      PS_Table     char_table = &loader->encoding_table;
-      FT_Memory    memory     = parser->root.memory;
+    /* if we have a number or `[', the encoding is an array, */
+    /* and we must load it now                               */
+    if ( ft_isdigit( *cur ) || *cur == '[' )
+    {
+      T1_Encoding  encode          = &face->type1.encoding;
+      FT_UInt      count, n;
+      PS_Table     char_table      = &loader->encoding_table;
+      FT_Memory    memory          = parser->root.memory;
       FT_Error     error;
+      FT_Bool      only_immediates = 0;
 
 
-      /* read the number of entries in the encoding, should be 256 */
-      count = (FT_Int)T1_ToInt( parser );
-      if ( parser->root.error )
+      /* read the number of entries in the encoding; should be 256 */
+      if ( *cur == '[' )
+      {
+        count           = 256;
+        only_immediates = 1;
+        parser->root.cursor++;
+      }
+      else
+        count = (FT_UInt)T1_ToInt( parser );
+
+      T1_Skip_Spaces( parser );
+      if ( parser->root.cursor >= limit )
         return;
 
       /* we use a T1_Table to store our charnames */
       loader->num_chars = encode->num_chars = count;
-      if ( FT_NEW_ARRAY( encode->char_index, count ) ||
-           FT_NEW_ARRAY( encode->char_name,  count ) ||
+      if ( FT_NEW_ARRAY( encode->char_index, count )     ||
+           FT_NEW_ARRAY( encode->char_name,  count )     ||
            FT_SET_ERROR( psaux->ps_table_funcs->init(
                            char_table, count, memory ) ) )
       {
@@ -352,86 +341,99 @@
         T1_Add_Table( char_table, n, notdef, 8 );
       }
 
-      /* Now, we will need to read a record of the form         */
-      /* ... charcode /charname ... for each entry in our table */
+      /* Now we need to read records of the form                */
+      /*                                                        */
+      /*   ... charcode /charname ...                           */
+      /*                                                        */
+      /* for each entry in our table.                           */
       /*                                                        */
       /* We simply look for a number followed by an immediate   */
       /* name.  Note that this ignores correctly the sequence   */
-      /* that is often seen in type1 fonts:                     */
+      /* that is often seen in type42 fonts:                    */
       /*                                                        */
       /*   0 1 255 { 1 index exch /.notdef put } for dup        */
       /*                                                        */
       /* used to clean the encoding array before anything else. */
       /*                                                        */
-      /* We stop when we encounter a `def'.                     */
+      /* Alternatively, if the array is directly given as       */
+      /*                                                        */
+      /*   /Encoding [ ... ]                                    */
+      /*                                                        */
+      /* we only read immediates.                               */
 
-      cur   = parser->root.cursor;
-      limit = parser->root.limit;
-      n     = 0;
+      n = 0;
+      T1_Skip_Spaces( parser );
 
-      for ( ; cur < limit; )
+      while ( parser->root.cursor < limit )
       {
-        FT_Byte  c;
-
+        cur = parser->root.cursor;
 
-        c = *cur;
-
-        /* we stop when we encounter a `def' */
-        if ( c == 'd' && cur + 3 < limit )
+        /* we stop when we encounter `def' or `]' */
+        if ( *cur == 'd' && cur + 3 < limit )
         {
-          if ( cur[1] == 'e'       &&
-               cur[2] == 'f'       &&
-               t42_is_space( cur[-1] ) &&
-               t42_is_space( cur[3] )  )
+          if ( cur[1] == 'e'          &&
+               cur[2] == 'f'          &&
+               t42_is_space( cur[3] ) )
           {
             FT_TRACE6(( "encoding end\n" ));
+            cur += 3;
             break;
           }
         }
+        if ( *cur == ']' )
+        {
+          FT_TRACE6(( "encoding end\n" ));
+          cur++;
+          break;
+        }
 
-        /* otherwise, we must find a number before anything else */
-        if ( (FT_Byte)( c - '0' ) < 10 )
+        /* check whether we've found an entry */
+        if ( ft_isdigit( *cur ) || only_immediates )
         {
           FT_Int  charcode;
 
 
-          parser->root.cursor = cur;
-          charcode = (FT_Int)T1_ToInt( parser );
-          cur      = parser->root.cursor;
+          if ( only_immediates )
+            charcode = n;
+          else
+          {
+            charcode = (FT_Int)T1_ToInt( parser );
+            T1_Skip_Spaces( parser );
+          }
 
-          /* skip whitespace */
-          while ( cur < limit && t42_is_space( *cur ) )
-            cur++;
+          cur = parser->root.cursor;
 
-          if ( cur < limit && *cur == '/' )
+          if ( *cur == '/' && cur + 2 < limit && n < count )
           {
-            /* bingo, we have an immediate name -- it must be a */
-            /* character name                                   */
-            FT_Byte*  cur2 = cur + 1;
-            FT_Int    len;
+            FT_PtrDist  len;
 
 
-            while ( cur2 < limit && t42_is_alpha( *cur2 ) )
-              cur2++;
+            cur++;
 
-            len = (FT_Int)( cur2 - cur - 1 );
+            parser->root.cursor = cur;
+            T1_Skip_PS_Token( parser );
+
+            len = parser->root.cursor - cur;
 
             parser->root.error = T1_Add_Table( char_table, charcode,
-                                               cur + 1, len + 1 );
+                                               cur, len + 1 );
             char_table->elements[charcode][len] = '\0';
             if ( parser->root.error )
               return;
 
-            cur = cur2;
+            n++;
           }
         }
         else
-          cur++;
+          T1_Skip_PS_Token( parser );
+
+        T1_Skip_Spaces( parser );
       }
 
       face->type1.encoding_type  = T1_ENCODING_TYPE_ARRAY;
       parser->root.cursor        = cur;
     }
+
     /* Otherwise, we should have either `StandardEncoding', */
     /* `ExpertEncoding', or `ISOLatin1Encoding'             */
     else
@@ -448,7 +450,8 @@
                 ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
         face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
 
-      else {
+      else
+      {
         FT_ERROR(( "t42_parse_encoding: invalid token!\n" ));
         parser->root.error = T42_Err_Invalid_File_Format;
       }
@@ -456,34 +459,13 @@
   }
 
 
-  static FT_UInt
-  t42_hexval( FT_Byte  v )
+  typedef enum
   {
-    FT_UInt  d;
-
-    d = (FT_UInt)( v - 'A' );
-    if ( d < 6 )
-    {
-      d += 10;
-      goto Exit;
-    }
-
-    d = (FT_UInt)( v - 'a' );
-    if ( d < 6 )
-    {
-      d += 10;
-      goto Exit;
-    }
-
-    d = (FT_UInt)( v - '0' );
-    if ( d < 10 )
-      goto Exit;
-
-    d = 0;
+    BEFORE_START,
+    BEFORE_TABLE_DIR,
+    OTHER_TABLES
 
-  Exit:
-    return d;
-  }
+  } T42_Load_Status;
 
 
   static void
@@ -492,154 +474,177 @@
   {
     T42_Parser  parser = &loader->parser;
     FT_Memory   memory = parser->root.memory;
-    FT_Byte*    cur    = parser->root.cursor;
+    FT_Byte*    cur;
     FT_Byte*    limit  = parser->root.limit;
     FT_Error    error;
-    FT_Int      num_tables = 0, status;
-    FT_ULong    count, ttf_size = 0, string_size = 0;
-    FT_Bool     in_string  = 0;
-    FT_Byte     v = 0;
+    FT_Int      num_tables = 0;
+    FT_ULong    count, ttf_size = 0;
 
+    FT_Long     n, string_size, old_string_size, real_size;
+    FT_Byte*    string_buf = NULL;
+    FT_Bool     alloc      = 0;
+
+    T42_Load_Status  status;
+
+
+    /* The format is                                */
+    /*                                              */
+    /*   /sfnts [ <hexstring> <hexstring> ... ] def */
+    /*                                              */
+    /* or                                           */
+    /*                                              */
+    /*   /sfnts [                                   */
+    /*      <num_bin_bytes> RD <binary data>        */
+    /*      <num_bin_bytes> RD <binary data>        */
+    /*      ...                                     */
+    /*   ] def                                      */
+    /*                                              */
+    /* with exactly one space after the `RD' token. */
 
-    /* The format is `/sfnts [ <...> <...> ... ] def' */
+    T1_Skip_Spaces( parser );
 
-    while ( t42_is_space( *cur ) )
-      cur++;
-
-    if (*cur++ == '[')
-    {
-      status = 0;
-      count = 0;
-    }
-    else
+    if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' )
     {
       FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector!\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
 
-    while ( cur < limit - 2 )
+    T1_Skip_Spaces( parser );
+    status          = BEFORE_START;
+    string_size     = 0;
+    old_string_size = 0;
+    count           = 0;
+
+    while ( parser->root.cursor < limit )
     {
-      while ( t42_is_space( *cur ) )
-        cur++;
+      cur = parser->root.cursor;
 
-      switch ( *cur )
+      if ( *cur == ']' )
       {
-      case ']':
-        parser->root.cursor = cur++;
-        return;
-
-      case '<':
-        in_string   = 1;
-        string_size = 0;
-        cur++;
-        continue;
+        parser->root.cursor++;
+        goto Exit;
+      }
 
-      case '>':
-        if ( !in_string )
-        {
-          FT_ERROR(( "t42_parse_sfnts: found unpaired `>'!\n" ));
-          error = T42_Err_Invalid_File_Format;
+      else if ( *cur == '<' )
+      {
+        T1_Skip_PS_Token( parser );
+        if ( parser->root.error )
+          goto Exit;
+
+        /* don't include delimiters */
+        string_size = (FT_Long)( ( parser->root.cursor - cur - 2 + 1 ) / 2 );
+        if ( FT_REALLOC( string_buf, old_string_size, string_size ) )
           goto Fail;
-        }
 
-        /* A string can have, as a last byte,         */
-        /* a zero byte for padding.  If so, ignore it */
-        if ( ( v == 0 ) && ( string_size % 2 == 1 ) )
-          count--;
-        in_string = 0;
-        cur++;
-        continue;
+        alloc = 1;
 
-      case '%':
-        if ( !in_string )
-        {
-          /* Comment found; skip till end of line */
-          while ( *cur != '\n' )
-            cur++;
-          continue;
-        }
-        else
-        {
-          FT_ERROR(( "t42_parse_sfnts: found `%' in string!\n" ));
-          error = T42_Err_Invalid_File_Format;
-          goto Fail;
-        }
+        parser->root.cursor = cur;
+        (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 );
+        old_string_size = string_size;
+        string_size = real_size;
+      }
+
+      else if ( ft_isdigit( *cur ) )
+      {
+        string_size = T1_ToInt( parser );
+
+        T1_Skip_PS_Token( parser );             /* `RD' */
+
+        string_buf = parser->root.cursor + 1;   /* one space after `RD' */
 
-      default:
-        if ( !ft_xdigit( *cur ) || !ft_xdigit( *(cur + 1) ) )
+        parser->root.cursor += string_size + 1;
+        if ( parser->root.cursor >= limit )
         {
-          FT_ERROR(( "t42_parse_sfnts: found non-hex characters in string" ));
+          FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" ));
           error = T42_Err_Invalid_File_Format;
           goto Fail;
         }
-
-        v = (FT_Byte)( 16 * t42_hexval( cur[0] ) + t42_hexval( cur[1] ) );
-        cur += 2;
-        string_size++;
       }
 
-      switch ( status )
+      /* A string can have a trailing zero byte for padding.  Ignore it. */
+      if ( string_buf[string_size - 1] == 0 && ( string_size % 2 == 1 ) )
+        string_size--;
+
+      for ( n = 0; n < string_size; n++ )
       {
-      case 0: /* The '[' was read, so load offset table, 12 bytes */
-        if ( count < 12 )
+        switch ( status )
         {
-          face->ttf_data[count++] = v;
-          continue;
-        }
-        else
-        {
-          num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
-          status     = 1;
-          ttf_size   = 12 + 16 * num_tables;
+        case BEFORE_START:
+          /* load offset table, 12 bytes */
+          if ( count < 12 )
+          {
+            face->ttf_data[count++] = string_buf[n];
+            continue;
+          }
+          else
+          {
+            num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
+            status     = BEFORE_TABLE_DIR;
+            ttf_size   = 12 + 16 * num_tables;
 
-          if ( FT_REALLOC( face->ttf_data, 12, ttf_size ) )
-            goto Fail;
-        }
-        /* No break, fall-through */
+            if ( FT_REALLOC( face->ttf_data, 12, ttf_size ) )
+              goto Fail;
+          }
+          /* fall through */
 
-      case 1: /* The offset table is read; read now the table directory */
-        if ( count < ttf_size )
-        {
-          face->ttf_data[count++] = v;
-          continue;
-        }
-        else
-        {
-          int      i;
-          FT_ULong len;
+        case BEFORE_TABLE_DIR:
+          /* the offset table is read; read the table directory */
+          if ( count < ttf_size )
+          {
+            face->ttf_data[count++] = string_buf[n];
+            continue;
+          }
+          else
+          {
+            int       i;
+            FT_ULong  len;
 
 
-          for ( i = 0; i < num_tables; i++ )
-          {
-            FT_Byte*  p = face->ttf_data + 12 + 16*i + 12;
+            for ( i = 0; i < num_tables; i++ )
+            {
+              FT_Byte*  p = face->ttf_data + 12 + 16 * i + 12;
 
-            len = FT_PEEK_ULONG( p );
 
-            /* Pad to a 4-byte boundary length */
-            ttf_size += ( len + 3 ) & ~3;
-          }
+              len = FT_PEEK_ULONG( p );
 
-          status         = 2;
-          face->ttf_size = ttf_size;
+              /* Pad to a 4-byte boundary length */
+              ttf_size += ( len + 3 ) & ~3;
+            }
 
-          if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
-                           ttf_size + 1 ) )
-            goto Fail;
-        }
-        /* No break, fall-through */
+            status         = OTHER_TABLES;
+            face->ttf_size = ttf_size;
 
-      case 2: /* We are reading normal tables; just swallow them */
-        face->ttf_data[count++] = v;
+            if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
+                             ttf_size + 1 ) )
+              goto Fail;
+          }
+          /* fall through */
 
+        case OTHER_TABLES:
+          /* all other tables are just copied */
+          if ( count >= ttf_size )
+          {
+            FT_ERROR(( "t42_parse_sfnts: too many binary data!\n" ));
+            error = T42_Err_Invalid_File_Format;
+            goto Fail;
+          }
+          face->ttf_data[count++] = string_buf[n];
+        }
       }
+
+      T1_Skip_Spaces( parser );
     }
 
-    /* If control reaches this point, the format was not valid */
+    /* if control reaches this point, the format was not valid */
     error = T42_Err_Invalid_File_Format;
 
   Fail:
     parser->root.error = error;
+
+  Exit:
+    if ( alloc )
+      FT_FREE( string_buf );
   }
 
 
@@ -647,22 +652,75 @@
   t42_parse_charstrings( T42_Face    face,
                          T42_Loader  loader )
   {
-    T42_Parser     parser     = &loader->parser;
-    PS_Table       code_table = &loader->charstrings;
-    PS_Table       name_table = &loader->glyph_names;
-    FT_Memory      memory     = parser->root.memory;
+    T42_Parser     parser       = &loader->parser;
+    PS_Table       code_table   = &loader->charstrings;
+    PS_Table       name_table   = &loader->glyph_names;
+    PS_Table       swap_table   = &loader->swap_table;
+    FT_Memory      memory       = parser->root.memory;
     FT_Error       error;
 
-    PSAux_Service  psaux      = (PSAux_Service)face->psaux;
+    PSAux_Service  psaux        = (PSAux_Service)face->psaux;
 
     FT_Byte*       cur;
-    FT_Byte*       limit      = parser->root.limit;
-    FT_Int         n;
+    FT_Byte*       limit        = parser->root.limit;
+    FT_UInt        n;
+    FT_UInt        notdef_index = 0;
+    FT_Byte        notdef_found = 0;
 
 
-    loader->num_glyphs = (FT_Int)T1_ToInt( parser );
-    if ( parser->root.error )
-      return;
+    T1_Skip_Spaces( parser );
+
+    if ( parser->root.cursor >= limit )
+    {
+      FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+      error = T42_Err_Invalid_File_Format;
+      goto Fail;
+    }
+
+    if ( ft_isdigit( *parser->root.cursor ) )
+    {
+      loader->num_glyphs = (FT_UInt)T1_ToInt( parser );
+      if ( parser->root.error )
+        return;
+    }
+    else if ( *parser->root.cursor == '<' )
+    {
+      /* We have `<< ... >>'.  Count the number of `/' in the dictionary */
+      /* to get its size.                                                */
+      FT_UInt  count = 0;
+
+
+      T1_Skip_PS_Token( parser );
+      T1_Skip_Spaces( parser );
+      cur = parser->root.cursor;
+
+      while ( parser->root.cursor < limit )
+      {
+        if ( *parser->root.cursor == '/' )
+          count++;
+        else if ( *parser->root.cursor == '>' )
+        {
+          loader->num_glyphs  = count;
+          parser->root.cursor = cur;        /* rewind */
+          break;
+        }
+        T1_Skip_PS_Token( parser );
+        T1_Skip_Spaces( parser );
+      }
+    }
+    else
+    {
+      FT_ERROR(( "t42_parse_charstrings: invalid token!\n" ));
+      error = T42_Err_Invalid_File_Format;
+      goto Fail;
+    }
+
+    if ( parser->root.cursor >= limit )
+    {
+      FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+      error = T42_Err_Invalid_File_Format;
+      goto Fail;
+    }
 
     /* initialize tables */
 
@@ -678,57 +736,82 @@
     if ( error )
       goto Fail;
 
+    /* Initialize table for swapping index notdef_index and */
+    /* index 0 names and codes (if necessary).              */
+
+    error = psaux->ps_table_funcs->init( swap_table, 4, memory );
+    if ( error )
+      goto Fail;
+
     n = 0;
 
     for (;;)
     {
-      /* the format is simple:                    */
-      /*   `/glyphname' + index + def             */
-      /*                                          */
-      /* note that we stop when we find an `end'  */
-      /*                                          */
+      /* The format is simple:                   */
+      /*   `/glyphname' + index [+ def]          */
+
       T1_Skip_Spaces( parser );
 
       cur = parser->root.cursor;
       if ( cur >= limit )
         break;
 
-      /* we stop when we find an `end' keyword */
-      if ( *cur   == 'e'   &&
-           cur + 3 < limit &&
-           cur[1] == 'n'   &&
-           cur[2] == 'd'   )
+      /* We stop when we find an `end' keyword or '>' */
+      if ( *cur   == 'e'          &&
+           cur + 3 < limit        &&
+           cur[1] == 'n'          &&
+           cur[2] == 'd'          &&
+           t42_is_space( cur[3] ) )
+        break;
+      if ( *cur == '>' )
         break;
 
-      if ( *cur != '/' )
-        T1_Skip_Alpha( parser );
-      else
+      T1_Skip_PS_Token( parser );
+
+      if ( *cur == '/' )
       {
-        FT_Byte*  cur2 = cur + 1;
-        FT_Int    len;
+        FT_PtrDist  len;
 
 
-        while ( cur2 < limit && t42_is_alpha( *cur2 ) )
-          cur2++;
-        len = (FT_Int)( cur2 - cur - 1 );
+        if ( cur + 1 >= limit )
+        {
+          FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+          error = T42_Err_Invalid_File_Format;
+          goto Fail;
+        }
+
+        cur++;                              /* skip `/' */
+        len = parser->root.cursor - cur;
 
-        error = T1_Add_Table( name_table, n, cur + 1, len + 1 );
+        error = T1_Add_Table( name_table, n, cur, len + 1 );
         if ( error )
           goto Fail;
 
         /* add a trailing zero to the name table */
         name_table->elements[n][len] = '\0';
 
-        parser->root.cursor = cur2;
+        /* record index of /.notdef */
+        if ( *cur == '.'                                              &&
+             ft_strcmp( ".notdef",
+                        (const char*)(name_table->elements[n]) ) == 0 )
+        {
+          notdef_index = n;
+          notdef_found = 1;
+        }
+
         T1_Skip_Spaces( parser );
 
-        cur2 = cur = parser->root.cursor;
-        if ( cur >= limit )
-          break;
+        cur = parser->root.cursor;
 
-        while ( cur2 < limit && t42_is_alpha( *cur2 ) )
-          cur2++;
-        len = (FT_Int)( cur2 - cur );
+        (void)T1_ToInt( parser );
+        if ( parser->root.cursor >= limit )
+        {
+          FT_ERROR(( "t42_parse_charstrings: out of bounds!\n" ));
+          error = T42_Err_Invalid_File_Format;
+          goto Fail;
+        }
+
+        len = parser->root.cursor - cur;
 
         error = T1_Add_Table( code_table, n, cur, len + 1 );
         if ( error )
@@ -742,15 +825,79 @@
       }
     }
 
-    /* Index 0 must be a .notdef element */
-    if ( ft_strcmp( (char *)name_table->elements[0], ".notdef" ) )
+    loader->num_glyphs = n;
+
+    if ( !notdef_found )
     {
-      FT_ERROR(( "t42_parse_charstrings: Index 0 is not `.notdef'!\n" ));
+      FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph!\n" ));
       error = T42_Err_Invalid_File_Format;
       goto Fail;
     }
 
-    loader->num_glyphs = n;
+    /* if /.notdef does not occupy index 0, do our magic. */
+    if ( ft_strcmp( (const char*)".notdef",
+                    (const char*)name_table->elements[0] ) )
+    {
+      /* Swap glyph in index 0 with /.notdef glyph.  First, add index 0  */
+      /* name and code entries to swap_table.  Then place notdef_index   */
+      /* name and code entries into swap_table.  Then swap name and code */
+      /* entries at indices notdef_index and 0 using values stored in    */
+      /* swap_table.                                                     */
+
+      /* Index 0 name */
+      error = T1_Add_Table( swap_table, 0,
+                            name_table->elements[0],
+                            name_table->lengths [0] );
+      if ( error )
+        goto Fail;
+
+      /* Index 0 code */
+      error = T1_Add_Table( swap_table, 1,
+                            code_table->elements[0],
+                            code_table->lengths [0] );
+      if ( error )
+        goto Fail;
+
+      /* Index notdef_index name */
+      error = T1_Add_Table( swap_table, 2,
+                            name_table->elements[notdef_index],
+                            name_table->lengths [notdef_index] );
+      if ( error )
+        goto Fail;
+
+      /* Index notdef_index code */
+      error = T1_Add_Table( swap_table, 3,
+                            code_table->elements[notdef_index],
+                            code_table->lengths [notdef_index] );
+      if ( error )
+        goto Fail;
+
+      error = T1_Add_Table( name_table, notdef_index,
+                            swap_table->elements[0],
+                            swap_table->lengths [0] );
+      if ( error )
+        goto Fail;
+
+      error = T1_Add_Table( code_table, notdef_index,
+                            swap_table->elements[1],
+                            swap_table->lengths [1] );
+      if ( error )
+        goto Fail;
+
+      error = T1_Add_Table( name_table, 0,
+                            swap_table->elements[2],
+                            swap_table->lengths [2] );
+      if ( error )
+        goto Fail;
+
+      error = T1_Add_Table( code_table, 0,
+                            swap_table->elements[3],
+                            swap_table->lengths [3] );
+      if ( error )
+        goto Fail;
+
+    }
+
     return;
 
   Fail:
@@ -770,14 +917,16 @@
 
 
     /* if the keyword has a dedicated callback, call it */
-    if ( field->type == T1_FIELD_TYPE_CALLBACK ) {
+    if ( field->type == T1_FIELD_TYPE_CALLBACK )
+    {
       field->reader( (FT_Face)face, loader );
       error = loader->parser.root.error;
       goto Exit;
     }
 
-    /* now, the keyword is either a simple field, or a table of fields; */
-    /* we are now going to take care of it                              */
+    /* now the keyword is either a simple field or a table of fields; */
+    /* we are now going to take care of it                            */
+
     switch ( field->location )
     {
     case T1_FIELD_LOCATION_FONT_INFO:
@@ -814,28 +963,27 @@
                   FT_Long     size )
   {
     T42_Parser  parser     = &loader->parser;
-    FT_Byte*    cur        = base;
-    FT_Byte*    limit      = cur + size;
-    FT_UInt     n_keywords = (FT_UInt)( sizeof ( t42_keywords ) /
-                                        sizeof ( t42_keywords[0] ) );
-
-    FT_Byte     keyword_flags[T42_KEYWORD_COUNT];
-
-    {
-      FT_UInt  n;
-
+    FT_Byte*    limit;
+    FT_Int      n_keywords = (FT_Int)( sizeof ( t42_keywords ) /
+                                         sizeof ( t42_keywords[0] ) );
 
-      for ( n = 0; n < T42_KEYWORD_COUNT; n++ )
-        keyword_flags[n] = 0;
-    }
 
     parser->root.cursor = base;
     parser->root.limit  = base + size;
-    parser->root.error  = 0;
+    parser->root.error  = T42_Err_Ok;
+
+    limit = parser->root.limit;
 
-    for ( ; cur < limit; cur++ )
+    T1_Skip_Spaces( parser );
+
+    while ( parser->root.cursor < limit )
[truncated at 1000 lines; 144 more skipped]

reactos/lib/freetype/src/type42
t42parse.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- t42parse.h	15 Feb 2004 21:45:37 -0000	1.4
+++ t42parse.h	10 May 2004 17:48:36 -0000	1.5
@@ -33,7 +33,7 @@
     FT_Byte*      base_dict;
     FT_Long       base_len;
 
-    FT_Byte       in_memory;
+    FT_Bool       in_memory;
 
   } T42_ParserRec, *T42_Parser;
 
@@ -42,13 +42,14 @@
   {
     T42_ParserRec  parser;          /* parser used to read the stream */
 
-    FT_Int         num_chars;       /* number of characters in encoding */
+    FT_UInt        num_chars;       /* number of characters in encoding */
     PS_TableRec    encoding_table;  /* PS_Table used to store the       */
                                     /* encoding character names         */
 
-    FT_Int         num_glyphs;
+    FT_UInt        num_glyphs;
     PS_TableRec    glyph_names;
     PS_TableRec    charstrings;
+    PS_TableRec    swap_table;      /* For moving .notdef glyph to index 0. */
 
   } T42_LoaderRec, *T42_Loader;
 

reactos/lib/freetype/src/winfonts
winfnt.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- winfnt.c	15 Feb 2004 21:45:37 -0000	1.5
+++ winfnt.c	10 May 2004 17:48:36 -0000	1.6
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,12 +21,11 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_FNT_TYPES_H
 
 #include "winfnt.h"
-
 #include "fnterrs.h"
-
+#include FT_SERVICE_WINFNT_H
+#include FT_SERVICE_XFREE86_NAME_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -38,8 +37,7 @@
 #define FT_COMPONENT  trace_winfnt
 
 
-  static
-  const FT_Frame_Field  winmz_header_fields[] =
+  static const FT_Frame_Field  winmz_header_fields[] =
   {
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  WinMZ_HeaderRec
@@ -51,8 +49,7 @@
     FT_FRAME_END
   };
 
-  static
-  const FT_Frame_Field  winne_header_fields[] =
+  static const FT_Frame_Field  winne_header_fields[] =
   {
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  WinNE_HeaderRec
@@ -65,13 +62,12 @@
     FT_FRAME_END
   };
 
-  static
-  const FT_Frame_Field  winfnt_header_fields[] =
+  static const FT_Frame_Field  winfnt_header_fields[] =
   {
 #undef  FT_STRUCTURE
 #define FT_STRUCTURE  FT_WinFNT_HeaderRec
 
-    FT_FRAME_START( 146 ),
+    FT_FRAME_START( 148 ),
       FT_FRAME_USHORT_LE( version ),
       FT_FRAME_ULONG_LE ( file_size ),
       FT_FRAME_BYTES    ( copyright, 60 ),
@@ -106,7 +102,7 @@
       FT_FRAME_USHORT_LE( A_space ),
       FT_FRAME_USHORT_LE( B_space ),
       FT_FRAME_USHORT_LE( C_space ),
-      FT_FRAME_USHORT_LE( color_table_offset ),
+      FT_FRAME_ULONG_LE ( color_table_offset ),
       FT_FRAME_BYTES    ( reserved1, 16 ),
     FT_FRAME_END
   };
@@ -125,6 +121,7 @@
 
     if ( font->fnt_frame )
       FT_FRAME_RELEASE( font->fnt_frame );
+    FT_FREE( font->family_name );
 
     FT_FREE( font );
     face->font = 0;
@@ -137,6 +134,8 @@
   {
     FT_Error          error;
     FT_WinFNT_Header  header = &font->header;
+    FT_Bool           new_format;
+    FT_UInt           size;
 
 
     /* first of all, read the FNT header */
@@ -153,6 +152,16 @@
       goto Exit;
     }
 
+    new_format = FT_BOOL( font->header.version == 0x300 );
+    size       = new_format ? 148 : 118;
+
+    if ( header->file_size < size )
+    {
+      FT_TRACE2(( "[not a valid FNT file]\n" ));
+      error = FNT_Err_Unknown_File_Format;
+      goto Exit;
+    }
+
     /* Version 2 doesn't have these fields */
     if ( header->version == 0x200 )
     {
@@ -361,7 +370,7 @@
   }
 
 
-  static FT_CMap_ClassRec  fnt_cmap_class_rec =
+  static const FT_CMap_ClassRec  fnt_cmap_class_rec =
   {
     sizeof ( FNT_CMapRec ),
 
@@ -371,7 +380,7 @@
     (FT_CMap_CharNextFunc) fnt_cmap_char_next
   };
 
-  static FT_CMap_Class  fnt_cmap_class = &fnt_cmap_class_rec;
+  static FT_CMap_Class const  fnt_cmap_class = &fnt_cmap_class_rec;
 
 
   static void
@@ -426,8 +435,9 @@
     /* we now need to fill the root FT_Face fields */
     /* with relevant information                   */
     {
-      FT_Face   root = FT_FACE( face );
-      FNT_Font  font = face->font;
+      FT_Face     root = FT_FACE( face );
+      FNT_Font    font = face->font;
+      FT_PtrDist  family_size;
 
 
       root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
@@ -453,10 +463,10 @@
 
 
         bsize->width  = font->header.avg_width;
-        bsize->height =
-          font->header.pixel_height + font->header.external_leading;
+        bsize->height = (FT_Short)(
+          font->header.pixel_height + font->header.external_leading );
         bsize->size   = font->header.nominal_point_size << 6;
-        bsize->x_ppem = 
+        bsize->x_ppem =
           (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )
                     / 72 );
         bsize->y_ppem =
@@ -468,11 +478,18 @@
         FT_CharMapRec  charmap;
 
 
-        charmap.encoding    = FT_ENCODING_UNICODE;
-        charmap.platform_id = 3;
-        charmap.encoding_id = 1;
+        charmap.encoding    = FT_ENCODING_NONE;
+        charmap.platform_id = 0;
+        charmap.encoding_id = 0;
         charmap.face        = root;
 
+        if ( font->header.charset == FT_WinFNT_ID_MAC )
+        {
+          charmap.encoding    = FT_ENCODING_APPLE_ROMAN;
+          charmap.platform_id = 1;
+/*        charmap.encoding_id = 0; */
+        }
+
         error = FT_CMap_New( fnt_cmap_class,
                              NULL,
                              &charmap,
@@ -491,8 +508,22 @@
       root->num_glyphs = font->header.last_char -
                            font->header.first_char + 1 + 1;
 
-      root->family_name = (FT_String*)font->fnt_frame +
-                            font->header.face_name_offset;
+      /* Some broken fonts don't delimit the face name with a final */
+      /* NULL byte -- the frame is erroneously one byte too small.  */
+      /* We thus allocate one more byte, setting it explicitly to   */
+      /* zero.                                                      */
+      family_size = font->header.file_size - font->header.face_name_offset;
+      if ( FT_ALLOC( font->family_name, family_size + 1 ) )
+        goto Fail;
+      FT_MEM_COPY( font->family_name,
+                   font->fnt_frame + font->header.face_name_offset,
+                   family_size );
+      font->family_name[family_size] = '\0';
+      if ( FT_REALLOC( font->family_name,
+                       family_size,
+                       ft_strlen( font->family_name ) + 1 ) )
+        goto Fail;
+      root->family_name = font->family_name;
       root->style_name  = (char *)"Regular";
 
       if ( root->style_flags & FT_STYLE_FLAG_BOLD )
@@ -505,10 +536,10 @@
       else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
         root->style_name = (char *)"Italic";
     }
+    goto Exit;
 
   Fail:
-    if ( error )
-      FNT_Face_Done( face );
+    FNT_Face_Done( face );
 
   Exit:
     return error;
@@ -528,8 +559,8 @@
 
 
       size->metrics.ascender    = font->header.ascent * 64;
-      size->metrics.descender   = ( font->header.pixel_height -
-                                      font->header.ascent ) * 64;
+      size->metrics.descender   = -( font->header.pixel_height -
+                                       font->header.ascent ) * 64;
       size->metrics.height      = font->header.pixel_height * 64;
       size->metrics.max_advance = font->header.max_width * 64;
 
@@ -573,7 +604,7 @@
     len        = new_format ? 6 : 4;
 
     /* jump to glyph entry */
-    p = font->fnt_frame + ( new_format ? 146 : 118 ) + len * glyph_index;
+    p = font->fnt_frame + ( new_format ? 148 : 118 ) + len * glyph_index;
 
     bitmap->width = FT_NEXT_SHORT_LE( p );
 
@@ -582,6 +613,13 @@
     else
       offset = FT_NEXT_USHORT_LE( p );
 
+    if ( offset >= font->header.file_size )
+    {
+      FT_TRACE2(( "invalid FNT offset!\n" ));
+      error = FNT_Err_Invalid_File_Format;
+      goto Exit;
+    }
+
     /* jump to glyph data */
     p = font->fnt_frame + /* font->header.bits_offset */ + offset;
 
@@ -632,6 +670,49 @@
   }
 
 
+  static FT_Error
+  winfnt_get_header( FT_Face               face,
+                     FT_WinFNT_HeaderRec  *aheader )
+  {
+    FNT_Font  font = ((FNT_Face)face)->font;
+
+
+    *aheader = font->header;
+
+    return 0;
+  }
+
+
+  static const FT_Service_WinFntRec  winfnt_service_rec =
+  {
+    winfnt_get_header
+  };
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  winfnt_services[] =
+  {
+    { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_WINFNT },
+    { FT_SERVICE_ID_WINFNT,    &winfnt_service_rec },
+    { NULL, NULL }
+  };
+
+
+  static FT_Module_Interface
+  winfnt_get_service( FT_Driver         driver,
+                      const FT_String*  service_id )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( winfnt_services, service_id );
+  }
+
+
+
+
   FT_CALLBACK_TABLE_DEF
   const FT_Driver_ClassRec  winfnt_driver_class =
   {
@@ -648,7 +729,7 @@
 
       (FT_Module_Constructor)0,
       (FT_Module_Destructor) 0,
-      (FT_Module_Requester)  0
+      (FT_Module_Requester)  winfnt_get_service
     },
 
     sizeof( FNT_FaceRec ),

reactos/lib/freetype/src/winfonts
winfnt.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- winfnt.h	15 Feb 2004 21:45:37 -0000	1.3
+++ winfnt.h	10 May 2004 17:48:36 -0000	1.4
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,11 +21,79 @@
 
 
 #include <ft2build.h>
+#include FT_WINFONTS_H
 #include FT_INTERNAL_DRIVER_H
 
 
 FT_BEGIN_HEADER
 
+  typedef struct  WinMZ_HeaderRec_
+  {
+    FT_UShort  magic;
+    /* skipped content */
+    FT_UShort  lfanew;
+
+  } WinMZ_HeaderRec;
+
+
+  typedef struct  WinNE_HeaderRec_
+  {
+    FT_UShort  magic;
+    /* skipped content */
+    FT_UShort  resource_tab_offset;
+    FT_UShort  rname_tab_offset;
+
+  } WinNE_HeaderRec;
+
+
+  typedef struct  WinNameInfoRec_
+  {
+    FT_UShort  offset;
+    FT_UShort  length;
+    FT_UShort  flags;
+    FT_UShort  id;
+    FT_UShort  handle;
+    FT_UShort  usage;
+
+  } WinNameInfoRec;
+
+
+  typedef struct  WinResourceInfoRec_
+  {
+    FT_UShort  type_id;
+    FT_UShort  count;
+
+  } WinResourceInfoRec;
+
+
+#define WINFNT_MZ_MAGIC  0x5A4D
+#define WINFNT_NE_MAGIC  0x454E
+
+
+  typedef struct  FNT_FontRec_
+  {
+    FT_ULong             offset;
+    FT_Int               size_shift;
+
+    FT_WinFNT_HeaderRec  header;
+
+    FT_Byte*             fnt_frame;
+    FT_ULong             fnt_size;
+    FT_String*           family_name;
+
+  } FNT_FontRec, *FNT_Font;
+
+
+  typedef struct  FNT_FaceRec_
+  {
+    FT_FaceRec     root;
+    FNT_Font       font;
+
+    FT_CharMap     charmap_handle;
+    FT_CharMapRec  charmap;  /* a single charmap per face */
+
+  } FNT_FaceRec, *FNT_Face;
+
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  winfnt_driver_class;
 

reactos/lib/freetype/tests
gview.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- gview.c	21 Jan 2004 19:23:49 -0000	1.2
+++ gview.c	10 May 2004 17:48:36 -0000	1.3
@@ -745,7 +745,7 @@
           x  = (NV_Pos)( v1.x + 0.5 );
 
           nv_pixmap_fill_rect( target, x - 1, y2, 3,
-                               ABS( y1 - y2 ) + 1, SEGMENT_COLOR );
+                               FT_ABS( y1 - y2 ) + 1, SEGMENT_COLOR );
         }
       }
 
@@ -787,7 +787,7 @@
           x  = (NV_Pos)( v1.y + 0.5 );
 
           nv_pixmap_fill_rect( target, y1, x - 1,
-                               ABS( y1 - y2 ) + 1, 3, SEGMENT_COLOR );
+                               FT_ABS( y1 - y2 ) + 1, 3, SEGMENT_COLOR );
         }
       }
 
CVSspam 0.2.8